Calling withSourceDeps on a SpoofaxLanguageSpecConfigBuilder is futile
I’m trying to build a language spec config using the
SpoofaxLanguageSpecConfigBuilder
, but callingwithSourceDeps
on aSpoofaxLanguageSpecConfigBuilder
has no effect. The problem is that bothSpoofaxLanguageSpecConfigBuilder
and its ancestorLanguageComponentConfigBuilder
have a fieldprojectConfigBuilder
. InvokingwithSourceDeps
on aSpoofaxLanguageSpecConfigBuilder
will invoke the ancestorwithSourceDeps
defined inLanguageComponentConfigBuilder
. The latter will update the version of projectConfigBuilder defined in the ancestor. Finally, when invokingbuild
onSpoofaxLanguageSpecConfigBuilder
, it will use the version of projectConfigBuilder defined in the child.tl;dr: Two instances with the name
projectConfigBuilder
exist. CallingSpoofaxLanguageSpecConfigBuilder.withSourceDeps
updates the ancestor instance, but a subsequent call toSpoofaxLanguageSpecConfigBuilder.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