Skip to content

Commit

Permalink
Remove handling of 'builtin processors' from JavaBuilder
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 553927879
Change-Id: Id2d8eb2e99e869db51bd11c74af03e66cd534e9a
  • Loading branch information
cushon authored and copybara-github committed Aug 4, 2023
1 parent d0620d1 commit fb9d12d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public final class JavaLibraryBuildRequest {

private final ImmutableList<Path> processorPath;
private final List<String> processorNames;
private final ImmutableSet<String> builtinProcessorNames;

private final Path outputJar;
private final Path nativeHeaderOutput;
Expand Down Expand Up @@ -188,7 +187,6 @@ public JavaLibraryBuildRequest(
this.system = asPath(optionsParser.getSystem());
this.processorPath = asPaths(optionsParser.getProcessorPath());
this.processorNames = optionsParser.getProcessorNames();
this.builtinProcessorNames = ImmutableSet.copyOf(optionsParser.getBuiltinProcessorNames());
this.classDir =
deriveDirectory(optionsParser.getTargetLabel(), optionsParser.getOutputJar(), "_classes");
this.tempDir =
Expand Down Expand Up @@ -365,7 +363,6 @@ public BlazeJavacArguments toBlazeJavacArguments(ImmutableList<Path> classPath)
.bootClassPath(getBootClassPath())
.system(getSystem())
.sourceFiles(ImmutableList.copyOf(getSourceFiles()))
.builtinProcessors(builtinProcessorNames)
.sourcePath(getSourcePath())
.sourceOutput(getSourceGenDir())
.processorPath(getProcessorPath())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public enum ReduceClasspathMode {

private final List<String> processorPath = new ArrayList<>();
private final List<String> processorNames = new ArrayList<>();
private final List<String> builtinProcessorNames = new ArrayList<>();

private String outputJar;
@Nullable private String nativeHeaderOutput;
Expand Down Expand Up @@ -192,7 +191,8 @@ private void processCommandlineArgs(Deque<String> argQueue) throws InvalidComman
collectProcessorArguments(processorNames, argQueue, "-");
break;
case "--builtin_processors":
collectProcessorArguments(builtinProcessorNames, argQueue, "-");
// TODO(b/294594306): remove once Blaze no longer passes this flag
collectProcessorArguments(new ArrayList<>(), argQueue, "-");
break;
case "--output":
outputJar = getArgument(argQueue, arg);
Expand Down Expand Up @@ -421,10 +421,6 @@ public List<String> getProcessorNames() {
return processorNames;
}

public List<String> getBuiltinProcessorNames() {
return builtinProcessorNames;
}

public String getOutputJar() {
return outputJar;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ public static BlazeJavacResult compile(BlazeJavacArguments arguments) {
options.put("expandJarClassPaths", "false");

try (ClassloaderMaskingFileManager fileManager =
new ClassloaderMaskingFileManager(
context, arguments.builtinProcessors(), getMatchingBootFileManager(arguments))) {
new ClassloaderMaskingFileManager(context, getMatchingBootFileManager(arguments))) {

setLocations(fileManager, arguments);

Expand Down Expand Up @@ -367,16 +366,12 @@ private static synchronized BootClassPathCachingFileManager getMatchingBootFileM
@Trusted
private static class ClassloaderMaskingFileManager extends JavacFileManager {

private final ImmutableSet<String> builtinProcessors;
/** the BootClassPathCachingFileManager instance used for BootClassPaths only. */
private final BootClassPathCachingFileManager bootFileManger;

public ClassloaderMaskingFileManager(
Context context,
ImmutableSet<String> builtinProcessors,
BootClassPathCachingFileManager bootFileManager) {
Context context, BootClassPathCachingFileManager bootFileManager) {
super(context, true, UTF_8);
this.builtinProcessors = builtinProcessors;
this.bootFileManger = bootFileManager;
}

Expand All @@ -402,15 +397,11 @@ protected Class<?> findClass(String name) throws ClassNotFoundException {
|| name.startsWith("com.google.common.base.")
|| name.startsWith("com.google.common.graph.")
|| name.startsWith("com.google.common.regex.")
|| name.startsWith("com.google.devtools.ksp.symbol.")
|| name.startsWith("org.checkerframework.shaded.dataflow.")
|| name.startsWith("org.checkerframework.errorprone.dataflow.")
|| name.startsWith("com.sun.source.")
|| name.startsWith("com.sun.tools.")
|| name.startsWith("com.google.devtools.build.buildjar.javac.statistics.")
|| name.startsWith("dagger.model.")
|| name.startsWith("dagger.spi.")
|| builtinProcessors.contains(name)) {
|| name.startsWith("com.google.devtools.build.buildjar.javac.statistics.")) {
return Class.forName(name);
}
throw new ClassNotFoundException(name);
Expand Down

0 comments on commit fb9d12d

Please sign in to comment.