UnusedFormalParameter should ignore public "constructor" as same as method. #4769
-
I'm having problem regarding "UnusedFormalParameter" rule. I have an code with public constructor with unused parameter (like the following code), and UnusedFormalParameter rule detects this as error. public class Test {
public Test(boolean testFlag) {
....
}
} The document mentions "checkAll" option and behaviour however it does not applied to "constructor" as I saw the latest code. There is an if statement for "method", but the if statement is not present for "constructor". @Override
public Object visit(ASTConstructorDeclaration node, Object data) {
check(node, data);
return data;
}
@Override
public Object visit(ASTMethodDeclaration node, Object data) {
if (node.getVisibility() != Visibility.V_PRIVATE && !getProperty(CHECKALL_DESCRIPTOR)) {
return data;
}
... Is this intended behaviour? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for bringing this up.
I think, that's an oversight in the rule implementation. Constructors should be considered here as well the same way, methods are handled. I'll create an issue from this discussion. --> #4770 |
Beta Was this translation helpful? Give feedback.
Thanks for bringing this up.
I think, that's an oversight in the rule implementation. Constructors should be considered here as well the same way, methods are handled.
I'll create an issue from this discussion. --> #4770