Skip to content

#1600 Stop infinite recursion for annotations applying to themselves#1601

Merged
elucash merged 3 commits intoimmutables:masterfrom
aldexis:ald/fix-recursive-annotation
Oct 3, 2025
Merged

#1600 Stop infinite recursion for annotations applying to themselves#1601
elucash merged 3 commits intoimmutables:masterfrom
aldexis:ald/fix-recursive-annotation

Conversation

@aldexis
Copy link
Copy Markdown
Contributor

@aldexis aldexis commented Oct 2, 2025

This fixes #1600 which was a bug introduced by 3da32c5.

I'm honestly not too sure about where to put the test to reproduce the bug and validate it. Ultimately all that matters is that we test the compilation of the class, but I couldn't figure out where other examples of tests like this would live, so I pattern-matched from the test added in that same commit.

Happy to update the test to whatever makes sense!

import nonimmutables.ChildAnnotationA;
import nonimmutables.ChildAnnotationB;
import nonimmutables.ImmutablePassAnnsTargeting;
import nonimmutables.SelfApplyingAnnotation;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My IntelliJ was automatically reformatting the imports to import nonimmutables.*; so I had reverted this part and missed that I also reverted adding the import for the new annotation 🤦

import org.immutables.value.Value;

@Value.Immutable
@Value.Style(passAnnotations = {SelfApplyingAnnotation.class})
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to add this for the test to pass (I somehow thought I had it passing before - not sure what happened). It doesn't really matter though, since what we want to test is the fact that it compiles fine, though I'm not sure how to best set this up

@elucash elucash merged commit 4ee55c6 into immutables:master Oct 3, 2025
16 checks passed
@elucash
Copy link
Copy Markdown
Member

elucash commented Oct 3, 2025

Thank you for discovering the issue and promptly fixing it! Merging

@aldexis
Copy link
Copy Markdown
Contributor Author

aldexis commented Oct 3, 2025

Thanks for merging!

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.

Immutable 2.11.4 causes StackOverflowError when object uses Jackson and Guava GwtCompatible annotations

2 participants