diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContext.java b/core/src/main/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContext.java index 226c050ee27..c31461b3166 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContext.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/ChainedAssertionLosesContext.java @@ -25,7 +25,6 @@ import static com.google.errorprone.matchers.Matchers.instanceMethod; import static com.google.errorprone.matchers.Matchers.staticMethod; import static com.google.errorprone.util.ASTHelpers.getDeclaredSymbol; -import static com.google.errorprone.util.ASTHelpers.getEnclosedElements; import static com.google.errorprone.util.ASTHelpers.getSymbol; import static com.google.errorprone.util.ASTHelpers.isSubtype; import static com.sun.source.tree.Tree.Kind.CLASS; @@ -213,9 +212,9 @@ private static FactoryMethodName tryFindFactory( ImmutableSet factories = concat( // The class that assertThat is declared in: - getEnclosedElements(assertThatSymbol.owner).stream(), + assertThatSymbol.owner.getEnclosedElements().stream(), // The Subject class (possibly the same; if so, toImmutableSet() will deduplicate): - getEnclosedElements(assertThatSymbol.getReturnType().asElement()).stream()) + assertThatSymbol.getReturnType().asElement().getEnclosedElements().stream()) .filter(s -> s instanceof MethodSymbol) .map(s -> (MethodSymbol) s) .filter( diff --git a/core/src/main/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionType.java b/core/src/main/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionType.java index 13c53003105..3902861b68e 100644 --- a/core/src/main/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionType.java +++ b/core/src/main/java/com/google/errorprone/bugpatterns/FuturesGetCheckedIllegalExceptionType.java @@ -20,7 +20,6 @@ import static com.google.errorprone.matchers.Matchers.argument; import static com.google.errorprone.matchers.Matchers.classLiteral; import static com.google.errorprone.matchers.method.MethodMatchers.staticMethod; -import static com.google.errorprone.util.ASTHelpers.getEnclosedElements; import static com.google.errorprone.util.ASTHelpers.getSymbol; import static com.google.errorprone.util.ASTHelpers.getType; import static com.google.errorprone.util.ASTHelpers.isSameType; @@ -124,7 +123,7 @@ public boolean matches(ExpressionTree tree, VisitorState state) { return true; } - for (Symbol enclosedSymbol : getEnclosedElements(classSymbol)) { + for (Symbol enclosedSymbol : classSymbol.getEnclosedElements()) { if (!enclosedSymbol.isConstructor()) { continue; } diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/apidiff/CompilationBuilderHelpers.java b/core/src/test/java/com/google/errorprone/bugpatterns/apidiff/CompilationBuilderHelpers.java index c93e697e593..14191e9a3a2 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/apidiff/CompilationBuilderHelpers.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/apidiff/CompilationBuilderHelpers.java @@ -131,7 +131,7 @@ CompilationResult compile() throws IOException { diagnosticCollector, javacopts, /* classes= */ Collections.emptyList(), - fileManager.getJavaFileObjects(sources.toArray(new Path[0]))) + fileManager.getJavaFileObjectsFromPaths(sources)) .call(); return CompilationResult.create(