Skip to content

Commit

Permalink
Do not flag unused parameters on _abstract_ methods.
Browse files Browse the repository at this point in the history
I think this was introduced in 88a224c, where we suddenly start considering some _effectively_ private abstract methods.

PiperOrigin-RevId: 590895990
  • Loading branch information
graememorgan authored and Error Prone Team committed Dec 14, 2023
1 parent d78dd6d commit affa37a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,8 @@ private boolean isParameterSubjectToAnalysis(Symbol sym) {
checkArgument(sym.getKind() == ElementKind.PARAMETER);
Symbol enclosingMethod = sym.owner;

if (!(enclosingMethod instanceof MethodSymbol)) {
if (!(enclosingMethod instanceof MethodSymbol)
|| isAbstract((MethodSymbol) enclosingMethod)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public void unusedParamInPrivateMethod() {
" System.out.println(i);",
" }",
" }",
" private interface Foo {",
" void foo(int a);",
" }",
" public void main() {",
" test(1, 2);",
" }",
Expand Down

0 comments on commit affa37a

Please sign in to comment.