Condition dominance occurs when condition Y can be true only if condition X is also true. In an if–else chain, testing X first makes Y unreachable, so branch order changes the result. section 3.2
Age-range mistake
Testing age >= 6 before age >= 18 classifies every adult as CHILD; the FULL branch is never reached. Use mutually exclusive ranges or test the narrower condition first. section 3.2
Check for dominance when:
- Ordering numeric ranges, test specific or bounded ranges before broader ones. section 3.2
- Ordering instanceof checks, test subclasses such as BigInteger and BigDecimal before Number. section 3.2
- Reviewing chains, use static analysis to find conditions reported as always false, then verify whether the warning reflects intended logic. section 3.2
