Java

Java

Made by DeepSource

@Deprecated should not be applied to local variables or parameters JAVA-W1082

Anti-pattern
Major
Autofix

Avoid marking parameters or local variables as @Deprecated, as the annotation will have no effect.

Bad Practice

In the method below, the argument input is marked with @Deprecated. However, this annotation will have no semantic meaning, and javac will not generate a deprecation warning for it like it would for usage of a method annotated with @Deprecated.

public static String getSomething(@Deprecated String input) {
    // ...
}

Recommended

Avoid marking parameters and local variables as @Deprecated.

References