You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I explore references of a CtExecutable object, I am not able to get the unresolved method signature for a method with generic parameters (i.e. I am only able to get the signature with resolved types).
Let type be a CtClass variable. I can explore the class references using:
List<CtReference> refs = Query.getReferences(type,
newAbstractReferenceFilter<CtReference>(CtReference.class){
publicbooleanmatches(CtReferencereference) {
returntrue;
}
});
for(CtReferenceaReference : refs){
if (aReference.toString().contains("aStaticMethod")) {
// Here, aReference is equivallent to if(aReference.getDeclaration() == null){
System.out.println("Bad return value !");
}
}
}
I am able to get the method signature with resolved type (here ClassWithGenericStaticMethod.aStaticMethod(java.lang.Class<java.lang.String>, java.lang.String)), but unable to get the unresolved signature, which I should obtain using aReference.getDeclaration(), but this method return null.
I created a test case on my spoon fork if needed.
The text was updated successfully, but these errors were encountered:
Hi,
When I explore references of a
CtExecutable
object, I am not able to get the unresolved method signature for a method with generic parameters (i.e. I am only able to get the signature with resolved types).To illustrate the bug, let imagine such a class:
Let
type
be aCtClass
variable. I can explore the class references using:I am able to get the method signature with resolved type (here
ClassWithGenericStaticMethod.aStaticMethod(java.lang.Class<java.lang.String>, java.lang.String)
), but unable to get the unresolved signature, which I should obtain usingaReference.getDeclaration()
, but this method return null.I created a test case on my spoon fork if needed.
The text was updated successfully, but these errors were encountered: