- Java 9 - Miscellaneous Features
- CompletableFuture API Improvements
- Java 9 - Multiresolution Image API
- Optional Class Improvements
- Inner Class Diamond Operator
- Enhanced @Deprecated Annotation
- Try With Resources improvement
- Java 9 - Stream API Improvements
- Java 9 - Process API Improvements
- Java 9 - Private Interface Methods
- Java 9 - Collection Factory Methods
- Java 9 - Multirelease JAR
- Java 9 - Improved JavaDocs
- Java 9 - REPL (JShell)
- Java 9 - Module System
- Java 9 - Environment Setup
- Java 9 - Overview
- Java 9 - Home
java9 Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
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.
Advertisements