Re: Using ASM to read method annotations

Tronje Krop <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Organization Darmstadt University of Technology
Message-ID <[email protected]>
Hi Leo,

I cannot say why your solution is not working correctly, but here is how
to do it.

You first have to create a FieldVisitor/MethodVisitor in your custom class
visitor. If you don't do that, you will not receive any events from the
fields or methods including annotations. The FieldVisitor/MethodVisitor
must create the AnnotationVisitor on request to capture the details.

The EmptyVisitor should solve this problem by returning itself as Field-
Visitor/MethodVisitor/AnnotationVisitor as it implements all this inter-
faces. If your custom ClassVisitor overrides this mechanism you will fail
to receive the annotation details.

Best regards,

Tronje

Leo Romanoff wrote:
> Hi,
> 
> How I can use ASM to read method annotations? I'm able to read class
> annotations by implementing a visitAnnotation method in my custom
> ClassVisitor class derived from the EmptyVisitor. But this method is not
> invoked for method or field annotations.
> 
> May be I do not understand how to do a similar thing for the methods or
> fields of the class? Is there any example available?
> 
> Thanks,
>   Leo
> 

-- 
     Tronje Krop <[email protected]>

   Encrypted eMail welcome! GPG/PGP-Key: 0x9AD43A05
  68E5 A3D3 75A0 B096 AC75  62D5 8EEE 3D18 9AD4 3A05

 No responsibility is taken for the correctness of the
previous information. Please delete if you receive this
                  mail unintentional.
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.