GROOVY-12158: @AutoImplement generates methods in hash order, not the…#2703
Merged
Conversation
… order they are found
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2703 +/- ##
==================================================
- Coverage 69.1077% 69.1054% -0.0023%
Complexity 34235 34235
==================================================
Files 1537 1537
Lines 129356 129356
Branches 23503 23503
==================================================
- Hits 89395 89392 -3
- Misses 31941 31942 +1
- Partials 8020 8022 +2
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: cd6aaa1 Learn more about TestLens at testlens.app. |
Contributor
There was a problem hiding this comment.
Pull request overview
Ensures @AutoImplement emits generated methods deterministically in the order they are discovered (rather than HashMap iteration order), improving reproducibility of generated classfiles and joint-compilation stubs.
Changes:
- Switch
getAllCorrectedMethodsMapto an insertion-orderedLinkedHashMapso downstream.values()iteration is stable. - Add a regression test that compiles a simple interface +
@AutoImplementimplementation and asserts generated method order via ASM bytecode inspection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/java/org/codehaus/groovy/transform/AutoImplementASTTransformation.java | Uses LinkedHashMap to preserve discovery order when generating methods/stubs. |
| src/test/groovy/org/codehaus/groovy/transform/AutoImplementMethodOrderTest.groovy | Adds regression coverage asserting bytecode method emission order matches declaration order. |
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.
… order they are found