2023-05-03 11:06:20 +02:00
|
|
|
== Why is this an issue?
|
|
|
|
|
2021-08-31 09:59:49 +00:00
|
|
|
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.
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Noncompliant code example
|
2021-08-31 09:59:49 +00:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,java]
|
2021-08-31 09:59:49 +00:00
|
|
|
----
|
|
|
|
@Deprecated
|
|
|
|
----
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Compliant solution
|
2021-08-31 09:59:49 +00:00
|
|
|
|
2022-02-04 17:28:24 +01:00
|
|
|
[source,java]
|
2021-08-31 09:59:49 +00:00
|
|
|
----
|
|
|
|
@Deprecated(since="4.2", forRemoval=true)
|
|
|
|
----
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
=== Exceptions
|
2021-08-31 09:59:49 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2023-05-03 11:06:20 +02:00
|
|
|
== Resources
|
|
|
|
|
|
|
|
=== Related rules
|
2021-08-31 09:59:49 +00:00
|
|
|
|
|
|
|
* S1123
|