File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

the code of 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: 371
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: 19543

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
I agree. Here's the link:
subject: Doubt in annotations.
Similar Threads
what is the meaning of the deprecated in APIs
Tomcat 5.5 logging internal process in tomcat_out.log
Annotation Handler in Java
How to mark a method deprecated