I’m trying to build a language spec config using the SpoofaxLanguageSpecConfigBuilder, but calling withSourceDeps on a SpoofaxLanguageSpecConfigBuilder has no effect. The problem is that both SpoofaxLanguageSpecConfigBuilder and its ancestor LanguageComponentConfigBuilder have a field projectConfigBuilder. Invoking withSourceDeps on a SpoofaxLanguageSpecConfigBuilder will invoke the ancestor withSourceDeps defined in LanguageComponentConfigBuilder. The latter will update the version of projectConfigBuilder defined in the ancestor. Finally, when invoking build on SpoofaxLanguageSpecConfigBuilder, it will use the version of projectConfigBuilder defined in the child.

tl;dr: Two instances with the name projectConfigBuilder exist. Calling SpoofaxLanguageSpecConfigBuilder.withSourceDeps updates the ancestor instance, but a subsequent call to SpoofaxLanguageSpecConfigBuilder.build will 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