I am building a dependency search tool using ASM 4.0 and I have found a corner case which I have been unable to solve. The problem I'm having has to do with identifing usages of MyClass in the code below.
public void aMethod() {
new ArrayList<? extends MyClass>();
}
The usage of ArrayList can be identified using MethodVisitor.visitTypeInst(), but no signature method is available in that scope to identify the usage in the generic type parameter. MethodVisitor.visitLocalVariable() is not the solution either, since no local var is created. If a local var is explicitly declared as such:
public void aMethod() {
ArrayList<? extends MyClass> list = new ArrayList<? extends MyClass>();
}
The MethodVistor.visitLocalVariable() works fine, as it provides access to the generic type information via the signature param. It is only in the implicit case, where no local var is declared, that I cannot find a way to access the generic type parameters.
I'm assuming there is some way to access the class attribute with the generic information for this code, but I'm am unsure how to do this.
Thanks for any help!!