Bug 881 - Skipping the setter check for final fields for the BeanMembersShouldSerialize rule.
This commit is contained in:
1 parent
e0f664e9f4
commit
16bf1c5c99
1 file changed
+2
-1
+2
-1
@@ -80,7 +80,8 @@ public class BeanMembersShouldSerializeRule extends AbstractJavaRule {
|
||||
boolean hasGetMethod = Arrays.binarySearch(methNameArray, "get" + varName) >= 0
|
||||
|| Arrays.binarySearch(methNameArray, "is" + varName) >= 0;
|
||||
boolean hasSetMethod = Arrays.binarySearch(methNameArray, "set" + varName) >= 0;
|
||||
if (!hasGetMethod || !hasSetMethod) {
|
||||
// Note that a Setter method is not applicable to a final variable...
|
||||
if (!hasGetMethod || (!decl.getAccessNodeParent().isFinal() && !hasSetMethod)) {
|
||||
addViolation(data, decl.getNode(), decl.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user