diff --git a/pmd/etc/changelog.txt b/pmd/etc/changelog.txt index 4f885e9f47..a21588e3d9 100644 --- a/pmd/etc/changelog.txt +++ b/pmd/etc/changelog.txt @@ -12,6 +12,7 @@ Fixed bug 1566547 - Annotations with an empty MemberValueArrayInitializer are no Fixed bugs 1060761 / 1433119 & RFE 1196954 - CloseResource now takes an optional parameter to identify closure methods Fixed bug 1579615 - OverrideBothEqualsAndHashcode no longer throws an Exception on equals methods that don't have Object as a parameter type. Fixed bug 1580859 - AvoidDecimalLiteralsInBigDecimalConstructor now catches more cases. +Fixed bug 1581123 - False +: UnnecessaryWrapperObjectCreation. Applied patch 1551189 - SingularField false + for initialization blocks Applied patch 1573981 - false + in CloneMethodMustImplementCloneable Applied patch 1574988 - false + in OverrideBothEqualsAndHashcode diff --git a/pmd/rulesets/optimizations.xml b/pmd/rulesets/optimizations.xml index 7d536bcbb8..8ce78d2dc1 100644 --- a/pmd/rulesets/optimizations.xml +++ b/pmd/rulesets/optimizations.xml @@ -283,41 +283,11 @@ public class Test { Parsing method should be called directy instead. - - - - - - - 3 = 0; + + if (prefixSet.contains(image)||(checkBoolean && "Boolean.valueOf".equals(image))) { + ASTPrimaryExpression parent = (ASTPrimaryExpression) node.jjtGetParent(); + if (parent.jjtGetNumChildren() >= 3) { + Node n = parent.jjtGetChild(2); + if (n instanceof ASTPrimarySuffix) { + ASTPrimarySuffix suffix = (ASTPrimarySuffix) n; + image = suffix.getImage(); + + if (suffixSet.contains(image)||(checkBoolean && "booleanValue".equals(image))) { + super.addViolation(data, node); + return data; + } + } + } + } + return super.visit(node, data); + } + +}