diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index 7f16e0177d..5b382db9bc 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -187,7 +187,7 @@ public class SomeJNIClass { //MethodDeclaration [starts-with(@Name, 'get')] [@Arity = 0 or $checkParameterizedMethods = true()] - [ (PrimitiveType[@Kind = 'boolean'] or ReferenceType[@Type = 'Boolean']) and @Overridden = false() ] + [ (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')]) and @Overridden = false() ] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/BooleanGetMethodName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/BooleanGetMethodName.xml index c0eee19a2f..648afbf32b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/BooleanGetMethodName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/BooleanGetMethodName.xml @@ -34,6 +34,16 @@ public class Foo { ]]> + + Should not match on multiple parameters by default + 0 + + + Should not match on methods annotated with @Override 0 @@ -60,4 +70,54 @@ public class Foo { } ]]> + + + Bad name + 1 + + + + + Good name + 0 + + + + + Should not match on methods annotated with @Override + 0 + + + + + + + Should match on multiple parameters when checkParameterizedMethods = true + true + 1 + + +