From 641d66e3a84a4b1e6160388d66b07b4595d237bf Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 25 Feb 2022 15:41:49 -0800 Subject: [PATCH] Updates per rewrite 7.19.0 changes. --- ...ateClassNewInstanceToGetDeclaredConstructorNewInstance.java | 2 +- .../logging/MigrateGetLoggingMXBeanToGetPlatformMXBean.java | 3 ++- .../kotlin/org/openrewrite/java/migrate/JavaxToJakartaTest.kt | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/openrewrite/java/migrate/lang/MigrateClassNewInstanceToGetDeclaredConstructorNewInstance.java b/src/main/java/org/openrewrite/java/migrate/lang/MigrateClassNewInstanceToGetDeclaredConstructorNewInstance.java index 3cb3f4769d..8ff0da58b4 100644 --- a/src/main/java/org/openrewrite/java/migrate/lang/MigrateClassNewInstanceToGetDeclaredConstructorNewInstance.java +++ b/src/main/java/org/openrewrite/java/migrate/lang/MigrateClassNewInstanceToGetDeclaredConstructorNewInstance.java @@ -52,7 +52,7 @@ protected NewInstanceToDeclaredConstructorVisitor getVisitor() { private static class NewInstanceToDeclaredConstructorVisitor extends JavaIsoVisitor { private final JavaType exType = JavaType.buildType("java.lang.Exception"); private final JavaType thType = JavaType.buildType("java.lang.Throwable"); - private static final ChangeMethodName TO_DECLARED_CONS_NEW_INSTANCE = new ChangeMethodName("java.lang.Class newInstance()", "getDeclaredConstructor().newInstance", null); + private static final ChangeMethodName TO_DECLARED_CONS_NEW_INSTANCE = new ChangeMethodName("java.lang.Class newInstance()", "getDeclaredConstructor().newInstance", null, false); @Override public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, ExecutionContext executionContext) { diff --git a/src/main/java/org/openrewrite/java/migrate/logging/MigrateGetLoggingMXBeanToGetPlatformMXBean.java b/src/main/java/org/openrewrite/java/migrate/logging/MigrateGetLoggingMXBeanToGetPlatformMXBean.java index d55c48969d..debc8ee03f 100644 --- a/src/main/java/org/openrewrite/java/migrate/logging/MigrateGetLoggingMXBeanToGetPlatformMXBean.java +++ b/src/main/java/org/openrewrite/java/migrate/logging/MigrateGetLoggingMXBeanToGetPlatformMXBean.java @@ -51,7 +51,8 @@ protected TreeVisitor getVisitor() { public J.CompilationUnit visitCompilationUnit(J.CompilationUnit cu, ExecutionContext ctx) { cu = (J.CompilationUnit) new ChangeType( "java.util.logging.LoggingMXBean", - "java.lang.management.PlatformLoggingMXBean" + "java.lang.management.PlatformLoggingMXBean", + false ).getVisitor().visitNonNull(cu, ctx); return super.visitCompilationUnit(cu, ctx); } diff --git a/src/test/kotlin/org/openrewrite/java/migrate/JavaxToJakartaTest.kt b/src/test/kotlin/org/openrewrite/java/migrate/JavaxToJakartaTest.kt index f1fc21185a..6cc8bf3f27 100644 --- a/src/test/kotlin/org/openrewrite/java/migrate/JavaxToJakartaTest.kt +++ b/src/test/kotlin/org/openrewrite/java/migrate/JavaxToJakartaTest.kt @@ -112,7 +112,7 @@ class JavaxToJakartaTest : JavaRecipeTest { "public interface I1 {}", "public interface I2 {}" ), - recipe = recipe.doNext(ChangeType("I1", "I2")), + recipe = recipe.doNext(ChangeType("I1", "I2", false)), before = """ public class B extends javax.xml.bind.annotation.A implements I1 {} """, @@ -170,6 +170,7 @@ class JavaxToJakartaTest : JavaRecipeTest { """ ) + @Suppress("EmptyTryBlock", "CatchMayIgnoreException") @Test fun multiCatch() = assertChanged( dependsOn = arrayOf(