GROOVY-12160: @AnnotationCollector emits collected annotation members…#2705
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2705 +/- ##
==================================================
+ Coverage 69.1077% 69.1180% +0.0102%
- Complexity 34235 34249 +14
==================================================
Files 1537 1537
Lines 129356 129373 +17
Branches 23503 23508 +5
==================================================
+ Hits 89395 89420 +25
+ Misses 31941 31934 -7
+ Partials 8020 8019 -1
🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes nondeterministic ordering of collected annotation members when an @AnnotationCollector is precompiled (collector comes from the classpath), ensuring emitted annotation member order matches the collector’s declaration order rather than hash iteration order.
Changes:
- Preserve member insertion order during collector expansion by using
LinkedHashMapwhen generating annotation members. - Add a regression test that compiles a collector to disk, applies it from the classpath, and verifies the classfile annotation member order via ASM.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/main/java/org/codehaus/groovy/transform/AnnotationCollectorTransform.java | Switches generated members map to LinkedHashMap to keep declaration order stable when copying members onto expanded annotations. |
| src/test/groovy/org/codehaus/groovy/transform/AnnotationCollectorMemberOrderTest.groovy | New regression test validating classfile-level member ordering for a precompiled collector. |
… in hash order when the collector is precompiled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… in hash order when the collector is precompiled