Remove catch for a checked exception if the try block does not throw that exception
org.openrewrite.staticanalysis.UnnecessaryCatch
A 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.
Optional. 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
Usage
This recipe has no required configuration options. It can be activated by adding a dependency on org.openrewrite.recipe:rewrite-static-analysis:1.5.0 in your build file or by running a shell command (in which case no build changes are needed):