forked from phoedos/pmd
#1392 SimplifyStartsWith false-negative
This commit is contained in:
@@ -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
|
||||
|
@@ -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>
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user