Skip to content

Fix: Make NavigableSetterDecorator application deactivatable#30

Merged
luepges merged 5 commits intoMontiCore:devfrom
JohannesLeurs:fix-navigablesetters-trafo-doesnt-respect-deactivation
May 10, 2025
Merged

Fix: Make NavigableSetterDecorator application deactivatable#30
luepges merged 5 commits intoMontiCore:devfrom
JohannesLeurs:fix-navigablesetters-trafo-doesnt-respect-deactivation

Conversation

@JohannesLeurs
Copy link
Contributor

@JohannesLeurs JohannesLeurs commented May 8, 2025

In contrast to other decorations added by cd2java.init.CD2Pojo.ftl ( GetterDecorator, SetterDecorator, etc.), NavigableSetterDecorator can not be deactivated via custom configuration templates, as it misses the check whether it should be applied.

This leads to an especially bizarre situation when attempting to deactivate both SetterDecorator and NavigableSetterDecorator: NavigableSetterDecorator errornously wants to execute and requests the decorator data that it expects to be left behind by SetterDecorator. As the latter did not run, as it was deactivated, a null value is produced and, in consequence, a NullPointerException is thrown.

var methods = decoratorData.getDecoratorData(SetterDecorator.class).methods.get(attribute);

This merge request adds the check for applicability to the NavigableSetterDecorator.

The inserted check is the same as, for example, in SetterDecorator:

if (decoratorData.shouldDecorate(this.getClass(), attribute)) { //...

@JohannesLeurs JohannesLeurs changed the title Make NavigableSetterDecorator application deactivatable Fix: Make NavigableSetterDecorator application deactivatable May 9, 2025
@JohannesLeurs
Copy link
Contributor Author

@luepges can you merge? I do not have the rights 😇

grafik

@luepges
Copy link
Contributor

luepges commented May 9, 2025

(Sorry in case you receive a bunch of action mails, I'm just using your PR to finally add the CI for PRs via forks)
I'll merge it once all checks are working :)

@JohannesLeurs
Copy link
Contributor Author

No problem and thank you!

@github-actions
Copy link

✔️ Changes pass the MontiVerse

Project Status
details
Project Status
montiarc
umlp
sd
montifun
fd
automaton
sc
guidsl
artifacts
ocl
od
ucd
langexperiments
json
xml
mlc
cd4analysis
monticore_basic
class2mc
secommons

The MontiVerse is a collection of (internal and public) language projects.

@luepges luepges merged commit ba4ccf4 into MontiCore:dev May 10, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants