Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to get Annotations from IField and IMethod?
How to get Annotations from IField and IMethod? [message #197972] Tue, 08 March 2005 10:10 Go to next message
Eclipse UserFriend
Hi,

is there a way to get Annotations from an IField or IMethod?
Something like the getAnnotations() method of java.lang.reflect.Field?

Greetings,

Jan
Re: How to get Annotations from IField and IMethod? [message #198001 is a reply to message #197972] Tue, 08 March 2005 12:12 Go to previous messageGo to next message
Eclipse UserFriend
No, you have to parse the compilation unit of the IMember and then use an
AST visitor

Cheers

Tobias

"Jan "Sch
Re: How to get Annotations from IField and IMethod? [message #198008 is a reply to message #198001] Tue, 08 March 2005 12:21 Go to previous messageGo to next message
Eclipse UserFriend
Tobias Widmer wrote:
> No, you have to parse the compilation unit of the IMember and then use an
> AST visitor
But this is incredibly slow, and I need this information all the time. I
believe the IMember interface should directly offer the annotation
information. Is there a reason why this is not provided, or is it just not
implemented yet?

Greetings,

Jan
Re: How to get Annotations from IField and IMethod? [message #198632 is a reply to message #198008] Tue, 15 March 2005 12:09 Go to previous messageGo to next message
Eclipse UserFriend
The java model only provides structural information. Annotations are
technically considered as extended modifiers.
By the way, parsing a cu without resolving bindings is amazingly fast, if
you don't need fully resolved type information.

Cheers

Tobias

"Jan "Sch
Re: How to get Annotations from IField and IMethod? [message #198764 is a reply to message #198632] Wed, 16 March 2005 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Tobias Widmer wrote:
> The java model only provides structural information. Annotations are
> technically considered as extended modifiers.
Yes. But why is it possible to optain ordinary modifiers, but not the
extended ones?

> By the way, parsing a cu without resolving bindings is amazingly fast, if
> you don't need fully resolved type information.
Nevertheless it is an O(n) operation perhaps with a disk access, where it
could be in O(1).

But thanks for the answer. I perhaps file a feature request.

Greetings,

Jan
Re: How to get Annotations from IField and IMethod? [message #198795 is a reply to message #198764] Wed, 16 March 2005 10:58 Go to previous message
Eclipse UserFriend
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=79112

Markus
Previous Topic:3.1 M5: too much Java5 ?
Next Topic:How to increase the Undo level ?
Goto Forum:
  


Current Time: Sat May 10 07:42:57 EDT 2025

Powered by FUDForum. Page generated in 0.03279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top