Skip to content

Commit 0496caf

Browse files
committed
Prepare formatting refactor
The test here was expecting that a prefix of 2 spaces before the replaced element is kept. With new formatting we're cleaning up these spaces. So keep the prefix of the original object (also preserving potential comments before the method that gets replaced)
1 parent c050b14 commit 0496caf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/org/openrewrite/java/migrate/guava/AbstractNoGuavaImmutableOf.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ public J visitMethodInvocation(J.MethodInvocation method, ExecutionContext ctx)
110110
.apply(getCursor(), mi.getCoordinates().replace(), templateArguments);
111111
m = m.getPadding().withArguments(mi.getPadding().getArguments());
112112
JavaType.Method newType = (JavaType.Method) visitType(mi.getMethodType(), ctx);
113-
m = m.withMethodType(newType).withName(m.getName().withType(newType));
113+
m = m.withMethodType(newType)
114+
.withName(m.getName().withType(newType))
115+
.withPrefix(mi.getPrefix());
116+
114117
return super.visitMethodInvocation(m, ctx);
115118
}
116119

0 commit comments

Comments
 (0)