@Deprecated public class Betamax { ... }
In the above example, what effect does the @Deprecated have? Is it purely documentation? Or does it change something about how the compiler treats this class?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The compiler enforces (as in checks and croaks on) some annotations (like
@Override).But the most useful part is that libraries can provide their own annotations (like
@Entityor@PersistenceAware), of which the Java language (JDK core) does not know anything. This is kind of like adding domain-specific syntactic sugar right into the language.@Deprecatedis for documentation. It also creates compiler warnings when you use a deprecated method (or class), just like the old JavaDoc@deprecatedtag.