English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The @Deprecated annotation can mark the status of Java API and can be one of the following:
There is a risk in using it, which may lead to errors
May be incompatible in future versions
May be deleted in future versions
A better and more efficient solution has replaced it.
Java 9 Two new elements have been added to the annotations insince and forRemoval.
since: The element specifies the version in which the annotated API element has been deprecated.
forRemoval: The element indicates that the API element of the annotation will be deleted in future versions and should be migrated to API.
The following example is Java 9 This document describes the Java Boolean class, in which the @Deprecated annotation uses the since attribute:Boolean Class.
The following example is in Java 9 This document describes the Java system classes, in which the @Deprecated annotation uses the forRemoval attribute:System Class.