GROOVY-11022: StackOverflowError when having parameterized function w…#2497
Open
paulk-asert wants to merge 1 commit intoapache:masterfrom
Open
GROOVY-11022: StackOverflowError when having parameterized function w…#2497paulk-asert wants to merge 1 commit intoapache:masterfrom
paulk-asert wants to merge 1 commit intoapache:masterfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2497 +/- ##
==================================================
+ Coverage 67.1374% 67.1396% +0.0021%
- Complexity 31622 31634 +12
==================================================
Files 1451 1451
Lines 122565 122582 +17
Branches 22007 22010 +3
==================================================
+ Hits 82287 82301 +14
- Misses 33199 33200 +1
- Partials 7079 7081 +2
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Fixes GROOVY-11022 by preventing StackOverflowError during static type checking when expanding recursive (F-bounded) generic type parameter bounds that self-reference through wildcard bounds.
Changes:
- Added regression tests covering recursive bounds involving
? superand? extendswildcards. - Introduced a bound-expansion tracking context in
StaticTypeCheckingSupport.applyGenericsContextto break cycles during placeholder bound expansion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/test/groovy/groovy/transform/stc/GenericsSTCTest.groovy |
Adds a new regression test (testNoStackOverflow3) for recursive generic bounds cases. |
src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingSupport.java |
Adds BoundExpansionContext and threads it through applyGenericsContext to avoid infinite recursion when expanding F-bounded placeholder bounds. |
…ith recursive bounds
82e029e to
2adae3b
Compare
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.
…ith recursive bounds
This is the fix recommended for master