Since Java 9, @Deprecated
has two additional arguments to the annotation:
-
since
allows you to describe when the deprecation took place
-
forRemoval
, indicates whether the deprecated element will be removed at some future date
In order to ease the maintainers work, it is recommended to always add one or both of these arguments.
This rule reports an issue when @Deprecated
is used without any argument.
Noncompliant code example
@Deprecated
Compliant solution
@Deprecated(since="4.2", forRemoval=true)
Exceptions
The members and methods of a deprecated class or interface are ignored by this rule. The classes and interfaces themselves are still subject to
it.