forked from phoedos/pmd
Fixed bug 1580859 - AvoidDecimalLiteralsInBigDecimalConstructor now catches more cases, thanks to Ryan Gustafson for the fix!
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4709 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -11,6 +11,7 @@ Fixed bug 1371753 - UnnecessaryLocalBeforeReturn is now less aggressive in its r
|
||||
Fixed bug 1566547 - Annotations with an empty MemberValueArrayInitializer are now parsed properly.
|
||||
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.
|
||||
Applied patch 1551189 - SingularField false + for initialization blocks
|
||||
Applied patch 1573981 - false + in CloneMethodMustImplementCloneable
|
||||
Applied patch 1574988 - false + in OverrideBothEqualsAndHashcode
|
||||
|
@ -18,6 +18,7 @@ public class AvoidDecimalLiteralsInBigDecimalConstructorTest extends SimpleAggre
|
||||
runTests(new TestDescriptor[]{
|
||||
new TestDescriptor(TEST1, "bad, new BigDecimal(.1)", 1, rule),
|
||||
new TestDescriptor(TEST2, "ok, new BigDecimal(\".1\")", 0, rule),
|
||||
new TestDescriptor(TEST3, "bad, same as #1 but outside an initializer context", 1, rule),
|
||||
});
|
||||
}
|
||||
|
||||
@ -35,5 +36,12 @@ public class AvoidDecimalLiteralsInBigDecimalConstructorTest extends SimpleAggre
|
||||
" }" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST3 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" BigDecimal bar() {" + PMD.EOL +
|
||||
" return new BigDecimal(1.0);" + PMD.EOL +
|
||||
" }" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
|
||||
}
|
@ -759,14 +759,13 @@ if executed)
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//VariableInitializer/Expression
|
||||
/PrimaryExpression/PrimaryPrefix
|
||||
/AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
|
||||
//AllocationExpression[ClassOrInterfaceType[@Image="BigDecimal"]
|
||||
and
|
||||
./Arguments/ArgumentList
|
||||
/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not (ends-with
|
||||
/Expression/PrimaryExpression/PrimaryPrefix/Literal[(not
|
||||
(ends-with
|
||||
(@Image,'"'))) and contains(@Image,".")]]
|
||||
]]>
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
</properties>
|
||||
|
@ -52,6 +52,7 @@
|
||||
</subsection>
|
||||
<subsection name="Contributors">
|
||||
<ul>
|
||||
<li>Ryan Gustafson - Patch to fix bug in AvoidDecimalLiteralsInBigDecimalConstructor, patch to add "ref" overrides to RuleSetFactory, patch to fix JDK 1.3 incompatibilities in PMD 2.0</li>
|
||||
<li>Stefan Seidel - Reported JDK 1.5 parsing bug</li>
|
||||
<li>Wouter Zelle - Fixed bug in OverrideBothEqualsAndHashcode, wrote BrokenNullCheck rule, fixed a false positive in InefficientStringBuffering, fixed a false positive in NonThreadSafeSingleton, a nice patch to clean up some of the Ant task properties and fix a TextRenderer bug, rewrote PositionLiteralsFirstInComparisons in XPath, Renderer improvement suggestions, wrote NonThreadSafeSingleton rule, wrote DefaultPackage rule, worked thru ASTMethodDeclaration.isSyntacticallyX design, reported docs bug 1292689 for UnnecessaryLocalBeforeReturn, reported leftover ExceptionTypeChecking source file, rewrote UselessOverridingMethod in Java, UselessOverridingMethod rule, ProperLogger rule, nifty code to allow variables in XPath rules, externalInfoUrl data for all rules in basic and unusedcode rulesets, some very nifty XSLT, improvements to UseCorrectExceptionLogging, designed and implemented the "externalInfoUrl" feature in the rule definitions, fixed a devious bug in RuleSetFactory, AvoidPrintStackTrace, initial implementation of SimplifyConditional</li>
|
||||
<li>Aaron Optimizer Digulla - Tweaks to pmd.bat</li>
|
||||
@ -178,7 +179,6 @@
|
||||
<li>Matthias Kerkhoff - CPD suggestions, several bug reports</li>
|
||||
<li>Chris Riesbeck - identified some dead code in RuleSet</li>
|
||||
<li>Lars Gregori - reported a bug in the Ant task docs</li>
|
||||
<li>Ryan Gustafson - patch to add "ref" overrides to RuleSetFactory, patch to fix JDK 1.3 incompatibilities in PMD 2.0</li>
|
||||
<li><a href="http://freshmeat.net/~toddwright/">Todd Wright</a> - reported bug in EmptyStatementNotInLoop, XPath port of AtLeastOneConstructorRule, ConfusingTernaryExpression rule, reported missing ASTUnaryExpressionNotPlusMinus nodes</li>
|
||||
<li><a href="http://derupe.blogspot.com/">Conrad Roche</a> - UnusedModifier bug report, other bug reports</li>
|
||||
<li>Mike Thome - NOPMD implementation concept, BadComparisonRule suggestion</li>
|
||||
|
Reference in New Issue
Block a user