Skip to content

Commit 823b454

Browse files
committed
Also update type on name identifier
1 parent c237a18 commit 823b454

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/org/openrewrite/java/testing/cleanup/RemoveTestPrefix.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,12 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method,
102102
}
103103

104104
JavaType.Method type = m.getMethodType();
105-
106105
if (type == null || methodExists(type, newMethodName)) {
107106
return m;
108107
}
109108

110109
type = type.withName(newMethodName);
111-
return m.withName(m.getName()
112-
.withSimpleName(newMethodName))
110+
return m.withName(m.getName().withSimpleName(newMethodName).withType(type))
113111
.withMethodType(type);
114112
}
115113

0 commit comments

Comments
 (0)