diff --git a/src/main/starlark/builtins_bzl/common/java/java_common_internal_for_builtins.bzl b/src/main/starlark/builtins_bzl/common/java/java_common_internal_for_builtins.bzl index d052c932ddb29d..e9115d85643863 100644 --- a/src/main/starlark/builtins_bzl/common/java/java_common_internal_for_builtins.bzl +++ b/src/main/starlark/builtins_bzl/common/java/java_common_internal_for_builtins.bzl @@ -134,15 +134,16 @@ def compile( ["-Abazel.repository=" + ctx.label.workspace_name], order = "preorder", )) - system_override = False + system_bootclasspath = None for package_config in java_toolchain._package_configuration: if package_config.matches(ctx.label): all_javac_opts.append(package_config.javac_opts) if package_config.system: - if system_override: + if system_bootclasspath: fail("Multiple system package configurations found for %s" % ctx.label) - bootclasspath = package_config.system - system_override = True + system_bootclasspath = package_config.system + if not bootclasspath: + bootclasspath = system_bootclasspath all_javac_opts.append(depset( ["--add-exports=%s=ALL-UNNAMED" % x for x in add_exports],