We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<ERROR TYPE>
For example:
// MyClass.java class MyClass { static <T1, T2 extends T1> T2 method(T1 input) { return null; } }
Now, say we try to inspect the bounds of the method return type, T2:
T2
val t2: KSType = method.returnType.resolve() val t2Declaration: KSTypeParameter = t2.declaration as KSTypeParameter val t2Bounds: List<KSType> = t2Declaration.bounds.map { it.resolve() }.toList() println("{DECLARATION: $t2Declaration, BOUNDS: $t2Bounds}")
This results in {DECLARATION: T2, BOUNDS: [<ERROR TYPE>]}
{DECLARATION: T2, BOUNDS: [<ERROR TYPE>]}
Interestingly, if we get the matching KSTypeParameter from the parent declaration's type parameters it contains the correct bounds, e.g.
KSTypeParameter
val t2: KSType = method.returnType.resolve() val t2Declaration: KSTypeParameter = t2.declaration.parentDeclaration.typeParameters .filter { it.name =(t2.declaration as KSTypeParameter).name } .single() val t2Bounds: List<KSType> = t2Declaration.bounds.map { it.resolve() }.toList() println("{DECLARATION: $t2Declaration, BOUNDS: $t2Bounds}")
This results in {DECLARATION: T2, BOUNDS: [(T1..T1?)]}
{DECLARATION: T2, BOUNDS: [(T1..T1?)]}
The text was updated successfully, but these errors were encountered:
fix psi look up for java type parameter decriptors.
8e81ad6
fix type resolution for java type parameters. fixes google#1250
fix psi look up for java type parameter descriptors.
782a157
402a62b
fix type resolution for java type parameters. fixes #1250
66f46fd
fix type resolution for java type parameters. fixes #1250 (cherry picked from commit 402a62b)
neetopia
Successfully merging a pull request may close this issue.
For example:
Now, say we try to inspect the bounds of the method return type,
T2
:This results in
{DECLARATION: T2, BOUNDS: [<ERROR TYPE>]}
Interestingly, if we get the matching
KSTypeParameter
from the parent declaration's type parameters it contains the correct bounds, e.g.This results in
{DECLARATION: T2, BOUNDS: [(T1..T1?)]}
The text was updated successfully, but these errors were encountered: