GROOVY-12156: chooseBestMethod returns candidates in identity-hash or…#2701
Merged
Conversation
…der, making static-compilation output path-dependent
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2701 +/- ##
==================================================
- Coverage 69.1077% 69.1054% -0.0023%
- Complexity 34235 34236 +1
==================================================
Files 1537 1537
Lines 129356 129356
Branches 23503 23503
==================================================
- Hits 89395 89392 -3
+ Misses 31941 31939 -2
- Partials 8020 8025 +5
🚀 New features to boost your workflow:
|
✅ All tests passed ✅🏷️ Commit: 1dee245 Learn more about TestLens at testlens.app. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes GROOVY-12156 by making StaticTypeCheckingSupport.chooseBestMethod return deterministic candidate ordering (avoiding JVM identity-hash-dependent iteration order that can leak into static-compilation output).
Changes:
- Replace
HashSetwithLinkedHashSetinchooseBestMethodto preserve insertion order of selected candidates. - Add a regression test that exercises union-type candidate ordering across varying identity-hash allocation histories.
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/stc/StaticTypeCheckingSupport.java | Preserve method-candidate ordering deterministically by using LinkedHashSet for bestMethods. |
| src/test/groovy/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupportTest.groovy | Add regression coverage ensuring union-type candidate order remains stable and matches delegate 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.
…der, making static-compilation output path-dependent
see: https://issues.apache.org/jira/browse/GROOVY-12156