AnnotationProcessor

From APIDesign

(Difference between revisions)
Jump to: navigation, search

Apidesign (Talk | contribs)
(New page: Since JDK 1.6, its JavaC comes with standardized API for compile time processing of Annotations. Just by writing and registering an [http://java.sun.com/javase/6/docs/api/j...)
Next diff →

Revision as of 09:02, 12 December 2008

Since JDK 1.6, its JavaC comes with standardized API for compile time processing of Annotations. Just by writing and registering an AnnotationProcessor in the JAR file containing also the Annotations, one can effectively extend the compile time semantics of the Java language. By hooking into the compilation process of everyone using the JAR library, one can analyse all the Annotations usages, process them and generate additional files that can be then consumed during runtime.

NetBeans uses this style to convert nicely looking Annotations into a bit messy, yet powerful, layer XML file systems. This feature is available since version 7.0 released in 2009.

There are very interesting aspects for BackwardCompatibility. By having own processor code running during compilation, one can keep own annotation unchanged across multiple releases, yet each of the new releases can generate something different during the compilation. As a result, one can deliver performance improvements, or even slightly shift mean of the API just by letting people compile their applications against new version of own libraries.

Personal tools
buy