From 996f81ccce4645cee1086392df05d469d6fb1e2c Mon Sep 17 00:00:00 2001
From: HoshiNoMei <11910516@mail.sustech.edu.cn>
Date: Sun, 24 Apr 2022 23:36:46 +0800
Subject: [PATCH] Modify the rule to meet the missing case
---
.../src/main/resources/category/java/design.xml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml
index f071a261f9..1835882366 100644
--- a/pmd-java/src/main/resources/category/java/design.xml
+++ b/pmd-java/src/main/resources/category/java/design.xml
@@ -1289,7 +1289,8 @@ public void foo() throws Exception {
3
@@ -1308,6 +1314,8 @@ or
//ConditionalExpression[not(PrimaryExpression/*/Literal) and (Expression/PrimaryExpression/*/Literal/BooleanLiteral)]
|
//ConditionalExpression[not(Expression/PrimaryExpression/*/Literal) and (PrimaryExpression/*/Literal/BooleanLiteral)]
+|
+//ConditionalExpression[(PrimaryExpression/*/Literal/BooleanLiteral) and (Expression/PrimaryExpression/*/Literal/BooleanLiteral)]
]]>
@@ -1330,6 +1338,10 @@ public class Foo {
public void test4() {
final boolean otherValue = condition ? something() : false; // can be as simple as condition && something();
}
+
+ public boolean test5() {
+ return condition ? true : false; // can be as simple as return condition;
+ }
}
]]>