Fixed bug 2050064 - False + SuspiciousOctalEscape with backslash literal

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/branches/pmd/4.2.x@6415 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Xavier Le Vourch
2008-08-28 01:04:34 +00:00
parent 94cfdb93fd
commit 263b91d556
3 changed files with 29 additions and 0 deletions

View File

@ -12,6 +12,7 @@ Fixed bug 1998185 - BeanMembersShouldSerialize vs @SuppressWarnings("serial")
Fixed bug 2002722 - false + in UseStringBufferForStringAppends
Fixed bug 2056318 - False positive for AvoidInstantiatingObjectsInLoops
Fixed bug 1977438 - False positive for UselessStringValueOf
Fixed bug 2050064 - False + SuspiciousOctalEscape with backslash literal
Optimizations and false positive fixes in PreserveStackTrace
@SuppressWarnings("all") disables all warnings
All comment types are now stored in ASTCompilationUnit, not just formal ones

View File

@ -49,6 +49,32 @@ public class Foo {
void bar() {
System.out.println("foo = \4008");
}
}
]]></code>
</test-code>
<test-code>
<description><![CDATA[
[ 2050064 ] False + SuspiciousOctalEscape with backslash literal
]]></description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class Foo {
void bar() {
System.out.println("suspicious: \\128");
}
}
]]></code>
</test-code>
<test-code>
<description><![CDATA[
[ 2050064 ] False + SuspiciousOctalEscape with backslash literal, second test case
]]></description>
<expected-problems>1</expected-problems>
<code><![CDATA[
public class Foo {
void bar() {
System.out.println("suspicious: \\128 \128");
}
}
]]></code>
</test-code>

View File

@ -57,6 +57,8 @@ public class SuspiciousOctalEscape extends AbstractRule {
addViolation(data, node);
}
}
} else if (first == '\\') {
slash++;
}
offset = slash + 1;