-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
PARAMETER_DEF in FinalLocalVariable doesn't seem to work in interfaces #16081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Yes, code in interface is recently new feature of java :) |
Just to make it clear abstract methods in the interface still should be ignored, and only the interface test {
void test(int a); // ok, this is an abstract method we should not violate parameter 'a'
default void test2(int b) { // violation, b should be final
// body
}
static void test3(int c) { // violation, c should be final
// body
}
} |
@Anmol202005 , please help us to investigate and fix this issue. |
Fix is merged |
https://checkstyle.org/checks/coding/finallocalvariable.html#FinalLocalVariable
The
param
local variable in the static method inside the Test interface should be reported as needing thefinal
modifier which, if I'm understanding the documentation correctly, adding thePARAMETER_DEF
token to theFinalLocalVariable
check should do.If I change
Test
to aclass
instead ofinterface
, it correctly reports both, so I'm guessing someone just forgot about methods inside of interfaces.The text was updated successfully, but these errors were encountered: