• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Doubt in annotations.

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?

 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the compiler.
 
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22907
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic