#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>