Search code examples
javajava-bytecode-asmtype-annotation

How does ASM inform me about type annotations on casts and constructor calls


I'm analyzing the following two pieces of code use ASM (Api Version 5.0)

private Object x = new @TypeAnno3 Object();

private String myString = (@TypeAnno4 String) str;

And I'm trying to find the correct Visitor/Method to overwrite, to get notified about the two type annotations.

I managed to get all kinds of type annotations, but not these two ...

How do I do this?


Solution

  • The annotation information is available in the MethodVisitor.visitInsnAnnotation callback.