diff --git a/src/main/java/org/openrewrite/java/migrate/lang/MigrateSecurityManagerMulticast.java b/src/main/java/org/openrewrite/java/migrate/lang/MigrateSecurityManagerMulticast.java index 2caea0a49..9ed862839 100644 --- a/src/main/java/org/openrewrite/java/migrate/lang/MigrateSecurityManagerMulticast.java +++ b/src/main/java/org/openrewrite/java/migrate/lang/MigrateSecurityManagerMulticast.java @@ -53,7 +53,11 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu J.MethodInvocation m = super.visitMethodInvocation(method, ctx); if (MULTICAST_METHOD.matches(m) && m.getArguments().size() == 2) { - return m.withArguments(Collections.singletonList(m.getArguments().get(0))); + return m.withArguments(Collections.singletonList(m.getArguments().get(0))) + .withMethodType(m.getMethodType() + .withParameterNames(m.getMethodType().getParameterNames().subList(0, 1)) + .withParameterTypes(m.getMethodType().getParameterTypes().subList(0, 1)) + ); } return m; } diff --git a/src/main/resources/META-INF/rewrite/java-version-17.yml b/src/main/resources/META-INF/rewrite/java-version-17.yml index e16fded78..0aa6afffd 100644 --- a/src/main/resources/META-INF/rewrite/java-version-17.yml +++ b/src/main/resources/META-INF/rewrite/java-version-17.yml @@ -51,6 +51,7 @@ recipeList: groupId: com.google.inject artifactId: guice newVersion: 5.x + - org.openrewrite.java.migrate.AddLombokMapstructBinding --- type: specs.openrewrite.org/v1beta/recipe @@ -285,3 +286,24 @@ recipeList: methodPattern: 'java.lang.Runtime traceInstructions(boolean)' - org.openrewrite.java.RemoveMethodInvocations: methodPattern: 'java.lang.Runtime traceMethodCalls(boolean)' +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.java.migrate.AddLombokMapstructBinding +displayName: Add `lombok-mapstruct-binding` when both MapStruct and Lombok are used +description: Add the `lombok-mapstruct-binding` annotation processor as needed when both MapStruct and Lombok are used. +tags: + - java17 +preconditions: + - org.openrewrite.java.dependencies.DependencyInsight: + groupIdPattern: org.projectlombok + artifactIdPattern: lombok + - org.openrewrite.java.dependencies.DependencyInsight: + groupIdPattern: org.mapstruct + artifactIdPattern: mapstruct +recipeList: + - org.openrewrite.gradle.AddDependency: + groupId: org.projectlombok + artifactId: lombok-mapstruct-binding + version: 0.2.0 + configuration: annotationProcessor + acceptTransitive: false