Remove deprecated java_common.create_provider and JavaInfo() legacy args

as part of removing the code for --incompatible_disallow_legacy_javainfo.

See #5821.

RELNOTES: Deprecated Java-Starlark API java_common.create_provider is removed. JavaInfo() legacy args (actions, sources, source_jars, use_ijar, java_toolchain, host_javabase) are removed.
PiperOrigin-RevId: 264559900
diff --git a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
index 74d9280..c83f67f 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/StarlarkSemanticsOptions.java
@@ -341,7 +341,8 @@
         OptionMetadataTag.INCOMPATIBLE_CHANGE,
         OptionMetadataTag.TRIGGERED_BY_ALL_INCOMPATIBLE_CHANGES
       },
-      help = "If set to true, old-style JavaInfo provider construction is disallowed.")
+      help = "Deprecated. No-op.")
+  // TODO(elenairina): Move option to graveyard after the flag is removed from the global blazerc.
   public boolean incompatibleDisallowLegacyJavaInfo;
 
   @Option(
@@ -672,7 +673,6 @@
             .incompatibleDisableDepsetItems(incompatibleDisableDepsetItems)
             .incompatibleDisallowDictPlus(incompatibleDisallowDictPlus)
             .incompatibleDisallowEmptyGlob(incompatibleDisallowEmptyGlob)
-            .incompatibleDisallowLegacyJavaInfo(incompatibleDisallowLegacyJavaInfo)
             .incompatibleDisallowLegacyJavaProvider(incompatibleDisallowLegacyJavaProvider)
             .incompatibleDisallowOldStyleArgsAdd(incompatibleDisallowOldStyleArgsAdd)
             .incompatibleDisallowStructProviderSyntax(incompatibleDisallowStructProviderSyntax)
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfo.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfo.java
index e11fac6..a1898dd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfo.java
@@ -42,7 +42,6 @@
 import com.google.devtools.build.lib.syntax.EvalException;
 import com.google.devtools.build.lib.syntax.Runtime;
 import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.SkylarkList.MutableList;
 import com.google.devtools.build.lib.syntax.SkylarkNestedSet;
 import java.util.ArrayList;
 import java.util.List;
@@ -65,11 +64,6 @@
     return object != Runtime.NONE ? type.cast(object) : null;
   }
 
-  @Nullable
-  private static Object nullIfNone(Object object) {
-    return nullIfNone(object, Object.class);
-  }
-
   public static final JavaInfo EMPTY = JavaInfo.Builder.create().build();
 
   private static final ImmutableSet<Class<? extends TransitiveInfoProvider>> ALLOWED_PROVIDERS =
@@ -401,12 +395,6 @@
         SkylarkList<?> deps,
         SkylarkList<?> runtimeDeps,
         SkylarkList<?> exports,
-        Object actionsApi,
-        Object sourcesApi,
-        Object sourceJarsApi,
-        Object useIjarApi,
-        Object javaToolchainApi,
-        Object hostJavabaseApi,
         Object jdepsApi,
         Location loc,
         Environment env)
@@ -414,62 +402,7 @@
       Artifact outputJar = (Artifact) outputJarApi;
       @Nullable Artifact compileJar = nullIfNone(compileJarApi, Artifact.class);
       @Nullable Artifact sourceJar = nullIfNone(sourceJarApi, Artifact.class);
-
-      @Nullable Object actions = nullIfNone(actionsApi);
-      @Nullable
-      SkylarkList<Artifact> sources =
-          (SkylarkList<Artifact>) nullIfNone(sourcesApi, SkylarkList.class);
-      @Nullable
-      SkylarkList<Artifact> sourceJars =
-          (SkylarkList<Artifact>) nullIfNone(sourceJarsApi, SkylarkList.class);
-
-      @Nullable Boolean useIjar = nullIfNone(useIjarApi, Boolean.class);
-      @Nullable Object javaToolchain = nullIfNone(javaToolchainApi);
-      @Nullable Object hostJavabase = nullIfNone(hostJavabaseApi);
       @Nullable Artifact jdeps = nullIfNone(jdepsApi, Artifact.class);
-
-      boolean hasLegacyArg =
-          actions != null
-              || sources != null
-              || sourceJars != null
-              || useIjar != null
-              || javaToolchain != null
-              || hostJavabase != null;
-      if (hasLegacyArg) {
-        if (env.getSemantics().incompatibleDisallowLegacyJavaInfo()) {
-          throw new EvalException(
-              loc,
-              "Cannot use deprecated argument when "
-                  + "--incompatible_disallow_legacy_javainfo is set. "
-                  + "Deprecated arguments are 'actions', 'sources', 'source_jars', "
-                  + "'use_ijar', 'java_toolchain', 'host_javabase'.");
-        }
-        boolean hasNewArg = compileJar != null || sourceJar != null;
-        if (hasNewArg) {
-          throw new EvalException(
-              loc,
-              "Cannot use deprecated arguments at the same time as "
-                  + "'compile_jar' or 'source_jar'. "
-                  + "Deprecated arguments are 'actions', 'sources', 'source_jars', "
-                  + "'use_ijar', 'java_toolchain', 'host_javabase'.");
-        }
-        return JavaInfoBuildHelper.getInstance()
-            .createJavaInfoLegacy(
-                outputJar,
-                sources != null ? sources : MutableList.empty(),
-                sourceJars != null ? sourceJars : MutableList.empty(),
-                useIjar != null ? useIjar : true,
-                neverlink,
-                (SkylarkList<JavaInfo>) deps,
-                (SkylarkList<JavaInfo>) runtimeDeps,
-                (SkylarkList<JavaInfo>) exports,
-                actions,
-                (JavaToolchainProvider) javaToolchain,
-                (JavaRuntimeInfo) hostJavabase,
-                jdeps,
-                env.getSemantics(),
-                loc);
-      }
       if (compileJar == null) {
         throw new EvalException(loc, "Expected 'File' for 'compile_jar', found 'None'");
       }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java
index 58004b6..bea8c6f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java
@@ -64,99 +64,6 @@
    *
    * @param outputJar the jar that was created as a result of a compilation (e.g. javac, scalac,
    *     etc)
-   * @param sourceFiles the sources that were used to create the output jar
-   * @param sourceJars the source jars that were used to create the output jar
-   * @param useIjar if an ijar of the output jar should be created and stored in the provider
-   * @param neverlink if true only use this library for compilation and not at runtime
-   * @param compileTimeDeps compile time dependencies that were used to create the output jar
-   * @param runtimeDeps runtime dependencies that are needed for this library
-   * @param exports libraries to make available for users of this library. <a
-   *     href="https://docs.bazel.build/versions/master/be/java.html#java_library"
-   *     target="_top">java_library.exports</a>
-   * @param actions used to create the ijar and single jar actions
-   * @param javaToolchain the toolchain to be used for retrieving the ijar tool
-   * @param jdeps optional jdeps information for outputJar
-   * @param semantics the skylark semantics
-   * @return new created JavaInfo instance
-   * @throws EvalException if some mandatory parameter are missing
-   */
-  @Deprecated
-  JavaInfo createJavaInfoLegacy(
-      Artifact outputJar,
-      SkylarkList<Artifact> sourceFiles,
-      SkylarkList<Artifact> sourceJars,
-      Boolean useIjar,
-      Boolean neverlink,
-      SkylarkList<JavaInfo> compileTimeDeps,
-      SkylarkList<JavaInfo> runtimeDeps,
-      SkylarkList<JavaInfo> exports,
-      Object actions,
-      JavaToolchainProvider javaToolchain,
-      JavaRuntimeInfo hostJavabase,
-      @Nullable Artifact jdeps,
-      StarlarkSemantics semantics,
-      Location location)
-      throws EvalException {
-    final Artifact sourceJar;
-    if (sourceFiles.isEmpty() && sourceJars.isEmpty()) {
-      sourceJar = null;
-    } else if (sourceFiles.isEmpty() && sourceJars.size() == 1) {
-      sourceJar = sourceJars.get(0);
-    } else {
-      if (!(actions instanceof SkylarkActionFactory)) {
-        throw new EvalException(location, "Must pass ctx.actions when packing sources.");
-      }
-      if (javaToolchain == null) {
-        throw new EvalException(location, "Must pass java_toolchain when packing sources.");
-      }
-      if (hostJavabase == null) {
-        throw new EvalException(location, "Must pass host_javabase when packing sources.");
-      }
-      sourceJar =
-          packSourceFiles(
-              (SkylarkActionFactory) actions,
-              outputJar,
-              /* outputSourceJar= */ null,
-              sourceFiles,
-              sourceJars,
-              javaToolchain,
-              hostJavabase,
-              location);
-    }
-    final Artifact iJar;
-    if (useIjar) {
-      if (!(actions instanceof SkylarkActionFactory)) {
-        throw new EvalException(
-            location,
-            "The value of use_ijar is True. Make sure the ctx.actions argument is valid.");
-      }
-      if (javaToolchain == null) {
-        throw new EvalException(
-            location,
-            "The value of use_ijar is True. Make sure the java_toolchain argument is valid.");
-      }
-      iJar = buildIjar((SkylarkActionFactory) actions, outputJar, null, javaToolchain, location);
-    } else {
-      iJar = outputJar;
-    }
-
-    return createJavaInfo(
-        outputJar,
-        iJar,
-        sourceJar,
-        neverlink,
-        compileTimeDeps,
-        runtimeDeps,
-        exports,
-        jdeps,
-        location);
-  }
-
-  /**
-   * Creates JavaInfo instance from outputJar.
-   *
-   * @param outputJar the jar that was created as a result of a compilation (e.g. javac, scalac,
-   *     etc)
    * @param compileJar Jar added as a compile-time dependency to other rules. Typically produced by
    *     ijar.
    * @param sourceJar the source jar that was used to create the output jar
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
index df3ccac..f0516d1 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaSkylarkCommon.java
@@ -21,7 +21,6 @@
 import com.google.devtools.build.lib.analysis.skylark.SkylarkRuleContext;
 import com.google.devtools.build.lib.cmdline.Label;
 import com.google.devtools.build.lib.collect.nestedset.NestedSet;
-import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
 import com.google.devtools.build.lib.events.Location;
 import com.google.devtools.build.lib.packages.Provider;
 import com.google.devtools.build.lib.skylarkbuildapi.ProviderApi;
@@ -31,9 +30,7 @@
 import com.google.devtools.build.lib.syntax.EvalException;
 import com.google.devtools.build.lib.syntax.Runtime;
 import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.SkylarkNestedSet;
 import com.google.devtools.build.lib.syntax.StarlarkSemantics;
-import javax.annotation.Nullable;
 
 /** A module that contains Skylark utilities for Java support. */
 public class JavaSkylarkCommon
@@ -46,40 +43,6 @@
         SkylarkActionFactory> {
   private final JavaSemantics javaSemantics;
 
-  @Override
-  public JavaInfo create(
-      @Nullable Object actionsUnchecked,
-      Object compileTimeJars,
-      Object runtimeJars,
-      Boolean useIjar,
-      @Nullable Object javaToolchain,
-      Object transitiveCompileTimeJars,
-      Object transitiveRuntimeJars,
-      Object sourceJars,
-      Location location,
-      Environment environment)
-      throws EvalException {
-    if (environment.getSemantics().incompatibleDisallowLegacyJavaInfo()) {
-      throw new EvalException(
-          location,
-          "java_common.create_provider is deprecated and cannot be used when "
-              + "--incompatible_disallow_legacy_javainfo is set. "
-              + "Please migrate to the JavaInfo constructor.");
-    }
-    return JavaInfoBuildHelper.getInstance()
-        .create(
-            actionsUnchecked,
-            asArtifactNestedSet(compileTimeJars),
-            asArtifactNestedSet(runtimeJars),
-            useIjar,
-            javaToolchain == Runtime.NONE ? null : (JavaToolchainProvider) javaToolchain,
-            asArtifactNestedSet(transitiveCompileTimeJars),
-            asArtifactNestedSet(transitiveRuntimeJars),
-            asArtifactNestedSet(sourceJars),
-            environment.getSemantics(),
-            location);
-  }
-
   public JavaSkylarkCommon(JavaSemantics javaSemantics) {
     this.javaSemantics = javaSemantics;
   }
@@ -228,18 +191,6 @@
     return ToolchainInfo.PROVIDER;
   }
 
-  /**
-   * Takes an Object that is either a SkylarkNestedSet or a SkylarkList of Artifacts and returns it
-   * as a NestedSet.
-   */
-  private NestedSet<Artifact> asArtifactNestedSet(Object o) throws EvalException {
-    return o instanceof SkylarkNestedSet
-        ? ((SkylarkNestedSet) o).getSet(Artifact.class)
-        : NestedSetBuilder.<Artifact>naiveLinkOrder()
-            .addAll(((SkylarkList<?>) o).getContents(Artifact.class, /*description=*/ null))
-            .build();
-  }
-
   @Override
   public boolean isJavaToolchainResolutionEnabled(SkylarkRuleContext ruleContext)
       throws EvalException {
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java
index c43633a..046c2b6 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaCommonApi.java
@@ -29,10 +29,8 @@
 import com.google.devtools.build.lib.syntax.Environment;
 import com.google.devtools.build.lib.syntax.EvalException;
 import com.google.devtools.build.lib.syntax.SkylarkList;
-import com.google.devtools.build.lib.syntax.SkylarkNestedSet;
 import com.google.devtools.build.lib.syntax.StarlarkSemantics;
 import com.google.devtools.build.lib.syntax.StarlarkSemantics.FlagIdentifier;
-import javax.annotation.Nullable;
 
 /** Utilities for Java compilation support in Skylark. */
 @SkylarkModule(name = "java_common", doc = "Utilities for Java compilation support in Starlark.")
@@ -45,137 +43,6 @@
     SkylarkActionFactoryT extends SkylarkActionFactoryApi> {
 
   @SkylarkCallable(
-      name = "create_provider",
-      doc =
-          "This API is deprecated. It will be disabled by default in Bazel 0.23. Please use "
-              + "<a href ="
-              + "'https://docs.bazel.build/versions/master/skylark/lib/JavaInfo.html#JavaInfo'>"
-              + "JavaInfo()</a> instead."
-              + "Creates a JavaInfo from jars. compile_time/runtime_jars are the outputs of the "
-              + "target providing a JavaInfo, while transitive_*_jars represent their dependencies."
-              + "<p>Note: compile_time_jars and runtime_jars are not automatically merged into the "
-              + "transitive jars (unless the given transitive_*_jars are empty) - if this is the "
-              + "desired behaviour the user should merge the jars before creating the provider."
-              + "<p>This function also creates actions to generate interface jars by default."
-              + "<p>When use_ijar is True, ijar will be run on the given compile_time_jars and the "
-              + "resulting interface jars will be stored as compile_jars, "
-              + "while the initial jars will be stored as full_compile_jars. "
-              + "<p>When use_ijar=False, the given compile_time_jars will be stored as both "
-              + "compile_jars and full_compile_jars. No actions are created. "
-              + "See JavaInfo#compile_jars and JavaInfo#full_compile_jars for more details."
-              + "<p>Currently only "
-              + "<a href='https://github.com/bazelbuild/bazel/tree/master/third_party/ijar'>"
-              + "ijar</a>"
-              + " is supported for generating interface jars. "
-              + "Header compilation is not yet supported.",
-      parameters = {
-        @Param(
-            name = "actions",
-            type = SkylarkActionFactoryApi.class,
-            noneable = true,
-            defaultValue = "None",
-            doc =
-                "The ctx.actions object, used to register the actions for creating the "
-                    + "interface jars. Only set if use_ijar=True."),
-        @Param(
-            name = "compile_time_jars",
-            positional = false,
-            named = true,
-            allowedTypes = {
-              @ParamType(type = SkylarkList.class),
-              @ParamType(type = SkylarkNestedSet.class),
-            },
-            generic1 = FileApi.class,
-            defaultValue = "[]",
-            doc = "A list or a set of jars that should be used at compilation for a given target."),
-        @Param(
-            name = "runtime_jars",
-            positional = false,
-            named = true,
-            allowedTypes = {
-              @ParamType(type = SkylarkList.class),
-              @ParamType(type = SkylarkNestedSet.class),
-            },
-            generic1 = FileApi.class,
-            defaultValue = "[]",
-            doc = "A list or a set of jars that should be used at runtime for a given target."),
-        @Param(
-            name = "use_ijar",
-            positional = false,
-            named = true,
-            type = Boolean.class,
-            defaultValue = "True",
-            doc =
-                "If True it will generate interface jars for every jar in compile_time_jars."
-                    + "The generating interface jars will be stored as compile_jars "
-                    + "and the initial (full) compile_time_jars will be stored as "
-                    + "full_compile_jars. If False the given compile_jars will be "
-                    + "stored as both compile_jars and full_compile_jars."),
-        @Param(
-            name = "java_toolchain",
-            positional = false,
-            named = true,
-            type = Object.class,
-            allowedTypes = {@ParamType(type = JavaToolchainSkylarkApiProviderApi.class)},
-            noneable = true,
-            defaultValue = "None",
-            doc =
-                "A JavaToolchainInfo to be used for retrieving the ijar "
-                    + "tool. Only set when use_ijar is True."),
-        @Param(
-            name = "transitive_compile_time_jars",
-            positional = false,
-            named = true,
-            allowedTypes = {
-              @ParamType(type = SkylarkList.class),
-              @ParamType(type = SkylarkNestedSet.class),
-            },
-            generic1 = FileApi.class,
-            defaultValue = "[]",
-            doc =
-                "A list or set of compile time jars collected from the transitive closure of a "
-                    + "rule."),
-        @Param(
-            name = "transitive_runtime_jars",
-            positional = false,
-            named = true,
-            allowedTypes = {
-              @ParamType(type = SkylarkList.class),
-              @ParamType(type = SkylarkNestedSet.class),
-            },
-            generic1 = FileApi.class,
-            defaultValue = "[]",
-            doc = "A list or set of runtime jars collected from the transitive closure of a rule."),
-        @Param(
-            name = "source_jars",
-            positional = false,
-            named = true,
-            allowedTypes = {
-              @ParamType(type = SkylarkList.class),
-              @ParamType(type = SkylarkNestedSet.class),
-            },
-            generic1 = FileApi.class,
-            defaultValue = "[]",
-            doc =
-                "A list or set of output source jars that contain the uncompiled source files "
-                    + "including the source files generated by annotation processors if the case.")
-      },
-      useLocation = true,
-      useEnvironment = true)
-  public JavaInfoT create(
-      @Nullable Object actionsUnchecked,
-      Object compileTimeJars,
-      Object runtimeJars,
-      Boolean useIjar,
-      @Nullable Object javaToolchainUnchecked,
-      Object transitiveCompileTimeJars,
-      Object transitiveRuntimeJars,
-      Object sourceJars,
-      Location location,
-      Environment environment)
-      throws EvalException;
-
-  @SkylarkCallable(
       name = "provider",
       structField = true,
       doc =
diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaInfoApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaInfoApi.java
index 41d33b3..e05196d 100644
--- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaInfoApi.java
+++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/java/JavaInfoApi.java
@@ -19,7 +19,6 @@
 import com.google.devtools.build.lib.events.Location;
 import com.google.devtools.build.lib.skylarkbuildapi.FileApi;
 import com.google.devtools.build.lib.skylarkbuildapi.ProviderApi;
-import com.google.devtools.build.lib.skylarkbuildapi.SkylarkActionFactoryApi;
 import com.google.devtools.build.lib.skylarkbuildapi.StructApi;
 import com.google.devtools.build.lib.skylarkinterface.Param;
 import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
@@ -217,68 +216,6 @@
                     + "<a class=\"anchor\" href=\"https://docs.bazel.build/versions/"
                     + "master/be/java.html#java_library.exports\">java_library.exports</a>."),
         @Param(
-            name = "actions",
-            type = SkylarkActionFactoryApi.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. No longer needed when <code>compile_jar</code> and/or "
-                    + "<code>source_jar</code> are used. "
-                    + "<p>Used to create the ijar and pack source files to jar actions.</p>"),
-        @Param(
-            name = "sources",
-            type = SkylarkList.class,
-            generic1 = FileApi.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. Use <code>source_jar</code> instead. "
-                    + "<p>The sources that were used to create the output jar.</p>"),
-        @Param(
-            name = "source_jars",
-            type = SkylarkList.class,
-            generic1 = FileApi.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. Use <code>source_jar</code> instead. "
-                    + "<p>The source jars that were used to create the output jar.</p>"),
-        @Param(
-            name = "use_ijar",
-            type = Boolean.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. Use <code>compile_jar</code> instead. "
-                    + "<p>If an ijar of the output jar should be created and stored in the "
-                    + "provider. </p>"),
-        @Param(
-            name = "java_toolchain",
-            type = Object.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. No longer needed when <code>compile_jar</code> and/or "
-                    + "<code>source_jar</code> are used. "
-                    + "<p>The toolchain to be used for retrieving the ijar tool and packing source "
-                    + "files to Jar. This should be a Target.</p>"),
-        @Param(
-            name = "host_javabase",
-            type = Object.class,
-            named = true,
-            defaultValue = "None",
-            noneable = true,
-            doc =
-                "Deprecated. No longer needed when <code>compile_jar</code> and/or "
-                    + "<code>source_jar</code> are used. "
-                    + "<p>The host_javabase to be used for packing source files to Jar. "
-                    + "This should be a Target.</p>"),
-        @Param(
             name = "jdeps",
             type = FileApi.class,
             named = true,
@@ -301,12 +238,6 @@
         SkylarkList<?> deps,
         SkylarkList<?> runtimeDeps,
         SkylarkList<?> exports,
-        Object actionsApi,
-        Object sourcesApi,
-        Object sourceJarsApi,
-        Object useIjarApi,
-        Object javaToolchainApi,
-        Object hostJavabaseApi,
         Object jdepsApi,
         Location loc,
         Environment env)
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
index fad687d..fe26fe1 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/StarlarkSemantics.java
@@ -159,8 +159,6 @@
 
   public abstract boolean incompatibleDisallowLegacyJavaProvider();
 
-  public abstract boolean incompatibleDisallowLegacyJavaInfo();
-
   public abstract boolean incompatibleDisallowOldStyleArgsAdd();
 
   public abstract boolean incompatibleDisallowRuleExecutionPlatformConstraintsAllowed();
@@ -262,7 +260,6 @@
           .incompatibleDisallowDictPlus(true)
           .incompatibleDisallowEmptyGlob(false)
           .incompatibleDisallowLegacyJavaProvider(false)
-          .incompatibleDisallowLegacyJavaInfo(true)
           .incompatibleDisallowOldStyleArgsAdd(true)
           .incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(true)
           .incompatibleDisallowStructProviderSyntax(false)
@@ -333,8 +330,6 @@
 
     public abstract Builder incompatibleDisallowLegacyJavaProvider(boolean value);
 
-    public abstract Builder incompatibleDisallowLegacyJavaInfo(boolean value);
-
     public abstract Builder incompatibleDisallowOldStyleArgsAdd(boolean value);
 
     public abstract Builder incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaCommon.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaCommon.java
index 8dfae0b..4efc396 100644
--- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaCommon.java
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaCommon.java
@@ -29,7 +29,6 @@
 import com.google.devtools.build.lib.syntax.SkylarkList;
 import com.google.devtools.build.lib.syntax.StarlarkSemantics;
 import com.google.devtools.build.skydoc.fakebuildapi.FakeProviderApi;
-import javax.annotation.Nullable;
 
 /** Fake implementation of {@link JavaCommonApi}. */
 public class FakeJavaCommon
@@ -42,22 +41,6 @@
         SkylarkActionFactoryApi> {
 
   @Override
-  public FakeJavaInfo create(
-      @Nullable Object actionsUnchecked,
-      Object compileTimeJars,
-      Object runtimeJars,
-      Boolean useIjar,
-      @Nullable Object javaToolchainUnchecked,
-      Object transitiveCompileTimeJars,
-      Object transitiveRuntimeJars,
-      Object sourceJars,
-      Location location,
-      Environment environment)
-      throws EvalException {
-    return new FakeJavaInfo();
-  }
-
-  @Override
   public ProviderApi getJavaProvider() {
     return new FakeProviderApi();
   }
diff --git a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaInfo.java b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaInfo.java
index ee09908..0e49d50 100644
--- a/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaInfo.java
+++ b/src/main/java/com/google/devtools/build/skydoc/fakebuildapi/java/FakeJavaInfo.java
@@ -117,11 +117,18 @@
   public static class FakeJavaInfoProvider implements JavaInfoProviderApi {
 
     @Override
-    public JavaInfoApi<?> javaInfo(FileApi outputJarApi, Object compileJarApi, Object sourceJarApi,
-        Boolean neverlink, SkylarkList<?> deps, SkylarkList<?> runtimeDeps, SkylarkList<?> exports,
-        Object actionsApi, Object sourcesApi, Object sourceJarsApi, Object useIjarApi,
-        Object javaToolchainApi, Object hostJavabaseApi, Object jdepsApi, Location loc,
-        Environment env) throws EvalException {
+    public JavaInfoApi<?> javaInfo(
+        FileApi outputJarApi,
+        Object compileJarApi,
+        Object sourceJarApi,
+        Boolean neverlink,
+        SkylarkList<?> deps,
+        SkylarkList<?> runtimeDeps,
+        SkylarkList<?> exports,
+        Object jdepsApi,
+        Location loc,
+        Environment env)
+        throws EvalException {
       return new FakeJavaInfo();
     }
 
diff --git a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
index c41d770..fa991d0 100644
--- a/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/packages/SkylarkSemanticsConsistencyTest.java
@@ -140,7 +140,6 @@
         "--incompatible_disable_third_party_license_checking=" + rand.nextBoolean(),
         "--incompatible_disallow_dict_plus=" + rand.nextBoolean(),
         "--incompatible_disallow_empty_glob=" + rand.nextBoolean(),
-        "--incompatible_disallow_legacy_javainfo=" + rand.nextBoolean(),
         "--incompatible_disallow_legacy_java_provider=" + rand.nextBoolean(),
         "--incompatible_disallow_old_style_args_add=" + rand.nextBoolean(),
         "--incompatible_disallow_rule_execution_platform_constraints_allowed=" + rand.nextBoolean(),
@@ -194,7 +193,6 @@
         .incompatibleDisableThirdPartyLicenseChecking(rand.nextBoolean())
         .incompatibleDisallowDictPlus(rand.nextBoolean())
         .incompatibleDisallowEmptyGlob(rand.nextBoolean())
-        .incompatibleDisallowLegacyJavaInfo(rand.nextBoolean())
         .incompatibleDisallowLegacyJavaProvider(rand.nextBoolean())
         .incompatibleDisallowOldStyleArgsAdd(rand.nextBoolean())
         .incompatibleDisallowRuleExecutionPlatformConstraintsAllowed(rand.nextBoolean())
diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/JavaInfoSkylarkApiTest.java b/src/test/java/com/google/devtools/build/lib/rules/java/JavaInfoSkylarkApiTest.java
index 7ac2224..5beea1d 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/java/JavaInfoSkylarkApiTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/java/JavaInfoSkylarkApiTest.java
@@ -26,37 +26,17 @@
 import com.google.devtools.build.lib.packages.StructImpl;
 import com.google.devtools.build.lib.rules.java.JavaRuleOutputJarsProvider.OutputJar;
 import com.google.devtools.build.lib.testutil.TestConstants;
-import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.runners.JUnit4;
 
 /** Tests JavaInfo API for Skylark. */
-@RunWith(Parameterized.class)
+@RunWith(JUnit4.class)
 public class JavaInfoSkylarkApiTest extends BuildViewTestCase {
 
   private static final String HOST_JAVA_RUNTIME_LABEL =
       TestConstants.TOOLS_REPOSITORY + "//tools/jdk:current_host_java_runtime";
 
-  @Parameters(name = "Use legacy JavaInfo constructor: {0}")
-  public static Iterable<Object[]> legacyJavaInfoConstructor() {
-    return ImmutableList.of(new Object[] {false}, new Object[] {true});
-  }
-
-  private final boolean legacyJavaInfoConstructor;
-
-  public JavaInfoSkylarkApiTest(boolean legacyJavaInfoConstructor) {
-    this.legacyJavaInfoConstructor = legacyJavaInfoConstructor;
-  }
-
-  @Before
-  public void setIncompatibleFlag() throws Exception {
-    if (legacyJavaInfoConstructor) {
-      setSkylarkSemanticsOptions("--noincompatible_disallow_legacy_javainfo");
-    }
-  }
-
   @Test
   public void buildHelperCreateJavaInfoWithOutputJarOnly() throws Exception {
     ruleBuilder().build();
@@ -630,11 +610,6 @@
 
   @Test
   public void buildHelperCreateJavaInfoWithOutputJarAndStampJar() throws Exception {
-    if (legacyJavaInfoConstructor) {
-      // Unsupported mode, don't test this
-      return;
-    }
-
     ruleBuilder().withStampJar().build();
 
     scratch.file(
@@ -693,32 +668,6 @@
     assertThat(ruleOutputs.getJdeps().prettyPrint()).isEqualTo("foo/my_jdeps.pb");
   }
 
-  @Test
-  public void testIncompatibleDisallowLegacyJavaInfo() throws Exception {
-    setSkylarkSemanticsOptions("--incompatible_disallow_legacy_javainfo");
-    ImmutableList.Builder<String> lines = ImmutableList.builder();
-    lines.add(
-        "result = provider()",
-        "def _impl(ctx):",
-        "  output_jar = ctx.actions.declare_file('output_jar')",
-        "  source_jar = ctx.actions.declare_file('source_jar')",
-        "  javaInfo = JavaInfo(",
-        "    output_jar = output_jar,",
-        "    source_jars = [source_jar],", // No longer allowed
-        "  )",
-        "  return [result(property = javaInfo)]",
-        "my_rule = rule(",
-        "  implementation = _impl,",
-        ")");
-    scratch.file("foo/extension.bzl", lines.build().toArray(new String[] {}));
-    checkError(
-        "foo",
-        "my_skylark_rule",
-        "Cannot use deprecated argument when --incompatible_disallow_legacy_javainfo is set",
-        "load(':extension.bzl', 'my_rule')",
-        "my_rule(name = 'my_skylark_rule')");
-  }
-
   private RuleBuilder ruleBuilder() {
     return new RuleBuilder();
   }
@@ -749,31 +698,6 @@
       return this;
     }
 
-    private String[] legacyJavaInfo() {
-      assertThat(stampJar).isFalse();
-      return new String[] {
-        "  javaInfo = JavaInfo(",
-        "    output_jar = ctx.outputs.output_jar, ",
-        useIJar ? "    use_ijar = True," : "    use_ijar = False,",
-        neverLink ? "    neverlink = True," : "",
-        "    source_jars = ctx.files.source_jars,",
-        "    sources = ctx.files.sources,",
-        "    deps = dp,",
-        "    runtime_deps = dp_runtime,",
-        "    exports = dp_exports,",
-        "    jdeps = ctx.file.jdeps,",
-        useIJar || sourceFiles ? "    actions = ctx.actions," : "",
-        useIJar || sourceFiles
-            ? "    java_toolchain = ctx.attr._toolchain[java_common.JavaToolchainInfo],"
-            : "",
-        sourceFiles
-            ? "    host_javabase = ctx.attr._host_javabase[java_common.JavaRuntimeInfo],"
-            : "",
-        "  )",
-        "  return [result(property = javaInfo)]"
-      };
-    }
-
     private String[] newJavaInfo() {
       assertThat(useIJar && stampJar).isFalse();
       ImmutableList.Builder<String> lines = ImmutableList.builder();
@@ -840,7 +764,7 @@
           "  dp = [dep[java_common.provider] for dep in ctx.attr.dep]",
           "  dp_runtime = [dep[java_common.provider] for dep in ctx.attr.dep_runtime]",
           "  dp_exports = [dep[java_common.provider] for dep in ctx.attr.dep_exports]");
-      lines.add(legacyJavaInfoConstructor ? legacyJavaInfo() : newJavaInfo());
+      lines.add(newJavaInfo());
       lines.add(
           "my_rule = rule(",
           "  implementation = _impl,",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java b/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
index 8662d36..dfdd9e0 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
@@ -1854,33 +1854,6 @@
     assertThat(javaToolchainLabel.toString()).isEqualTo("//java/com/google/test:toolchain");
   }
 
-  @Test
-  public void testIncompatibleDisallowLegacyJavaInfo() throws Exception {
-    setSkylarkSemanticsOptions("--incompatible_disallow_legacy_javainfo");
-    scratch.file(
-        "java/test/custom_rule.bzl",
-        "def _impl(ctx):",
-        "  jar = ctx.actions.declare_file('jar')",
-        "  java_common.create_provider(",
-        "      compile_time_jars = [jar],",
-        "      transitive_compile_time_jars = [jar],",
-        "      runtime_jars = [jar],",
-        "      use_ijar = False,",
-        "  )",
-        "java_custom_library = rule(",
-        "  implementation = _impl,",
-        ")");
-    checkError(
-        "java/test",
-        "custom",
-        "java_common.create_provider is deprecated and cannot be used when "
-            + "--incompatible_disallow_legacy_javainfo is set.",
-        "load(':custom_rule.bzl', 'java_custom_library')",
-        "java_custom_library(",
-        "  name = 'custom',",
-        ")");
-  }
-
   private static boolean javaCompilationArgsHaveTheSameParent(
       JavaCompilationArgsProvider args, JavaCompilationArgsProvider otherArgs) {
     if (!nestedSetsOfArtifactHaveTheSameParent(