• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in annotations.

 
N.Senthil Kumar
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the compiler.
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20610
63
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic