fix: terminate wildcard erasure lookup#6803
Open
martinfrancois wants to merge 2 commits into
Open
Conversation
martinfrancois
force-pushed
the
agent/issue-6802-type-parameter-erasure
branch
from
July 17, 2026 17:17
1ad9e58 to
1191cca
Compare
martinfrancois
marked this pull request as ready for review
July 17, 2026 19:17
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.
Summary
Prevent recursive type erasure when Spoon resolves a bounded wildcard in no-classpath mode.
Fixes #6802.
Problem
Type erasure is the simpler type Spoon uses when it compares generic method or constructor signatures. For a parameter such as
? extends E, Spoon tried to compute that type by finding a declaration named?. Resolving the boundEthen requested the containing method declaration. Matching that method erased the same wildcard parameter again, so the cycle repeated until aStackOverflowErroroccurred.Change
Object.Validation
StackOverflowErrorbefore the fix and terminates after the fix.mvn -q -Dtest=spoon.test.reference.TypeParameterErasureRecursionTest testpasses all 24 focused tests, including positionless overloads, renamed parsed methods and types, direct-bound reparenting, cloning, serialization, and unnamed in-memory sources.mvn -q -Dtest=spoon.test.generics.GenericsTest,spoon.test.reference.TypeReferenceTest testpasses all 96 tests.mvn -q verifypasses with 16 skipped and no failures or errors.AttributeMap.java: AST 1/1, CFG 5/5, dominators 5/5, paths 5/5, and no reported errors. That full file also passes on the audited upstream base, so the reduced regression above is the discriminating evidence.