From ed6312e3baa48e783cd8e0891b0243af13dc1fd4 Mon Sep 17 00:00:00 2001 From: Aryant Tripathi Date: Fri, 11 Oct 2024 22:29:42 +0530 Subject: [PATCH] Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. --- .../codestyle/xml/BooleanGetMethodName.xml | 59 ++++++++++++++++--- 1 file changed, 50 insertions(+), 9 deletions(-) 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 648afbf32b..09e067a271 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 @@ -35,11 +35,13 @@ public class Foo { - Should not match on multiple parameters by default + Should not match for boxed Boolean on multiple parameters by default (#5253) 0 @@ -72,11 +74,13 @@ public class Foo { - Bad name + Bad name with boxed Boolean (#5253) 1 @@ -86,13 +90,15 @@ public class Foo { 0 - Should not match on methods annotated with @Override + Should not match for boxed Boolean on methods annotated with @Override (#5253) 0 - - - Should match on multiple parameters when checkParameterizedMethods = true + Should match for boxed Boolean on multiple parameters when checkParameterizedMethods = true (#5253) true 1 + + Should match for boxed Boolean on multiple parameters when checkParameterizedMethods = true (#5253) + true + 1 + + + + + Custom Boolean type (#5253) + 0 + + + + + Custom Boolean type with returning value (#5253) + 0 + + +