Talk:Java annotation

Just added in a line in 'See Also' mentioning the equivelent construct from .NET, Attributes which predate this by a while. I'm sure there's languages out there that actually supply a much older example, so maybe it's worth finding a very early example of this kind of declarative/reflective reasoning and inter-referencing the articles.

Additionally, I know this sounds odd, given what I've just done, but is it really worth having a whole article on a small langauge feature like this? I know it's new, but it seems very much something that could live in another article. The .NET languages do not have an 'Attributes' page, and the feature has been around since inception and is supported in just about every language that runs in the CLR. Seems like a merge-candidate to me....

84.12.100.241 10:31, 15 April 2007 (UTC)

Alternative to XML?
The article claims that "many times" annotations are used as an alternative to XML. Apart from the weaselly "many times", what does this mean? AFAICT the two are completely orthogonal. I could say something like

or

I could use reflection to serialize annotation data as XML, I could use information that happened to be represented as XML to generate annotations, etc., etc.

Annotations are a programming construct. XML is, well, I don't want to open that can of worms too far, but let's say "a syntax and a data model" and leave it at that. This sounds like one of those "Is it farther to Chicago or by boat?" comparisons. -Dmh 12:36, 26 September 2007 (UTC)
 * You are right - I removed that meaningless comparison.--Stagalj (talk) 01:22, 9 February 2008 (UTC)


 * The point of the comparison is about how you associate metadata with a class. Many frameworks (like hibernate) required an XML file that maps data in a class to how it should be persisted. They later added annotations like @Id to indicate which field/methods represent the unique id of an object, @ManyToOne to indicate cardinality of a relationship, and so forth. Javamage (talk) 18:18, 3 August 2009 (UTC)

Impact and Perception
The content of this paragraph was really purely written: Pros Declarative programming Annotations allow the programmer to declare in their source code how the software should behave. It is an example of how declarative programming constructs can be added to an object oriented language. Cons Performance Adding metadata to a run time causes additional memory overhead. Standards lack There are few standards that dictate what metadata tags should be used. As to the Cons above - the application performance is not affected by adding metadata. The metadata are just a part of solution and their effectiveness shall be compared to some other type of solution. Also, the Standards lack does not make sense here.Standards of what?--Stagalj (talk) 15:49, 9 February 2008 (UTC)

Uncited Source and Innacuracy in "History"
Part of the "History" section, particularly the beginning, was copied from Annotations.

Also, where the same section says "version 1.5" and "version 1.6," Sun says "release 5.0" and (outside of the above article) "release 6.0." Are these in agreement or not? (I know that Sun renamed 1.5 to 5.0, but I don't know whether the old format is still accurate.) —Preceding unsigned comment added by Jesdisciple (talk • contribs) 17:56, 28 April 2008 (UTC)

What do they do?
Being a complete 0 at the subject, i read the whole article and still got absolutely no idea on how an annotation would alter an entity. An example of an annotated vs. equal unannotated code would be very helpful. 78.107.153.188 (talk) 19:34, 22 April 2010 (UTC)


 * I didn't understand the article, and that is not for lack of knowledge. I believe the link Of Java Annotations by John Hunt is the best example on how the article should be structured: that external article have the right kind of information needed to introduce the concept. Rursus dixit. ( m bork3 !) 09:43, 15 June 2010 (UTC)

setId ????
I recommend removing the 'setId' function from the 4th example as it is not needed for the illustration and is against the design, because we stated that the 'id' is a primary key which is automatically generated by the database. Changing a database-calculated primary key value has no point. Doing it from the application has even less. Notinlist (talk) 08:54, 6 June 2011 (UTC)

EJB code is far from comment in text
This page has an EJB example showing the mapping of an entity bean to a relational model, as accomplished by annotations. The code is far away from a comment about ORM, and that distance makes it confusing.

I also suggest mentioning that annotations are fully qualified with package names; e.g., you can write @java.lang.Deprecated if you want to be especially verbose. — Preceding unsigned comment added by 108.35.229.42 (talk) 15:49, 7 February 2012 (UTC)

Example much too complex
I think that the example tries to do too much. I'm using annotations very day (even coding custom ones), and even I find the example very difficult to understand. Too much code there. Hervegirod (talk) 13:19, 23 March 2014 (UTC)

External links modified
Hello fellow Wikipedians,

I have just modified one external link on Java annotation. Please take a moment to review my edit. If you have any questions, or need the bot to ignore the links, or the page altogether, please visit this simple FaQ for additional information. I made the following changes:
 * Added archive https://web.archive.org/web/20120919093308/http://25hoursaday.com/ to http://www.25hoursaday.com/

When you have finished reviewing my changes, you may follow the instructions on the template below to fix any issues with the URLs.

Cheers.— InternetArchiveBot  (Report bug) 23:33, 19 April 2017 (UTC)

Add Javadoc
It appears that annotations external to javadoc entries must follow the javadoc entries.

Adding javadoc to the example would help illustrate these relationships.

Don Brutzman (talk) 14:46, 29 January 2022 (UTC)