One of the important new features introduced in J2SE 5 was that of Java Annotations. With annotations, developers could now add their own attributes to Java code and provide data about data (metadata). This data in the annotations was meant to be used for code documentation, code generation, enhanced security or special business logic.
However now that annotations have been in use for some time, more views and opinions have started to come in about the utility of annotations. In a recent article Robin Sharp says “Annotations are a major kludge on the landscape. They don’t fit and we don’t need them; but you just know that they’ll be picked up by framework junkies and abused horribly.”
In his case against annotations, he says that annotations are not metaData but just decorative data. Annotations are hard coded configurations that cannot replace XML. He feels that Java annotations were just meant as a response to .NET and not something that Java developers want.
However in a recent interview with IndicThreads, Andrey Grebnev says that Java annotations is the future. Jesper Joergensen of BEA told us that “Apache Beehive stores the wiring metadata and other metadata as JDK 5 annotations in the code”
Anil Saldhana of JBoss says that “Combined with JDK 1.5 Annotations, aspects (AOP) also is a great way to expand the Java language in a clean pluggable way rather than using annotations solely for code generation. JBoss AOP is not only a framework, but also a prepackaged set of aspects that are applied via annotations, pointcut expressions, or dynamically at runtime.”
So annotations sure are being used.
What has been your experience with Java annotations? Did you find annotations useful or is it just another passing fad?
>> Annotations: Don’t Mess with Java