[quote Jose Gonzalez Gomez::on 12/15/2004 4:40 PM]
I've been taking a look at the RetentionPolicy stuff... you are right,
there are three scenarios:

1. You may use RetentionPolicy.SOURCE. This is similar to using a
javadoc tag, and it seems Sun itself provides some API methods to
access this information the same way you access javadoc tags
2. If you use RetentionPolicy.RUNTIME you are able to access the
annotation data with the reflection API (again, new methods, classes
and interfaces added to handle them)
3. RetentionPolicy.CLASS stores the annotation data in the bytecode
but doesn't make it available in runtime using reflection. In this
case you still can access the data accesing the bytecode of the class,
and I think there are some open source bytecode manipulation projects
that already support this. This is the default RetentionPolicy if none
specified.

So if you want to use annotation data as a source to XDoclet, I think
you could use either the second or third way. You could even support
the three ways, based on the availability of source code of libraries
you may be working with.

Best regards
Jose


Thanks for confirming. Indeed a solution could finally take advantage of all of them. But I am not sure if the effort is worth it. Moreover for the SOURCE retention, even if JDK offers support for retrieving that info it would mean that you should have access at runtime to your sources (exactly the way QDox is working).

Most probably the best solution would be to define and use only annotations with RUNTIME retention policy.

:the_mindstorm

On Wed, 15 Dec 2004 01:14:26 +0200, pope <[EMAIL PROTECTED]> wrote:
The things here are not so easy. Actually the annotation retention policy (the 
way the compiler
discards/preserves) annotation info is an enum with SOURCE, CLASS and RUNTIME. 
For the 1st case the
annotation info is lost after a compilation. I know that for the RUNTIME this 
info can be retrieved
at runtime using reflection, and unfortunately I am not sure what is happening 
with the 2nd type (it
exists in the bytecode, but I think that reflection is not able to access it).

:the_mindstorm


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user






-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to