Fixed bug 1461442 - UseAssertSameInsteadOfAssertTrue now ignores comparisons to null; UseAssertNullInsteadOfAssertTrue will report those.

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4374 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Tom Copeland
2006-05-02 20:06:27 +00:00
parent 8f622f7334
commit 56206afacf
4 changed files with 15 additions and 3 deletions

View File

@ -8,6 +8,7 @@ Fixed bug 1462184 False +: InsufficientStringBufferDeclaration - wrong size
Fixed bug 1465574 - UnusedPrivateMethod no longer reports false positives when a private method is called from a method with a parameter of the same name.
Fixed bug 1114003 - UnusedPrivateMethod no longer reports false positives when two methods have the same name and number of arguments but different types. The fix causes PMD to miss a few valid cases, but, c'est la vie.
Fixed bug 1472843 - UnusedPrivateMethod no longer reports false positives when a private method is only called from a method that contains a variable with the same name as that method.
Fixed bug 1461442 - UseAssertSameInsteadOfAssertTrue now ignores comparisons to null; UseAssertNullInsteadOfAssertTrue will report those.
Fixed major bug in CPD; it was not picking up files other than .java or .jsp.
Fixed bug in C/C++ parser; a '$' is now allowed in an identifier. This is useful in VMS.
Fixed a symbol table bug; PMD no longer crashes on enumeration declarations in the same scope containing the same field name

View File

@ -23,6 +23,7 @@ public class UseAssertSameInsteadOfAssertTrueTest extends SimpleAggregatorTst {
new TestDescriptor(TEST2, "assert true a != b", 1, rule),
new TestDescriptor(TEST3, "assert false a == b", 1, rule),
new TestDescriptor(TEST4, "assert false a != b", 1, rule),
new TestDescriptor(TEST5, "skip assertTrue(x == null), UseAssertNullInsteadOfAssertTrue will pick those up", 0, rule),
});
}
@ -54,4 +55,11 @@ public class UseAssertSameInsteadOfAssertTrueTest extends SimpleAggregatorTst {
" }" + PMD.EOL +
"}";
private static final String TEST5 =
"public class Foo {" + PMD.EOL +
" public void test1() {" + PMD.EOL +
" assertFalse(a == null);" + PMD.EOL +
" }" + PMD.EOL +
"}";
}

View File

@ -237,9 +237,12 @@ should be made by more specific methods, like assertSame, assertNotSame.
<value>
<![CDATA[
//PrimaryExpression [
PrimaryPrefix/Name[@Image = 'assertTrue' or @Image = 'assertFalse']
PrimaryPrefix/Name
[@Image = 'assertTrue' or @Image = 'assertFalse']
]
[PrimarySuffix/Arguments/ArgumentList/Expression/EqualityExpression]
[PrimarySuffix/Arguments
/ArgumentList/Expression
/EqualityExpression[count(//NullLiteral) = 0]]
]]>
</value>
</property>

View File

@ -48,6 +48,7 @@
</subsection>
<subsection name="Contributors">
<ul>
<li><a href="http://www.cafeaulait.org/">Elliotte Rusty Harold</a> - reported bug in UseAssertSameInsteadOfAssertTrue, suggested creating a new ruleset containing rules in each release, UncommentedEmptyConstructor suggestions, noted missed case for UnusedFormalParameter, documentation suggestions, reported mistake in UnnecessaryLocalBeforeReturn message, bug report 1371757 for misleading AvoidSynchronizedAtMethodLevel example, bug report 1293277 for duplicated rule messages, bug report for ConstructorCallsOverridableMethod, suggestion for improving command line interface, mispeling report, suggestion for improving Designer startup script, "how to make a ruleset" documentation suggestions, noticed outdated Xerces jars, script renaming suggestions, UseLocaleWithCaseConversions rule suggestion</li>
<li>Jeff Jensen - Wrote new XML schema, reported missing schema refs in example rulesets, suggested posting XML schema on PMD site, discussion of 'comments in catch block' feature, suggested description attribute in property element</li>
<li>David Karr - reported stale XPath documentation</li>
<li>Christopher Stach - several bug reports for rules that didn't handle JDK 1.5 enums</li>
@ -72,7 +73,6 @@
<li>Brian R - suggestions for improving UseIndexOfChar, documentation suggestion</li>
<li>Didier Duquennoy - bug reports for InefficientStringBuffering/ConsecutiveLiteralAppends/AppendCharacterWithChar, several bug reports for InefficientStringBuffering, bug report for ImmutableField, suggestions for improving Benchmark utility, bug report for InefficientStringBuffering, bug report for AvoidConcateningNonLiteralsInStringBuffer, reported a missed hit for EqualsNull, bug report for MissingStaticMethodInNonInstantiatableClass, pmd-netbeans feedback</li>
<li>Paul Smith - patch to fix Ant task 'minimum priority' attribute</li>
<li><a href="http://www.cafeaulait.org/">Elliotte Rusty Harold</a> - suggested creating a new ruleset containing rules in each release, UncommentedEmptyConstructor suggestions, noted missed case for UnusedFormalParameter, documentation suggestions, reported mistake in UnnecessaryLocalBeforeReturn message, bug report 1371757 for misleading AvoidSynchronizedAtMethodLevel example, bug report 1293277 for duplicated rule messages, bug report for ConstructorCallsOverridableMethod, suggestion for improving command line interface, mispeling report, suggestion for improving Designer startup script, "how to make a ruleset" documentation suggestions, noticed outdated Xerces jars, script renaming suggestions, UseLocaleWithCaseConversions rule suggestion</li>
<li>Erik Thauvin - reported IDEA integration problem</li>
<li>John Kenny - reported bug in ConsecutiveLiteralAppends</li>
<li>Tom Judge - patch for fix to C/C++ multiline literal support for CPD, patch for including .cc files in C++ CPD checks, patch for JDK compatibility problems</li>