Java 5 annotations
Java 5 annotations are standardized through the
javaccompiler will embed the annotations in the compiled class, and this information can then be read back using the reflection API.
Annotations in Java 5 are first class citizen through the
backport175 annotations for Java 1.3/1.4
backport175 is an implementation of the
Annotations are defined using a regular Java interface (hence providing strongly typed access to annotation values), and annotated source code appears in the form of doclet in the JavaDoc part.
The backport175 compiler (available through command line or as an Ant task) allows you to post-compile your classes to embed the annotation information inside the class' bytecode. The annotations are bytecode compatible with regular Java 5 annotations and therefore can be treated the same by tools, regular Java reflection (on Java 5) etc.
The annotations can then be accessed using the API in the
org.codehaus.backport175.reader.Annotations class which allows to retrieve reflectively both regular Java 5 annotations and Java 1.3/1.4 annotations in a consistent way, allowing you to adopt annotation driven development even without Java 5, while having a simple migration path. For more information on how to access annotations, read this section.