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 cause errors
- May be incompatible in future versions
- May be removed in future versions
- A better and more efficient solution has replaced it.
Java 9 adds two new elements to the annotation:sinceandforRemoval。
- since: The element specifies the version in which the annotated API element has been 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, in which the @Deprecated annotation uses the since attribute:Boolean Class。

The following example is the documentation for the System class in Java 9, in which the @Deprecated annotation uses the forRemoval attribute:System Class。

Java 9 New Features