GROOVY-11770: StackOverflowError processing generics for kubernetes-c…#2498
Merged
paulk-asert merged 2 commits intoapache:masterfrom May 2, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2498 +/- ##
==================================================
+ Coverage 67.2264% 67.2365% +0.0101%
- Complexity 31984 31988 +4
==================================================
Files 1468 1468
Lines 123923 123946 +23
Branches 22251 22257 +6
==================================================
+ Hits 83309 83337 +28
+ Misses 33433 33428 -5
Partials 7181 7181
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Addresses GROOVY-11770 by preventing StackOverflowError during generics LUB (lowest-upper-bound) computation (notably seen with kubernetes client types) via an explicit recursion/cycle guard rather than relying on catching SOE.
Changes:
- Add a new STC regression test that exercises an F-bounded generic LUB cycle through a wrapper type.
- Introduce a
LowestUpperBoundContextto track in-flight(t1, t2)LUB computations and break recursion cycles during LUB parameterization. - Refactor
lowestUpperBound(ClassNode, ClassNode)to route through a context-aware private overload.
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 GROOVY-11770 regression test intended to ensure LUB computation does not overflow the stack. |
src/main/java/org/codehaus/groovy/ast/tools/WideningCategories.java |
Adds identity-based cycle guard context for recursive LUB parameterization; removes SOE catch. |
d50f236 to
5cd4291
Compare
…lient library (cycle guard instead of try/catch)
5cd4291 to
2588f48
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.
…lient library (cycle guard instead of try/catch)
Caveat: the cycle guard uses object identity. If the recursion ever creates fresh ClassNode instances at each level for the same logical pair, identity won't catch it and we'd be back to SOE territory, except now without the catch as a backstop.
We could consider keeping the SOE catch around the recursive call as a final safety net (with a comment like "should be unreachable; cycle guard handles known cases").