Remove vestigial support for 'extclasspaths'

this isn't being used, we just add the jars in the 'extdir' to the
bootclasspath.

PiperOrigin-RevId: 293936434
diff --git a/src/java_tools/buildjar/BUILD b/src/java_tools/buildjar/BUILD
index d1f14d6..2fcf721 100644
--- a/src/java_tools/buildjar/BUILD
+++ b/src/java_tools/buildjar/BUILD
@@ -62,7 +62,6 @@
     # single jar that contains the contents of both the bootclasspath and
     # extdirs.
     bootclasspath = ["//tools/jdk:platformclasspath.jar"],
-    extclasspath = [],
     genclass = ["bootstrap_genclass_deploy.jar"],
     ijar = ["//third_party/ijar"],
     javabuilder = ["bootstrap_VanillaJavaBuilder_deploy.jar"],
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/JavaLibraryBuildRequest.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/JavaLibraryBuildRequest.java
index 2a40104..c039836 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/JavaLibraryBuildRequest.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/JavaLibraryBuildRequest.java
@@ -54,7 +54,6 @@
   private final ImmutableList<Path> sourcePath;
   private final ImmutableList<Path> classPath;
   private final ImmutableList<Path> bootClassPath;
-  private final ImmutableList<Path> extClassPath;
 
   private final ImmutableList<Path> processorPath;
   private final List<String> processorNames;
@@ -123,10 +122,7 @@
     }
     depsBuilder.addDepsArtifacts(asPaths(optionsParser.getDepsArtifacts()));
     depsBuilder.setPlatformJars(
-        ImmutableSet.<Path>builder()
-            .addAll(asPaths(optionsParser.getBootClassPath()))
-            .addAll(asPaths(optionsParser.getExtClassPath()))
-            .build());
+        optionsParser.getBootClassPath().stream().map(Paths::get).collect(toImmutableSet()));
     if (optionsParser.reduceClasspathMode() != OptionsParser.ReduceClasspathMode.NONE) {
       depsBuilder.setReduceClasspath();
     }
@@ -159,7 +155,6 @@
     this.classPath = asPaths(optionsParser.getClassPath());
     this.sourcePath = asPaths(optionsParser.getSourcePath());
     this.bootClassPath = asPaths(optionsParser.getBootClassPath());
-    this.extClassPath = asPaths(optionsParser.getExtClassPath());
     this.processorPath = asPaths(optionsParser.getProcessorPath());
     this.processorNames = optionsParser.getProcessorNames();
     this.builtinProcessorNames = ImmutableSet.copyOf(optionsParser.getBuiltinProcessorNames());
@@ -237,10 +232,6 @@
     return bootClassPath;
   }
 
-  public ImmutableList<Path> getExtClassPath() {
-    return extClassPath;
-  }
-
   public ImmutableList<Path> getProcessorPath() {
     return processorPath;
   }
@@ -318,11 +309,7 @@
         BlazeJavacArguments.builder()
             .classPath(classPath)
             .classOutput(getClassDir())
-            .bootClassPath(
-                ImmutableList.<Path>builder()
-                    .addAll(getBootClassPath())
-                    .addAll(getExtClassPath())
-                    .build())
+            .bootClassPath(getBootClassPath())
             .javacOptions(makeJavacArguments())
             .sourceFiles(ImmutableList.copyOf(getSourceFiles()))
             .processors(null)
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/OptionsParser.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/OptionsParser.java
index 5099acb..4aeb301 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/OptionsParser.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/OptionsParser.java
@@ -79,7 +79,6 @@
   private final List<String> classPath = new ArrayList<>();
   private final List<String> sourcePath = new ArrayList<>();
   private final List<String> bootClassPath = new ArrayList<>();
-  private final List<String> extClassPath = new ArrayList<>();
 
   private final List<String> processorPath = new ArrayList<>();
   private final List<String> processorNames = new ArrayList<>();
@@ -186,7 +185,8 @@
           break;
         case "--extclasspath":
         case "--extdir":
-          collectFlagArguments(extClassPath, argQueue, "-");
+          // TODO(b/149114743): remove this flag once Blaze stops passing it
+          collectFlagArguments(new ArrayList<>(), argQueue, "-");
           break;
         case "--output":
           outputJar = getArgument(argQueue, arg);
@@ -420,9 +420,6 @@
     return sourcePath;
   }
 
-  public List<String> getExtClassPath() {
-    return extClassPath;
-  }
 
   public List<String> getProcessorPath() {
     return processorPath;
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/VanillaJavaBuilder.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/VanillaJavaBuilder.java
index 49b8ae8..38506c3 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/VanillaJavaBuilder.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/VanillaJavaBuilder.java
@@ -251,9 +251,7 @@
       OptionsParser optionsParser, StandardJavaFileManager fileManager, Path nativeHeaderDir)
       throws IOException {
     fileManager.setLocation(StandardLocation.CLASS_PATH, toFiles(optionsParser.getClassPath()));
-    Iterable<File> bootClassPath =
-        Iterables.concat(
-            toFiles(optionsParser.getBootClassPath()), toFiles(optionsParser.getExtClassPath()));
+    Iterable<File> bootClassPath = toFiles(optionsParser.getBootClassPath());
     // The bootclasspath may legitimately be empty if --release is being used.
     if (!Iterables.isEmpty(bootClassPath)) {
       fileManager.setLocation(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
index 69051d0..c393ad5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompilationHelper.java
@@ -284,7 +284,6 @@
     builder.setClasspathEntries(attributes.getCompileTimeClassPath());
     builder.setBootclasspathEntries(getBootclasspathOrDefault());
     builder.setSourcePathEntries(attributes.getSourcePath());
-    builder.setExtdirInputs(getExtdirInputs());
     builder.setToolsJars(javaToolchain.getTools());
     builder.setJavaBuilder(javaToolchain.getJavaBuilder());
     if (!turbineAnnotationProcessing) {
@@ -488,11 +487,7 @@
     builder.setSourceFiles(attributes.getSourceFiles());
     builder.setSourceJars(attributes.getSourceJars());
     builder.setClasspathEntries(attributes.getCompileTimeClassPath());
-    builder.setBootclasspathEntries(
-        NestedSetBuilder.<Artifact>stableOrder()
-            .addTransitive(getBootclasspathOrDefault())
-            .addTransitive(getExtdirInputs())
-            .build());
+    builder.setBootclasspathEntries(getBootclasspathOrDefault());
     // Exclude any per-package configured data (see JavaCommon.computePerPackageData).
     // It is used to allow Error Prone checks to load additional data,
     // and Error Prone doesn't run during header compilation.
@@ -835,11 +830,6 @@
     return javaToolchain.getBootclasspath();
   }
 
-  /** Returns the extdir artifacts. */
-  private final NestedSet<Artifact> getExtdirInputs() {
-    return javaToolchain.getExtclasspath();
-  }
-
   /**
    * Creates the Action that creates ijars from Jar files.
    *
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java
index 05e8578..827b373 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaCompileActionBuilder.java
@@ -158,7 +158,6 @@
   private NestedSet<Artifact> bootclasspathEntries =
       NestedSetBuilder.emptySet(Order.NAIVE_LINK_ORDER);
   private ImmutableList<Artifact> sourcePathEntries = ImmutableList.of();
-  private NestedSet<Artifact> extdirInputs = NestedSetBuilder.emptySet(Order.NAIVE_LINK_ORDER);
   private FilesToRunProvider javaBuilder;
   private NestedSet<Artifact> toolsJars = NestedSetBuilder.emptySet(Order.NAIVE_LINK_ORDER);
   private PathFragment sourceGenDirectory;
@@ -241,8 +240,7 @@
         .addAll(sourceFiles)
         .addTransitive(javabaseInputs)
         .addTransitive(bootclasspathEntries)
-        .addAll(sourcePathEntries)
-        .addTransitive(extdirInputs);
+        .addAll(sourcePathEntries);
     if (coverageArtifact != null) {
       mandatoryInputs.add(coverageArtifact);
     }
@@ -332,7 +330,6 @@
       result.add("--compress_jar");
     }
     result.addExecPath("--output_deps_proto", outputs.depsProto());
-    result.addExecPaths("--extclasspath", extdirInputs);
     result.addExecPaths("--bootclasspath", bootclasspathEntries);
     result.addExecPaths("--sourcepath", sourcePathEntries);
     result.addExecPaths("--processorpath", plugins.processorClasspath());
@@ -469,11 +466,6 @@
     return this;
   }
 
-  public JavaCompileActionBuilder setExtdirInputs(NestedSet<Artifact> extdirEntries) {
-    this.extdirInputs = extdirEntries;
-    return this;
-  }
-
   /** Sets the directory where source files generated by annotation processors should be stored. */
   public JavaCompileActionBuilder setSourceGenDirectory(PathFragment sourceGenDirectory) {
     this.sourceGenDirectory = sourceGenDirectory;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchain.java
index 52c1ea8..9d46758 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchain.java
@@ -59,8 +59,6 @@
     ImmutableList<String> javacopts = getJavacOpts(ruleContext);
     NestedSet<Artifact> bootclasspath =
         PrerequisiteArtifacts.nestedSet(ruleContext, "bootclasspath", Mode.HOST);
-    NestedSet<Artifact> extclasspath =
-        PrerequisiteArtifacts.nestedSet(ruleContext, "extclasspath", Mode.HOST);
     boolean javacSupportsWorkers =
         ruleContext.attributes().get("javac_supports_workers", Type.BOOLEAN);
     Artifact javac = ruleContext.getPrerequisiteArtifact("javac", Mode.HOST);
@@ -142,7 +140,6 @@
             turbineJvmOpts,
             javacSupportsWorkers,
             bootclasspath,
-            extclasspath,
             javac,
             tools,
             javabuilder,
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainProvider.java
index b8c5df0..66e577e 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaToolchainProvider.java
@@ -78,7 +78,6 @@
       ImmutableList<String> turbineJvmOptions,
       boolean javacSupportsWorkers,
       NestedSet<Artifact> bootclasspath,
-      NestedSet<Artifact> extclasspath,
       @Nullable Artifact javac,
       NestedSet<Artifact> tools,
       FilesToRunProvider javaBuilder,
@@ -103,7 +102,6 @@
     return new JavaToolchainProvider(
         label,
         bootclasspath,
-        extclasspath,
         javac,
         tools,
         javaBuilder,
@@ -134,7 +132,6 @@
 
   private final Label label;
   private final NestedSet<Artifact> bootclasspath;
-  private final NestedSet<Artifact> extclasspath;
   @Nullable private final Artifact javac;
   private final NestedSet<Artifact> tools;
   private final FilesToRunProvider javaBuilder;
@@ -166,7 +163,6 @@
   JavaToolchainProvider(
       Label label,
       NestedSet<Artifact> bootclasspath,
-      NestedSet<Artifact> extclasspath,
       @Nullable Artifact javac,
       NestedSet<Artifact> tools,
       FilesToRunProvider javaBuilder,
@@ -197,7 +193,6 @@
 
     this.label = label;
     this.bootclasspath = bootclasspath;
-    this.extclasspath = extclasspath;
     this.javac = javac;
     this.tools = tools;
     this.javaBuilder = javaBuilder;
@@ -236,11 +231,6 @@
     return bootclasspath;
   }
 
-  /** @return the target Java extclasspath */
-  public NestedSet<Artifact> getExtclasspath() {
-    return extclasspath;
-  }
-
   /** Returns the {@link Artifact} of the javac jar */
   @Nullable
   public Artifact getJavac() {
diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionTestHelper.java b/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionTestHelper.java
index 05e7de8..aa7fa61 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionTestHelper.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/java/JavaCompileActionTestHelper.java
@@ -86,9 +86,6 @@
     return getOptions(javac).getBootClassPath();
   }
 
-  public static List<String> getExtdir(JavaCompileAction javac) throws Exception {
-    return getOptions(javac).getExtClassPath();
-  }
 
   /** Returns the JavaBuilder command line, up to the main class or deploy jar. */
   public static List<String> getJavacCommand(JavaCompileAction action) throws Exception {