Branch: refs/heads/main
  Home:   https://github.com/pmd/pmd
  Commit: eb9dc7dcd64bae44047de84c89381f3eb427932e
      https://github.com/pmd/pmd/commit/eb9dc7dcd64bae44047de84c89381f3eb427932e
  Author: fudian <[email protected]>
  Date:   2026-08-11 (Tue, 11 Aug 2026)

  Changed paths:
    M docs/pages/release_notes.md
    M pmd-java/src/main/resources/category/java/errorprone.xml
    M 
pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/UnconditionalIfStatement.xml

  Log Message:
  -----------
  [java] Fix #6435: UnconditionalIfStatement flags arbitrarily negated boolean 
literals (#6939)

UnconditionalIfStatement only matched direct BooleanLiteral conditions and,
in the initial fix, a single UnaryExpression wrapping one. This still missed
equivalent conditions such as !!true and longer logical-negation chains.

Match an if condition when every node in its expression subtree is either a
BooleanLiteral or a UnaryExpression with operator '!'. This handles any
number of logical negations without fixed-depth enumeration, while chains
ending in a variable or containing another expression node remain excluded.

Add regression coverage for single, repeated, deeply nested, and
parenthesized negations, plus non-literal negative cases.

Signed-off-by: 付典 <[email protected]>
Co-authored-by: Sören Glimm <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/pmd/pmd/settings/notifications


_______________________________________________
Pmd-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmd-commits

Reply via email to