Calling withSourceDeps on a SpoofaxLanguageSpecConfigBuilder is futile
I’m trying to build a language spec config using the
SpoofaxLanguageSpecConfigBuilder, but callingwithSourceDepson aSpoofaxLanguageSpecConfigBuilderhas no effect. The problem is that bothSpoofaxLanguageSpecConfigBuilderand its ancestorLanguageComponentConfigBuilderhave a fieldprojectConfigBuilder. InvokingwithSourceDepson aSpoofaxLanguageSpecConfigBuilderwill invoke the ancestorwithSourceDepsdefined inLanguageComponentConfigBuilder. The latter will update the version of projectConfigBuilder defined in the ancestor. Finally, when invokingbuildonSpoofaxLanguageSpecConfigBuilder, it will use the version of projectConfigBuilder defined in the child.tl;dr: Two instances with the name
projectConfigBuilderexist. CallingSpoofaxLanguageSpecConfigBuilder.withSourceDepsupdates the ancestor instance, but a subsequent call toSpoofaxLanguageSpecConfigBuilder.buildwill use the child version, such that the changes made to the source dependencies magically disappear.Proposed Solution
I believe the solution would be to have the parent class call getProjectConfigBuilder and override this method in the child class such that it returns the instance that’s stored in the child class, and not the one in the parent class.
Submitted by Martijn on 4 May 2018 at 15:32
Log in to post comments