Remove unreachable catch alternatives shadowed by earlier catch clauses
MSALWhen an earlier catch clause already covers a type, any later catch (including a multi-catch alternative) for the same type or a subtype is unreachable and is a Java compile error. This commonly appears after type-substitution migrations (for example, renaming an exception so that two catch clauses end up overlapping). This recipe drops the unreachable alternatives from later multi-catches, collapses a multi-catch to a regular catch when only one alternative remains, and removes the entire catch clause when all of its declared types are already covered. It also drops an alternative that another alternative of the same multi-catch already covers, which is a compile error too.
org. openrewrite. staticanalysis. RemoveUnreachableMultiCatchAlternativemod run . --recipe= org. openrewrite. staticanalysis. RemoveUnreachableMultiCatchAlternativeInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.