-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
PARAMETER_DEF in FinalLocalVariable doesn't seem to work in interfaces #16081
Labels
Comments
Machine-Maker
changed the title
PARAMETER_DEF in FinalLocalVariables doesn't seem to work
PARAMETER_DEF in FinalLocalVariable doesn't seem to work
Dec 29, 2024
Machine-Maker
changed the title
PARAMETER_DEF in FinalLocalVariable doesn't seem to work
PARAMETER_DEF in FinalLocalVariable doesn't seem to work in interfaces
Dec 29, 2024
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
}
} |
Machine-Maker
added a commit
to Machine-Maker/checkstyle
that referenced
this issue
Jan 8, 2025
Machine-Maker
added a commit
to Machine-Maker/checkstyle
that referenced
this issue
Jan 12, 2025
Machine-Maker
added a commit
to Machine-Maker/checkstyle
that referenced
this issue
Jan 12, 2025
Machine-Maker
added a commit
to Machine-Maker/checkstyle
that referenced
this issue
Jan 14, 2025
Machine-Maker
added a commit
to Machine-Maker/checkstyle
that referenced
this issue
Jan 18, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: