Skip to content

GROOVY-12159: Synthetic class-literal fields and accessors are emitte…#2704

Merged
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12159
Jul 13, 2026
Merged

GROOVY-12159: Synthetic class-literal fields and accessors are emitte…#2704
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12159

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

…d in hash order, not the order the literals were encountered

@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.1062%. Comparing base (86c6648) to head (b3b2e10).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2704        +/-   ##
==================================================
- Coverage     69.1077%   69.1062%   -0.0015%     
+ Complexity      34235      34233         -2     
==================================================
  Files            1537       1537                
  Lines          129356     129356                
  Branches        23503      23503                
==================================================
- Hits            89395      89393         -2     
- Misses          31941      31942         +1     
- Partials         8020       8021         +1     
Files with missing lines Coverage Δ
...rg/codehaus/groovy/classgen/AsmClassGenerator.java 85.0616% <100.0000%> (ø)

... and 12 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 deterministic bytecode output for synthetic class-literal helper members by ensuring class-literal helper fields/accessors are emitted in encounter order (rather than HashMap iteration order), and adds a regression test to lock in the behavior.

Changes:

  • Switch AsmClassGenerator.referencedClasses to an insertion-ordered map to preserve encounter order when generating synthetic class-literal fields/accessors.
  • Add a new ASM-based regression test that compiles two compilation units and asserts the $class$... fields and $get$$class$... accessors appear in the expected order in the resulting class file.

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/classgen/AsmClassGenerator.java Preserve encounter order for synthetic class-literal helpers by iterating an insertion-ordered map.
src/test/groovy/org/codehaus/groovy/classgen/SyntheticClassLiteralFieldOrderTest.groovy New regression test asserting synthetic class-literal fields/accessors are emitted in encounter order.

Comment thread src/main/java/org/codehaus/groovy/classgen/AsmClassGenerator.java Outdated
…d in hash order, not the order the literals were encountered
@paulk-asert paulk-asert merged commit 310527e into apache:master Jul 13, 2026
28 checks passed
@paulk-asert paulk-asert deleted the groovy12159 branch July 13, 2026 23:50
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