With the introduction of Java 9, the standard annotation class java.lang.Deprecated
has been updated with new parameters. Notably, a
boolean parameter forRemoval
has been added to clearly signify whether the deprecated code is intended to be removed in the future. This
is indicated with forRemoval=true
. The javadoc of the annotation explicitly mentions the following:
This annotation type has a boolean-valued element forRemoval
. A value of true
indicates intent to remove the annotated
program element in a future version. A value of false
indicates that use of the annotated program element is discouraged, but at the
time the program element was annotated, there was no specific intent to remove it.
While it is generally recommended for developers to steer clear of using deprecated classes, interfaces, and their deprecated members, those
already marked for removal will surely block you from upgrading your dependency. Usage of deprecated code should be avoided or eliminated as soon as
possible to prevent accumulation and allow a smooth upgrade of dependencies.
The deprecated code is usually no longer maintained, can contain some bugs or vulnerabilities, and usually indicates that there is a better way to
do the same thing. Removing it can even lead to significant improvement of your software.