Skip to content

fix(jdk-codemodel): capture type-level generic parameter declarations in reflection path#9

Merged
deer merged 1 commit intomainfrom
fixes_v2
Apr 8, 2026
Merged

fix(jdk-codemodel): capture type-level generic parameter declarations in reflection path#9
deer merged 1 commit intomainfrom
fixes_v2

Conversation

@deer
Copy link
Copy Markdown
Collaborator

@deer deer commented Apr 8, 2026

JDKCodeModel already resolved TypeVariable correctly when encountered in field/method type signatures, but never attached a ParameterizedTypeDescriptor to the type descriptor itself — so class Foo and class Bar loaded via reflection appeared non-generic at the type level.

The fix replaces the TODO comment at line 410 of JDKCodeModel.java with a call to classType.getTypeParameters(), mapping each TypeVariable through the existing getTypeUsage() infrastructure (which already handles bounds, self-referential guards, etc.) and adding a ParameterizedTypeDescriptor trait when type parameters are present.

Two new tests in JDKCodeModelTests cover the unbounded (Container) and bounded (BoundedContainer) cases via the reflection path

@deer deer merged commit cb93f54 into main Apr 8, 2026
1 check passed
@deer deer deleted the fixes_v2 branch April 8, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant