wood burning stoves 2.0*
The moose likes Java in General and the fly likes Doubt in annotations. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Doubt in annotations." Watch "Doubt in annotations." New topic

Doubt in annotations.

N.Senthil Kumar
Ranch Hand

Joined: Jul 07, 2009
Posts: 50

We have a annotation @Deprecated.

if i use this annotation @Deprecated before a method, the compiler will throw the following warning

Note: Dep.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

the code of Deprecated.java is

May I know, where will be the deprecation error message is configured and how it is getting display ?

N.Senthil Kumar
David Newton

Joined: Sep 29, 2008
Posts: 12617

In the compiler.
Hauke Ingmar Schmidt

Joined: Nov 18, 2008
Posts: 433
Annotations represent metadata that can be used by an annotation processor. The Java compiler has plugins to handle annotations. So a compiler plugin will output the message. I guess it can't be configured.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19655

There are three annotations in package java.lang: Override, Deprecated and SuppressWarnings. These are the only annotations with special compiler support. I believe that's the reason they are not located in package java.lang.annotation, like other "system" annotations like Documented, Inherited, Retention and Target.

How To Ask Questions How To Answer Questions
It is sorta covered in the JavaRanch Style Guide.
subject: Doubt in annotations.
Similar Threads
Tomcat 5.5 logging internal process in tomcat_out.log
Annotation Handler in Java
How to mark a method deprecated
what is the meaning of the deprecated in APIs