Skip to content

Commit

Permalink
Do not generate false positive unused parameter warning
Browse files Browse the repository at this point in the history
The following cases are fixed:
* Interface methods
* Abstract methods
* Methods marked with Override annotation
  • Loading branch information
akurtakov committed Nov 5, 2024
1 parent d8b4f12 commit 8d3654c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private boolean isPotentialUnusedDeclaration(Tree tree) {
Symbol owner = variable.sym == null ? null : variable.sym.owner;
if (owner instanceof ClassSymbol) {
return !isSerialVersionConstant(variable) && (variable.getModifiers().flags & Flags.PRIVATE) != 0;
} else if (owner instanceof MethodSymbol) {
} else if (owner instanceof MethodSymbol method && !method.enclClass().isInterface() && !method.isAbstract() && method.getAnnotation(Override.class) == null) {
return true;
}
}
Expand Down

0 comments on commit 8d3654c

Please sign in to comment.