Skip to content

GROOVY-12157: Covariant bridge methods are emitted in hash order, not…#2702

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

GROOVY-12157: Covariant bridge methods are emitted in hash order, not…#2702
paulk-asert merged 1 commit into
apache:masterfrom
paulk-asert:groovy12157

Conversation

@paulk-asert

Copy link
Copy Markdown
Contributor

… the order they are found

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.1155%. Comparing base (86c6648) to head (e0fe323).

Additional details and impacted files

Impacted file tree graph

@@                Coverage Diff                 @@
##               master      #2702        +/-   ##
==================================================
+ Coverage     69.1077%   69.1155%   +0.0077%     
- Complexity      34235      34239         +4     
==================================================
  Files            1537       1537                
  Lines          129356     129356                
  Branches        23503      23503                
==================================================
+ Hits            89395      89405        +10     
+ Misses          31941      31933         -8     
+ Partials         8020       8018         -2     
Files with missing lines Coverage Δ
...in/java/org/codehaus/groovy/classgen/Verifier.java 90.0938% <100.0000%> (ø)

... and 7 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

testlens-app Bot commented Jul 13, 2026

Copy link
Copy Markdown

✅ All tests passed ✅

🏷️ Commit: e0fe323
▶️ Tests: 103674 executed
⚪️ Checks: 31/31 completed


Learn more about TestLens at testlens.app.

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

This PR fixes nondeterministic bytecode output by ensuring covariant bridge methods added by Verifier are emitted in discovery order (rather than HashMap iteration order), improving reproducibility of generated .class files for identical sources.

Changes:

  • Switches the internal bridge-method collection maps in Verifier.addCovariantMethods from HashMap to LinkedHashMap to preserve insertion order during iteration.
  • Adds a regression test that compiles a sample class with multiple covariant overrides and asserts the resulting bridge method order in the class file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/test/groovy/org/codehaus/groovy/classgen/CovariantBridgeMethodOrderTest.groovy New regression test asserting deterministic, declaration-ordered bridge method emission by inspecting class bytes via ASM.
src/main/java/org/codehaus/groovy/classgen/Verifier.java Uses insertion-ordered maps for collecting/iterating interface methods and bridge methods so emission order is stable and reproducible.

@paulk-asert paulk-asert merged commit 2ab10f9 into apache:master Jul 13, 2026
32 checks passed
@paulk-asert paulk-asert deleted the groovy12157 branch July 13, 2026 23:48
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