Skip to content

Commit

Permalink
Fix ChangeMethodTargetToVariable
Browse files Browse the repository at this point in the history
  • Loading branch information
jkschneider committed Aug 3, 2020
1 parent 19dcae8 commit 8ff0f8c
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ public J visitMethodInvocation(J.MethodInvocation method) {

JavaType.Method methodType = null;
if (method.getType() != null) {
// if the original is a static method invocation, the import on it's type may no longer be needed
andThen(orderImports);

Set<Flag> flags = new LinkedHashSet<>(method.getType().getFlags());
flags.remove(Flag.Static);
methodType = method.getType().withDeclaringType(this.type).withFlags(flags);
}

andThen(orderImports);

return method
.withSelect(J.Ident.build(randomId(), variable, type, select == null ? Formatting.EMPTY : select.getFormatting()))
.withType(methodType);
Expand Down

0 comments on commit 8ff0f8c

Please sign in to comment.