Skip to content

Commit

Permalink
Prepare for a change to TreeMaker.Select
Browse files Browse the repository at this point in the history
  • Loading branch information
cushon authored and Error Prone Team committed Feb 27, 2023
1 parent 0ec115c commit 14de9bc
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Streams;
import com.sun.tools.javac.code.Symbol.PackageSymbol;
import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.tree.JCTree.JCCompilationUnit;
import com.sun.tools.javac.tree.JCTree.JCExpression;
import com.sun.tools.javac.tree.JCTree.JCImport;
Expand Down Expand Up @@ -269,7 +270,15 @@ private static ImmutableSet<String> getAllImports(Inliner inliner, WhichImports
.map(Collection::stream)
.orElse(Stream.of())
.filter(whichImports::existingImportMatches)
.map(imp -> imp.getQualifiedIdentifier().toString()))
.map(imp -> getQualifiedIdentifier(imp).toString()))
.collect(toImmutableSet());
}

private static JCTree getQualifiedIdentifier(JCImport i) {
try {
return (JCTree) JCImport.class.getMethod("getQualifiedIdentifier").invoke(i);
} catch (ReflectiveOperationException e) {
throw new LinkageError(e.getMessage(), e);
}
}
}

0 comments on commit 14de9bc

Please sign in to comment.