Remove catch for a checked exception if the try block does not throw that exception
MSALA refactoring operation may result in a checked exception that is no longer thrown from a try block. This recipe will find and remove unnecessary catch blocks.
org. openrewrite. staticanalysis. UnnecessaryCatchOptional
Whether to include java.lang.Exception in the list of checked exceptions to remove. Unlike other checked exceptions, java.lang.Exception is also the superclass of unchecked exceptions. So removing catch(Exception e) may result in changed runtime behavior in the presence of unchecked exceptions. Default false.
Whether to include java.lang.Throwable in the list of exceptions to remove. Unlike other checked exceptions, java.lang.Throwable is also the superclass of unchecked exceptions. So removing catch(Throwable e) may result in changed runtime behavior in the presence of unchecked exceptions. Default false.
mod run . --recipe= org. openrewrite. staticanalysis. UnnecessaryCatchInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.