Bug 881 - Skipping the setter check for final fields for the BeanMembersShouldSerialize rule.

This commit is contained in:
Anthony Whitford committed 2013-09-02 11:15:26 -07:00
1 parent e0f664e9f4
commit 16bf1c5c99
1 file changed
+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());
}
}