aspose file tools*
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
Author

Doubt in annotations.

N.Senthil Kumar
Ranch Hand

Joined: Jul 07, 2009
Posts: 50
Hi,

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
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

In the compiler.
Hauke Ingmar Schmidt
Rancher

Joined: Nov 18, 2008
Posts: 433
    
    2
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
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Doubt in annotations.