
- Java 9 Tutorial
- Java 9 - Home
- Java 9 - Overview
- Java 9 - Environment Setup
- Java 9 - Module System
- Java 9 - REPL (JShell)
- Java 9 - Improved JavaDocs
- Java 9 - Multirelease JAR
- Java 9 - Collection Factory Methods
- Java 9 - Private Interface Methods
- Java 9 - Process API Improvements
- Java 9 - Stream API Improvements
- Try With Resources improvement
- Enhanced @Deprecated Annotation
- Inner Class Diamond Operator
- Optional Class Improvements
- Java 9 - Multiresolution Image API
- CompletableFuture API Improvements
- Java 9 - Miscellaneous Features
- java9 Useful Resources
- Java 9 - Questions and Answers
- Java 9 - Quick Guide
- Java 9 - Useful Resources
- Java 9 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java 9 - Enhanced @Deprecated Annotation
@Deprecated annotation was introduced in java 5 version. A program element annotated with @Deprecated means it should not be used for any of the following reasons −
- Its usage may leads to errors.
- It may be incompatible in future version.
- It may be removed in future version.
- A better and efficient alternative has superseeded it.
Compiler generates warnings whenever a deprecated element is used. With Java 9, two new enhancements are made to @Deprecated annotation.
forRemoval − Indicates whether the annotated element is subject to removal in a future version. The default value is false.
since − Returns the version in which the annotated element became deprecated. The default value is the empty string.
Deprecated with since
Following example of Boolean class javadoc on Java 9 illustrate the use of since attribute on @Deprecated annotation.

Deprecated with forRemoval
Following example of System class javadoc on Java 9 illustrate the use of forRemoval attribute on @Deprecated annotation.
