Skip to content

GROOVY-12160: @AnnotationCollector emits collected annotation members…#2705

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12160
Jul 14, 2026
Merged

GROOVY-12160: @AnnotationCollector emits collected annotation members…#2705
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12160

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

… in hash order when the collector is precompiled

@codecov-commenter

codecov-commenter commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.1180%. Comparing base (86c6648) to head (95ae832).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                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     
Files with missing lines Coverage Δ
...groovy/transform/AnnotationCollectorTransform.java 90.6404% <100.0000%> (ø)

... and 19 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@testlens-app

This comment has been minimized.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 LinkedHashMap when 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
@paulk-asert paulk-asert merged commit 9b4176b into apache:master Jul 14, 2026
28 checks passed
@paulk-asert paulk-asert deleted the groovy12160 branch July 14, 2026 00:49
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.

3 participants