Back to all rules
What this rule checks
Boolean returns can be simplified
Configuration
When off, this rule is excluded from pipeline runs. Changes apply immediately.
Code Examples
PASS — this code satisfies the rule
boolean isValid() {
  return x > 0;
}
FAIL — this code triggers the rule
boolean isValid() {
  if (x > 0) return true;
  else return false;
}
Overview
Category Topic Conditionals
Level Intermediate
Type Built-in PMD
Priority 3 (1 = highest, 5 = lowest)
Status Active
PMD Configuration
PMD reference category/java/design.xml/SimplifyBooleanReturns