Why this matters
Enums provide type safety, discoverability, and avoid typos and drift.
When a value comes from a finite set, model it as an enum constant instead of string/int literals.
Enums provide type safety, discoverability, and avoid typos and drift.
Side-by-side examples engineers can pattern-match during review.
if (status.equals("APPROVED")) { /* ... */ }enum Status { PENDING, APPROVED, REJECTED }
if (status == Status.APPROVED) { /* ... */ }if (role.equals("admin")) {}if (role == Role.ADMIN) {}From the same buckets as this rule.