Java 9 Improved @Deprecated Annotation
The @Deprecated annotation can mark the status of a Java API, which can be one of the following:
- Using it is risky and may lead to errors
- May be incompatible in future versions
- May be removed in future versions
- A better and more efficient alternative has replaced it.
In Java 9, two new elements were added to the annotation:since and forRemoval.
- since: the element specifies the version in which the annotated API element was deprecated.
- forRemoval: the element indicates that the annotated API element will be removed in a future version, and the API should be migrated.
The following example is the documentation for the Boolean class in Java 9, where the @Deprecated annotation uses the since attribute:Boolean Class.

The following example is the documentation for a system class in Java 9, where the @Deprecated annotation uses the forRemoval attribute:System Class.

Java 9 New Features