Branching constructs (if statements, conditional expressions) should contain difference code in the two branches. Repeating identical code in both branches is usually a bug.
For example:
condition ? same : same if (condition) { same(); } else { same(); } this usually indicates a typo where one of the branches was supposed to contain different logic:
condition ? something : somethingElse if (condition) { doSomething(); } else { doSomethingElse(); } Suppress false positives by adding the suppression annotation @SuppressWarnings("DuplicateBranches") to the enclosing element.