#1392 SimplifyStartsWith false-negative

This commit is contained in:
Andreas Dangel
2015-09-11 12:22:49 +02:00
parent 93b4ce9bb4
commit ac9fd51f84
3 changed files with 18 additions and 1 deletions

View File

@@ -123,7 +123,7 @@ at the expense of some readability.
<![CDATA[
//PrimaryExpression
[PrimaryPrefix/Name
[ends-with(@Image, '.startsWith')]]
[ends-with(@Image, '.startsWith')] or PrimarySuffix[@Image='startsWith']]
[PrimarySuffix/Arguments/ArgumentList
/Expression/PrimaryExpression/PrimaryPrefix
/Literal

View File

@@ -54,4 +54,20 @@ public class Foo {
]]></code>
</test-code>
-->
<test-code>
<description>#1392 SimplifyStartsWith false-negative</description>
<expected-problems>1</expected-problems>
<expected-linenumbers>6</expected-linenumbers>
<code><![CDATA[
public class SimplifyStartsWith {
private static boolean isImmediatelyFollowedByText(DetailNode tag) {
final DetailNode nextSibling = JavadocUtils.getNextSibling(tag);
return nextSibling.getType() == JavadocTokenTypes.NEWLINE
|| nextSibling.getType() == JavadocTokenTypes.EOF
|| nextSibling.getText().startsWith(" ");
}
}
]]></code>
</test-code>
</test-data>

View File

@@ -15,6 +15,7 @@
* [#1370](https://sourceforge.net/p/pmd/bugs/1370/): ConsecutiveAppendsShouldReuse not detected properly on StringBuffer
* [#1371](https://sourceforge.net/p/pmd/bugs/1371/): InsufficientStringBufferDeclaration not detected properly on StringBuffer
* [#1384](https://sourceforge.net/p/pmd/bugs/1384/): NullPointerException in ConsecutiveLiteralAppendsRule
* [#1392](https://sourceforge.net/p/pmd/bugs/1392/): SimplifyStartsWith false-negative
* [#1394](https://sourceforge.net/p/pmd/bugs/1394/): dogfood.xml - Unable to exclude rules [UncommentedEmptyMethod]
* [#1395](https://sourceforge.net/p/pmd/bugs/1395/): UnusedPrivateMethod false positive for array element method call
* [#1396](https://sourceforge.net/p/pmd/bugs/1396/): PrematureDeclaration lambda false positive