Skip to content

Commit 6844072

Browse files
committed
Reinstate Result printing for estimated time savings, fix TS UsesMethod precondition
1 parent ef7f14a commit 6844072

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

rewrite-core/src/main/java/org/openrewrite/Result.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -268,14 +268,14 @@ public String toString() {
268268
}
269269

270270
public static boolean isLocalAndHasNoChanges(@Nullable SourceFile before, @Nullable SourceFile after) {
271-
// try {
272-
// return (before == after) ||
273-
// (before != null && after != null &&
274-
// // Remote source files are fetched on `printAll`, let's avoid that cost.
275-
// !(before instanceof Remote) && !(after instanceof Remote) &&
276-
// before.printAll().equals(after.printAll()));
277-
// } catch (Exception e) {
271+
try {
272+
return (before == after) ||
273+
(before != null && after != null &&
274+
// Remote source files are fetched on `printAll`, let's avoid that cost.
275+
!(before instanceof Remote) && !(after instanceof Remote) &&
276+
before.printAll().equals(after.printAll()));
277+
} catch (Exception e) {
278278
return false;
279-
// }
279+
}
280280
}
281281
}

rewrite-javascript/rewrite/src/javascript/preconditions.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,16 @@ export function hasSourcePath(filePattern: string): Promise<RpcRecipe> | TreeVis
2626
}) : new IsSourceFile(filePattern);
2727
}
2828

29-
export function usesMethod(methodMatcher: string, matchOverrides: boolean = false): Promise<RpcRecipe> | TreeVisitor<any, ExecutionContext> {
29+
export function usesMethod(methodPattern: string, matchOverrides: boolean = false): Promise<RpcRecipe> | TreeVisitor<any, ExecutionContext> {
3030
return RewriteRpc.get() ? RewriteRpc.get()!.prepareRecipe("org.openrewrite.java.search.UsesMethod", {
31-
methodMatcher,
31+
methodPattern,
3232
matchOverrides
33-
}) : new UsesMethod(methodMatcher);
33+
}) : new UsesMethod(methodPattern);
3434
}
3535

3636
export function usesType(fullyQualifiedType: string): Promise<RpcRecipe> | TreeVisitor<any, ExecutionContext> {
3737
return RewriteRpc.get() ? RewriteRpc.get()!.prepareRecipe("org.openrewrite.java.search.UsesType", {
38-
fullyQualifiedType
38+
fullyQualifiedType,
39+
includeImplicit: false
3940
}) : new UsesType(fullyQualifiedType);
4041
}

0 commit comments

Comments
 (0)