forked from phoedos/pmd
bug fix: octal pattern can contain optional 'L' at the end
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4821 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -21,6 +21,7 @@ public class AvoidUsingOctalValuesTest extends SimpleAggregatorTst {
|
||||
new TestDescriptor(TEST3, "OK, long value", 0, rule),
|
||||
new TestDescriptor(TEST4, "OK, double value", 0, rule),
|
||||
new TestDescriptor(TEST5, "OK, double value", 0, rule),
|
||||
new TestDescriptor(TEST6, "bad, 012L", 1, rule),
|
||||
});
|
||||
}
|
||||
|
||||
@ -49,4 +50,9 @@ public class AvoidUsingOctalValuesTest extends SimpleAggregatorTst {
|
||||
" float f = 0f;" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
private static final String TEST6 =
|
||||
"public class Foo {" + PMD.EOL +
|
||||
" long x = 012L;" + PMD.EOL +
|
||||
"}";
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import net.sourceforge.pmd.ast.ASTLiteral;
|
||||
|
||||
public class AvoidUsingOctalValues extends AbstractRule {
|
||||
|
||||
public static final Pattern OCTAL_PATTERN = Pattern.compile("0[0-7]+");
|
||||
public static final Pattern OCTAL_PATTERN = Pattern.compile("0[0-7]+[lL]?");
|
||||
|
||||
public Object visit(ASTLiteral node, Object data) {
|
||||
String img = node.getImage();
|
||||
|
Reference in New Issue
Block a user