Open nazoking opened 4 days ago
I am using
I am using the Gradle plugin, and my project is a multi module project.
initscript { repositories { maven { url "https://plugins.gradle.org/m2" } } dependencies { classpath("org.openrewrite:plugin:6.16.2") } } rootProject { plugins.apply(org.openrewrite.gradle.RewritePlugin) dependencies { rewrite("org.openrewrite.recipe:rewrite-spring:latest.release") rewrite("org.openrewrite.recipe:rewrite-migrate-java:2.18.1") } afterEvaluate { if (repositories.isEmpty()) { repositories { mavenCentral() } } } }
and run
./gradlew --init-script rewrite.gradle rewriteRun -Drewrite.activeRecipe=org.openrewrite.staticanalysis.InstanceOfPatternMatch
A code snippet can be something simple like this.
if (t instanceof Exception) { throw ((Exception) t); } else {
if (t instanceof Exception exception) { throw exception; } else {
if (t instanceof Exception exception) { throwexception; } else {
Indicate if this is something you would like to work on, and how we can best support you in doing so.
Thanks for the clear example! I think this should be a relatively straightforward fix, starting with a unit test based on the above. I'd that something you'd want to contribute?
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am using the Gradle plugin, and my project is a multi module project.
and run
What is the smallest, simplest way to reproduce the problem?
A code snippet can be something simple like this.
What did you expect to see?
What did you see instead?
Are you interested in contributing a fix to OpenRewrite?
Indicate if this is something you would like to work on, and how we can best support you in doing so.