Java annotation: Difference between revisions

Content deleted Content added
m Clean up HTML in accordance with {{Cleanup HTML}} template
No edit summary
Line 1:
In the [[Java (programming language)|Java computer programming language]], an '''annotation''' is a form of syntactic [[metadata]] that can be added to Java [[Javasource (programming language)|Javacode]] source code.<ref>{{cite web|url = http://download.oracle.com/javase/1,5.0/docs/guide/language/annotations.html|title = Annotations|accessdate = 2011-09-30|publisher = [[Sun Microsystems]]}}.</ref> [[Class (computer programming)|Classes]], [[Method (computer programming)|methods]], [[Variable (computer science)|variables]], [[Parameter (computer programming)|parameters]] and packages[[Java package]]s may be annotated. Like [[Javadoc]] tags, Java annotations can be read from source files. Unlike [[Javadoc]] tags, Java annotations can also be embedded in and read from [[class (file format)|class files]] generated by the [[Java compiler]]. This allows annotations to be retained by the [[Java VMvirtual machine]] at [[Run time (program lifecycle phase)|run-time]] and read via [[reflection (computer science)|reflection]].<ref>{{Cite book|title = Java(TM) Language Specification|edition = 3rd|publisher = [[Prentice Hall]]|year = 2005|isbn = 0-321-24678-0|url = http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html|author = [[Sun Microsystems]]|postscript = <!--None-->}}.</ref> It is possible to create meta-annotations out of the existing ones in Java.<ref>{{cite web
|url=http://www.25hoursaday.com/
|title=A COMPARISON OF MICROSOFT'S C# PROGRAMMING LANGUAGE TO SUN MICROSYSTEMS' JAVA PROGRAMMING LANGUAGE: Metadata Annotations
Line 15:
 
== History ==
The [[Java (software platform)|Java platform]] has various ''ad-hoc'' annotation mechanisms—for example, the ''<code>transient</code>'' modifier, or the ''<code>@deprecated</code>'' javadoc tag. The [[Java Specification Request]] JSR-175 introduced the general-purpose annotation (also known as ''metadata'') facility to the [[Java Community Process]] in 2002; it gained approval in September 2004.<ref>
{{cite web|url = http://www.jcp.org/en/jsr/detail?id=175#2
|title = JSR 175: A Metadata Facility for the JavaTM Programming Language|date = 2006-11-02
Line 21:
}}
</ref>
Annotations became available in the language itself beginning with version 1.5 of the [[Java Development Kit]] (JDK). The [[Annotation processing tool | <code>apt</code> tool]] provided a provisional interface for compile-time annotation processing in JDK version 1.5; JSR-269 formalized this, and it became integrated into the [[javac]] compiler in version 1.6.
 
== Built-in annotations ==