Skip to content

Commit 318b44a

Browse files
committed
Fix failing test by rewriting adjusting the MethodType
1 parent c8d2f76 commit 318b44a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/java/org/openrewrite/java/migrate/lang/MigrateSecurityManagerMulticast.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
import org.openrewrite.Recipe;
2121
import org.openrewrite.TreeVisitor;
2222
import org.openrewrite.java.JavaIsoVisitor;
23+
import org.openrewrite.java.JavaTemplate;
2324
import org.openrewrite.java.MethodMatcher;
2425
import org.openrewrite.java.search.UsesMethod;
26+
import org.openrewrite.java.tree.Expression;
2527
import org.openrewrite.java.tree.J;
2628

2729
import java.util.Collections;
@@ -53,7 +55,11 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
5355
J.MethodInvocation m = super.visitMethodInvocation(method, ctx);
5456

5557
if (MULTICAST_METHOD.matches(m) && m.getArguments().size() == 2) {
56-
return m.withArguments(Collections.singletonList(m.getArguments().get(0)));
58+
return m.withArguments(Collections.singletonList(m.getArguments().get(0)))
59+
.withMethodType(m.getMethodType()
60+
.withParameterNames(m.getMethodType().getParameterNames().subList(0, 1))
61+
.withParameterTypes(m.getMethodType().getParameterTypes().subList(0, 1))
62+
);
5763
}
5864
return m;
5965
}

0 commit comments

Comments
 (0)