Re:When are enums not a code smell?
by aardvark179 on Monday November 22, 2021 @04:14PM
(#29311640)
Yes. The problem you then have is that adding additional values to the enum then either breaks compatibility or relaxes that guarantee. Since Java tries to run old code for as long as possible the only option for switch statements is to ensure there is a fallback so that you at least know there is a problem.
Of course, a catch-all would then somewhat reintroduce the problem.