[inclusive naming fixit] Rename uses of blacklist

This fixes most of the uses in code that are variable names and comments.
It does not address
- the the user visible flags and attribute names, specifically blacklisted_protos.
- some tests which depend on those visible names.

I probably missed a few cases. I intend to come back for those once this is in and I can look at the problem of renaming the attribute and migrating users. This CL just reduces future scope by doing the low-hanging fruit.

RELNOTE: None
PiperOrigin-RevId: 380083769
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/proto/BazelJavaProtoAspect.java b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/proto/BazelJavaProtoAspect.java
index a9e4f82e..d74eb5f 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/proto/BazelJavaProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/proto/BazelJavaProtoAspect.java
@@ -56,7 +56,7 @@
     }
 
     @Override
-    public NestedSet<Artifact> getBlacklist(RuleContext ruleContext) {
+    public NestedSet<Artifact> getForbiddenProtos(RuleContext ruleContext) {
       return NestedSetBuilder.emptySet(STABLE_ORDER);
     }
 
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
index 05d20a4..639f6b3 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPatternResolver.java
@@ -65,8 +65,8 @@
    * Computes the set containing the targets found below the given {@code directory}, passing it in
    * batches to {@code callback}. Conceptually, this method should look for all packages that start
    * with the {@code directory} (as a proper prefix directory, i.e., "foo/ba" is not a proper prefix
-   * of "foo/bar/"), and then collect all targets in each such package (subject to
-   * {@code rulesOnly}) as if calling {@link #getTargetsInPackage}. The specified directory is not
+   * of "foo/bar/"), and then collect all targets in each such package (subject to {@code
+   * rulesOnly}) as if calling {@link #getTargetsInPackage}. The specified directory is not
    * necessarily a valid package name.
    *
    * <p>Note that the {@code directory} can be empty, which corresponds to the "//..." pattern.
@@ -80,10 +80,10 @@
    * @param originalPattern the original target pattern for error reporting purposes
    * @param directory the directory in which to look for packages
    * @param rulesOnly whether to return rules only
-   * @param blacklistedSubdirectories a set of transitive subdirectories beneath {@code directory}
-   *    to ignore
-   * @param excludedSubdirectories another set of transitive subdirectories beneath
-   *    {@code directory} to ignore
+   * @param forbiddenSubdirectories a set of transitive subdirectories beneath {@code directory} to
+   *     ignore
+   * @param excludedSubdirectories another set of transitive subdirectories beneath {@code
+   *     directory} to ignore
    * @param callback the callback to receive the result, possibly in multiple batches.
    * @param exceptionClass The class type of the parameterized exception.
    * @throws TargetParsingException under implementation-specific failure conditions
@@ -93,7 +93,7 @@
       String originalPattern,
       String directory,
       boolean rulesOnly,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories,
       BatchCallback<T, E> callback,
       Class<E> exceptionClass)
@@ -109,21 +109,21 @@
       String originalPattern,
       String directory,
       boolean rulesOnly,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories,
       BatchCallback<T, E> callback,
       Class<E> exceptionClass,
       ListeningExecutorService executor) {
       try {
-        findTargetsBeneathDirectory(
-            repository,
-            originalPattern,
-            directory,
-            rulesOnly,
-            blacklistedSubdirectories,
-            excludedSubdirectories,
-            callback,
-            exceptionClass);
+      findTargetsBeneathDirectory(
+          repository,
+          originalPattern,
+          directory,
+          rulesOnly,
+          forbiddenSubdirectories,
+          excludedSubdirectories,
+          callback,
+          exceptionClass);
         return Futures.immediateFuture(null);
       } catch (TargetParsingException e) {
         return Futures.immediateFailedFuture(e);
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
index b4576de..63f9fbf 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/AndroidBinary.java
@@ -1339,7 +1339,7 @@
     TriState override = ruleContext.attributes().get("incremental_dexing", BuildType.TRISTATE);
     AndroidConfiguration config = AndroidCommon.getAndroidConfig(ruleContext);
     // Ignore --incremental_dexing if the incremental_dexing attribute is set, but require the
-    // attribute to be YES for proguarded binaries and binaries with blacklisted dexopts.
+    // attribute to be YES for proguarded binaries and binaries with forbidden dexopts.
     if (isBinaryProguarded
         && override == TriState.YES
         && config.incrementalDexingShardsAfterProguard() <= 0) {
@@ -1355,25 +1355,24 @@
       if (isBinaryProguarded) {
         return override == TriState.YES || config.incrementalDexingAfterProguardByDefault();
       }
-      Iterable<String> blacklistedDexopts =
-          DexArchiveAspect.blacklistedDexopts(ruleContext, dexopts);
-      if (Iterables.isEmpty(blacklistedDexopts)) {
+      Iterable<String> forbiddenDexopts = DexArchiveAspect.forbiddenDexopts(ruleContext, dexopts);
+      if (Iterables.isEmpty(forbiddenDexopts)) {
         // target's dexopts are all compatible with incremental dexing.
         return true;
       } else if (override == TriState.YES) {
-        // target's dexopts include flags blacklisted with --non_incremental_per_target_dexopts. If
+        // target's dexopts include forbidden flags with --non_incremental_per_target_dexopts. If
         // incremental_dexing attribute is explicitly set for this target then we'll warn and
         // incrementally dex anyway.  Otherwise, just don't incrementally dex.
         Iterable<String> ignored =
             Iterables.filter(
-                blacklistedDexopts,
+                forbiddenDexopts,
                 Predicates.not(Predicates.in(config.getDexoptsSupportedInIncrementalDexing())));
         ruleContext.attributeWarning(
             "incremental_dexing",
             String.format(
                 "Using incremental dexing even though dexopts %s indicate this target "
                     + "may be unsuitable for incremental dexing for the moment.%s",
-                blacklistedDexopts,
+                forbiddenDexopts,
                 Iterables.isEmpty(ignored) ? "" : " Ignored dexopts: " + ignored));
         return true;
       } else {
@@ -2009,8 +2008,8 @@
       // Native mode is not supported by Android devices running Android before v21.
       String runtime =
           AndroidSdkProvider.fromRuleContext(ruleContext).getAndroidJar().getExecPathString();
-      for (String blacklistedRuntime : RUNTIMES_THAT_DONT_SUPPORT_NATIVE_MULTIDEXING) {
-        if (runtime.contains(blacklistedRuntime)) {
+      for (String forbiddenRuntime : RUNTIMES_THAT_DONT_SUPPORT_NATIVE_MULTIDEXING) {
+        if (runtime.contains(forbiddenRuntime)) {
           return false;
         }
       }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
index 181fd3a..f81fbd5 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/android/DexArchiveAspect.java
@@ -621,10 +621,10 @@
   }
 
   /**
-   * Returns the subset of the given dexopts that are blacklisted from using incremental dexing by
+   * Returns the subset of the given dexopts that are forbidden from using incremental dexing by
    * default.
    */
-  static Iterable<String> blacklistedDexopts(RuleContext ruleContext, List<String> dexopts) {
+  static Iterable<String> forbiddenDexopts(RuleContext ruleContext, List<String> dexopts) {
     return Iterables.filter(
         dexopts,
         new FlagMatcher(
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
index 56217ae..051cc2f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/CcProtoAspect.java
@@ -68,7 +68,7 @@
 import com.google.devtools.build.lib.rules.proto.ProtoConfiguration;
 import com.google.devtools.build.lib.rules.proto.ProtoInfo;
 import com.google.devtools.build.lib.rules.proto.ProtoLangToolchainProvider;
-import com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist;
+import com.google.devtools.build.lib.rules.proto.ProtoSourceFileExcludeList;
 import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData;
 import com.google.devtools.build.lib.vfs.FileSystemUtils;
 import com.google.devtools.build.lib.vfs.PathFragment;
@@ -176,8 +176,8 @@
 
       // Compute and register files generated by this proto library.
       Collection<Artifact> outputs = new ArrayList<>();
-      if (areSrcsBlacklisted()) {
-        registerBlacklistedSrcs(protoInfo, protoConfiguration, compilationHelper);
+      if (areSrcsExcluded()) {
+        registerExcludedSrcs(protoInfo, protoConfiguration, compilationHelper);
         headerProvider = null;
       } else if (!protoInfo.getDirectProtoSources().isEmpty()) {
         Collection<Artifact> headers =
@@ -282,9 +282,9 @@
       }
     }
 
-    private boolean areSrcsBlacklisted() {
-      return !new ProtoSourceFileBlacklist(
-              ruleContext, getProtoToolchainProvider().blacklistedProtos())
+    private boolean areSrcsExcluded() {
+      return !new ProtoSourceFileExcludeList(
+              ruleContext, getProtoToolchainProvider().forbiddenProtos())
           .checkSrcs(protoInfo.getOriginalDirectProtoSources(), "cc_proto_library");
     }
 
@@ -295,7 +295,7 @@
       unsupportedFeatures.addAll(ruleContext.getDisabledFeatures());
       unsupportedFeatures.add(CppRuleClasses.PARSE_HEADERS);
       unsupportedFeatures.add(CppRuleClasses.LAYERING_CHECK);
-      if (!areSrcsBlacklisted() && !protoInfo.getDirectProtoSources().isEmpty()) {
+      if (!areSrcsExcluded() && !protoInfo.getDirectProtoSources().isEmpty()) {
         requestedFeatures.add(CppRuleClasses.HEADER_MODULES);
       } else {
         unsupportedFeatures.add(CppRuleClasses.HEADER_MODULES);
@@ -414,7 +414,7 @@
       return result.build();
     }
 
-    private static void registerBlacklistedSrcs(
+    private static void registerExcludedSrcs(
         ProtoInfo protoInfo, ProtoConfiguration protoConfiguration, CcCompilationHelper helper) {
       // Hack: This is a proto_library for descriptor.proto or similar.
       //
@@ -422,7 +422,7 @@
       // cc_library rules that export them in their 'hdrs' attribute, and compile them as header
       // module if requested.
       //
-      // The sole purpose of a proto_library with blacklisted srcs is so other proto_library rules
+      // The sole purpose of a proto_library with forbidden srcs is so other proto_library rules
       // can import them from a protocol buffer, as proto_library rules can only depend on other
       // proto library rules.
       ImmutableList.Builder<PathFragment> headers = new ImmutableList.Builder<>();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/ProtoCcHeaderProvider.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/ProtoCcHeaderProvider.java
index b36055a..cf07aec 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/ProtoCcHeaderProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/proto/ProtoCcHeaderProvider.java
@@ -31,7 +31,7 @@
   /**
    * @return the headers of the proto library for C++.
    *     <p>Normally these are the headers generated by the proto compiler for C++; only in case of
-   *     a proto_library with blacklisted srcs will these be files from the source tree.
+   *     a proto_library with forbidden srcs will these be files from the source tree.
    */
   public NestedSet<Artifact> getHeaders() {
     return headers;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java b/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
index 50678a6..883e7d9 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/filegroup/Filegroup.java
@@ -48,7 +48,7 @@
  */
 public class Filegroup implements RuleConfiguredTargetFactory {
 
-  /** Error message for output groups that are explicitly blacklisted for filegroup reference. */
+  /** Error message for output groups that are explicitly forbidden from filegroup reference. */
   public static final String ILLEGAL_OUTPUT_GROUP_ERROR =
       "Output group %s is not permitted for " + "reference in filegroups.";
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
index f9e5a7607..f794dbd 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/JavaProtoAspect.java
@@ -52,7 +52,7 @@
 import com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder.ToolchainInvocation;
 import com.google.devtools.build.lib.rules.proto.ProtoConfiguration;
 import com.google.devtools.build.lib.rules.proto.ProtoInfo;
-import com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist;
+import com.google.devtools.build.lib.rules.proto.ProtoSourceFileExcludeList;
 import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData;
 
 /** An Aspect which JavaProtoLibrary injects to build Java SPEED protos. */
@@ -277,14 +277,14 @@
         return false;
       }
 
-      final ProtoSourceFileBlacklist protoBlackList;
-      NestedSetBuilder<Artifact> blacklistedProtos = NestedSetBuilder.stableOrder();
-      blacklistedProtos.addTransitive(aspectCommon.getProtoToolchainProvider().blacklistedProtos());
-      blacklistedProtos.addTransitive(rpcSupport.getBlacklist(ruleContext));
+      NestedSetBuilder<Artifact> forbiddenProtos = NestedSetBuilder.stableOrder();
+      forbiddenProtos.addTransitive(aspectCommon.getProtoToolchainProvider().forbiddenProtos());
+      forbiddenProtos.addTransitive(rpcSupport.getForbiddenProtos(ruleContext));
 
-      protoBlackList = new ProtoSourceFileBlacklist(ruleContext, blacklistedProtos.build());
+      final ProtoSourceFileExcludeList protoExcludeList =
+          new ProtoSourceFileExcludeList(ruleContext, forbiddenProtos.build());
 
-      return protoBlackList.checkSrcs(
+      return protoExcludeList.checkSrcs(
           protoInfo.getOriginalDirectProtoSources(), "java_proto_library");
     }
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/proto/RpcSupport.java b/src/main/java/com/google/devtools/build/lib/rules/java/proto/RpcSupport.java
index 7d96ec6..7f98946 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/proto/RpcSupport.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/proto/RpcSupport.java
@@ -31,7 +31,7 @@
 
   boolean allowServices(RuleContext ruleContext);
 
-  NestedSet<Artifact> getBlacklist(RuleContext ruleContext);
+  NestedSet<Artifact> getForbiddenProtos(RuleContext ruleContext);
 
   ImmutableList<TransitiveInfoCollection> getRuntimes(RuleContext ruleContext);
 
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
index 978fc9f..9487f32 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/objc/J2ObjcAspect.java
@@ -78,7 +78,7 @@
 import com.google.devtools.build.lib.rules.proto.ProtoConfiguration;
 import com.google.devtools.build.lib.rules.proto.ProtoInfo;
 import com.google.devtools.build.lib.rules.proto.ProtoLangToolchainProvider;
-import com.google.devtools.build.lib.rules.proto.ProtoSourceFileBlacklist;
+import com.google.devtools.build.lib.rules.proto.ProtoSourceFileExcludeList;
 import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData;
 import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
 import com.google.devtools.build.lib.util.FileType;
@@ -380,9 +380,9 @@
 
     ProtoLangToolchainProvider protoToolchain =
         ruleContext.getPrerequisite(J2OBJC_PROTO_TOOLCHAIN_ATTR, ProtoLangToolchainProvider.class);
-    // Avoid pulling in any generated files from blacklisted protos.
-    ProtoSourceFileBlacklist protoBlacklist =
-        new ProtoSourceFileBlacklist(ruleContext, protoToolchain.blacklistedProtos());
+    // Avoid pulling in any generated files from forbidden protos.
+    ProtoSourceFileExcludeList protoBlacklist =
+        new ProtoSourceFileExcludeList(ruleContext, protoToolchain.forbiddenProtos());
 
     ImmutableList<Artifact> filteredProtoSources =
         ImmutableList.copyOf(protoBlacklist.filter(protoSources));
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
index bea457f..64e5938 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoCompileActionBuilder.java
@@ -353,7 +353,7 @@
             "--descriptor_set_out=$(OUT)",
             /* pluginExecutable= */ null,
             /* runtime= */ null,
-            /* blacklistedProtos= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER)),
+            /* forbiddenProtos= */ NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER)),
         outReplacement,
         protocOpts.build());
   }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchain.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchain.java
index e5911c7..96dda1f 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchain.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchain.java
@@ -33,10 +33,10 @@
   @Override
   public ConfiguredTarget create(RuleContext ruleContext)
       throws InterruptedException, RuleErrorException, ActionConflictException {
-    NestedSetBuilder<Artifact> blacklistedProtos = NestedSetBuilder.stableOrder();
+    NestedSetBuilder<Artifact> forbiddenProtos = NestedSetBuilder.stableOrder();
     for (ProtoInfo protoInfo :
         ruleContext.getPrerequisites("blacklisted_protos", ProtoInfo.PROVIDER)) {
-      blacklistedProtos.addTransitive(protoInfo.getOriginalTransitiveProtoSources());
+      forbiddenProtos.addTransitive(protoInfo.getOriginalTransitiveProtoSources());
     }
 
     return new RuleConfiguredTargetBuilder(ruleContext)
@@ -45,7 +45,7 @@
                 ruleContext.attributes().get("command_line", Type.STRING),
                 ruleContext.getPrerequisite("plugin", FilesToRunProvider.class),
                 ruleContext.getPrerequisite("runtime"),
-                blacklistedProtos.build()))
+                forbiddenProtos.build()))
         .setFilesToBuild(NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER))
         .addProvider(RunfilesProvider.simple(Runfiles.EMPTY))
         .build();
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainProvider.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainProvider.java
index c0b6810..23c310c 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoLangToolchainProvider.java
@@ -40,15 +40,23 @@
   @Nullable
   public abstract TransitiveInfoCollection runtime();
 
-  public abstract NestedSet<Artifact> blacklistedProtos();
+  /**
+   * This makes the blacklisted_protos member available in the provider. It can be removed after
+   * users are migrated and a sufficient time for Bazel rules to migrate has elapsed.
+   */
+  public NestedSet<Artifact> blacklistedProtos() {
+    return forbiddenProtos();
+  }
+
+  public abstract NestedSet<Artifact> forbiddenProtos();
 
   @AutoCodec.Instantiator
   public static ProtoLangToolchainProvider create(
       String commandLine,
       FilesToRunProvider pluginExecutable,
       TransitiveInfoCollection runtime,
-      NestedSet<Artifact> blacklistedProtos) {
+      NestedSet<Artifact> forbiddenProtos) {
     return new AutoValue_ProtoLangToolchainProvider(
-        commandLine, pluginExecutable, runtime, blacklistedProtos);
+        commandLine, pluginExecutable, runtime, forbiddenProtos);
   }
 }
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSource.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSource.java
index d52e0c0..754c375 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSource.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSource.java
@@ -42,7 +42,7 @@
     return sourceFile;
   }
 
-  /** Returns the original source file. Only for blacklisting protos! */
+  /** Returns the original source file. Only for forbidding protos! */
   @Deprecated
   Artifact getOriginalSourceFile() {
     return originalSourceFile;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileExcludeList.java
similarity index 68%
rename from src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java
rename to src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileExcludeList.java
index 0671e1f..8647d4b 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileBlacklist.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/proto/ProtoSourceFileExcludeList.java
@@ -33,54 +33,51 @@
 import java.util.List;
 
 /**
- * A blacklist of proto source files.
+ * A list proto source files to be excluded from code generation.
  *
  * <p>There are cases where we need to identify proto files that we should not create generated
  * files for. For example, we should not create generated code for google/protobuf/any.proto, which
- * is already baked into the language support libraries. This class provides us with the ability
- * to identify these proto files and avoid linking in their associated generated files.
+ * is already baked into the language support libraries. This class provides us with the ability to
+ * identify these proto files and avoid linking in their associated generated files.
  */
-public class ProtoSourceFileBlacklist {
+public class ProtoSourceFileExcludeList {
   private static final PathFragment BAZEL_TOOLS_PREFIX =
       PathFragment.create("external/bazel_tools/");
   private final RuleContext ruleContext;
-  private final ImmutableSet<PathFragment> blacklistProtoFilePaths;
+  private final ImmutableSet<PathFragment> noGenerateProtoFilePaths;
 
   /**
-   * Creates a proto source file blacklist.
+   * Creates a proto source file exclusion list.
    *
    * @param ruleContext the proto rule context.
-   * @param blacklistProtoFiles a list of blacklisted .proto files. The list will be iterated.
-   *     protos.
+   * @param noGenerateProtoFiles a list of .proto files. The list will be iterated.
    */
-  public ProtoSourceFileBlacklist(
-      RuleContext ruleContext, NestedSet<Artifact> blacklistProtoFiles) {
+  public ProtoSourceFileExcludeList(
+      RuleContext ruleContext, NestedSet<Artifact> noGenerateProtoFiles) {
     this.ruleContext = ruleContext;
-    ImmutableSet.Builder<PathFragment> blacklistProtoFilePathsBuilder =
+    ImmutableSet.Builder<PathFragment> noGenerateProtoFilePathsBuilder =
         new ImmutableSet.Builder<>();
-    for (Artifact blacklistProtoFile : blacklistProtoFiles.toList()) {
-      PathFragment execPath = blacklistProtoFile.getExecPath();
-      // For blacklisted protos bundled with the Bazel tools repository, their exec paths start
+    for (Artifact noGenerateProtoFile : noGenerateProtoFiles.toList()) {
+      PathFragment execPath = noGenerateProtoFile.getExecPath();
+      // For listed protos bundled with the Bazel tools repository, their exec paths start
       // with external/bazel_tools/. This prefix needs to be removed first, because the protos in
       // user repositories will not have that prefix.
       if (execPath.startsWith(BAZEL_TOOLS_PREFIX)) {
-        blacklistProtoFilePathsBuilder.add(execPath.relativeTo(BAZEL_TOOLS_PREFIX));
+        noGenerateProtoFilePathsBuilder.add(execPath.relativeTo(BAZEL_TOOLS_PREFIX));
       } else {
-        blacklistProtoFilePathsBuilder.add(execPath);
+        noGenerateProtoFilePathsBuilder.add(execPath);
       }
     }
-    blacklistProtoFilePaths = blacklistProtoFilePathsBuilder.build();
+    noGenerateProtoFilePaths = noGenerateProtoFilePathsBuilder.build();
   }
 
-  /**
-   * Filters the blacklisted protos from the given protos.
-   */
+  /** Filters the listed protos from the given protos. */
   public Iterable<Artifact> filter(Iterable<Artifact> protoFiles) {
     return Streams.stream(protoFiles).filter(f -> !isBlacklisted(f)).collect(toImmutableSet());
   }
 
   /**
-   * Checks the proto sources for mixing blacklisted and non-blacklisted protos in one single
+   * Checks the proto sources for mixing excluded and non-excluded protos in one single
    * proto_library rule. Registers an attribute error if proto mixing is detected.
    *
    * @param protoFiles the protos to filter.
@@ -88,39 +85,38 @@
    * @return whether the proto sources are clean without mixing.
    */
   public boolean checkSrcs(Iterable<Artifact> protoFiles, String topLevelProtoRuleName) {
-    List<Artifact> blacklisted = new ArrayList<>();
-    List<Artifact> nonBlacklisted = new ArrayList<>();
+    List<Artifact> excluded = new ArrayList<>();
+    List<Artifact> nonExcluded = new ArrayList<>();
     for (Artifact protoFile : protoFiles) {
       if (isBlacklisted(protoFile)) {
-        blacklisted.add(protoFile);
+        excluded.add(protoFile);
       } else {
-        nonBlacklisted.add(protoFile);
+        nonExcluded.add(protoFile);
       }
     }
-    if (!nonBlacklisted.isEmpty() && !blacklisted.isEmpty()) {
+    if (!nonExcluded.isEmpty() && !excluded.isEmpty()) {
       ruleContext.attributeError(
           "srcs",
           createBlacklistedProtosMixError(
-              Artifact.toRootRelativePaths(blacklisted),
-              Artifact.toRootRelativePaths(nonBlacklisted),
+              Artifact.toRootRelativePaths(excluded),
+              Artifact.toRootRelativePaths(nonExcluded),
               ruleContext.getLabel().toString(),
               topLevelProtoRuleName));
     }
 
-    return blacklisted.isEmpty();
+    return excluded.isEmpty();
   }
 
-  /**
-   * Returns whether the given proto file is blacklisted.
-   */
+  /** Returns whether the given proto file is excluded. */
   public boolean isBlacklisted(Artifact protoFile) {
-    return blacklistProtoFilePaths.contains(protoFile.getExecPath());
+    return noGenerateProtoFilePaths.contains(protoFile.getExecPath());
   }
 
   /**
    * Returns an attribute for the implicit dependency on blacklist proto filegroups.
+   *
    * @param attributeName the name of the attribute.
-   * @param blacklistFileGroups a list of labels pointin to the filegroups containing blacklisted
+   * @param blacklistFileGroups a list of labels pointin to the filegroups containing excluded
    *     protos.
    */
   public static Attribute.Builder<List<Label>> blacklistFilegroupAttribute(
@@ -132,7 +128,9 @@
 
   @VisibleForTesting
   public static String createBlacklistedProtosMixError(
-      Iterable<String> blacklisted, Iterable<String> nonBlacklisted, String protoLibraryRuleLabel,
+      Iterable<String> excluded,
+      Iterable<String> nonExcluded,
+      String protoLibraryRuleLabel,
       String topLevelProtoRuleName) {
     return String.format(
         "The 'srcs' attribute of '%s' contains protos for which '%s' "
@@ -140,7 +138,7 @@
             + "Separate '%1$s' into 2 proto_library rules.",
         protoLibraryRuleLabel,
         topLevelProtoRuleName,
-        Joiner.on(", ").join(blacklisted),
-        Joiner.on(", ").join(nonBlacklisted));
+        Joiner.on(", ").join(excluded),
+        Joiner.on(", ").join(nonExcluded));
   }
 }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/LocalDiffAwareness.java b/src/main/java/com/google/devtools/build/lib/skyframe/LocalDiffAwareness.java
index 60aea27..7d1f578 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/LocalDiffAwareness.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/LocalDiffAwareness.java
@@ -69,15 +69,15 @@
 
   /** Factory for creating {@link LocalDiffAwareness} instances. */
   public static class Factory implements DiffAwareness.Factory {
-    private final ImmutableList<String> prefixBlacklist;
+    private final ImmutableList<String> excludedNetworkFileSystemsPrefixes;
 
     /**
      * Creates a new factory; the file system watcher may not work on all file systems, particularly
-     * for network file systems. The prefix blacklist can be used to blacklist known paths that
-     * point to network file systems.
+     * for network file systems. The prefix list can be used to exclude known paths that point to
+     * network file systems.
      */
-    public Factory(ImmutableList<String> prefixBlacklist) {
-      this.prefixBlacklist = prefixBlacklist;
+    public Factory(ImmutableList<String> excludedNetworkFileSystemsPrefixes) {
+      this.excludedNetworkFileSystemsPrefixes = excludedNetworkFileSystemsPrefixes;
     }
 
     @Override
@@ -91,7 +91,7 @@
       PathFragment resolvedPathEntryFragment = resolvedPathEntry.asFragment();
       // There's no good way to automatically detect network file systems. We rely on a blacklist
       // for now (and maybe add a command-line option in the future?).
-      for (String prefix : prefixBlacklist) {
+      for (String prefix : excludedNetworkFileSystemsPrefixes) {
         if (resolvedPathEntryFragment.startsWith(PathFragment.create(prefix))) {
           return null;
         }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
index 471d806..f325af9 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RecursivePackageProviderBackedTargetPatternResolver.java
@@ -183,7 +183,7 @@
       final String originalPattern,
       String directory,
       boolean rulesOnly,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories,
       BatchCallback<Target, E> callback,
       Class<E> exceptionClass)
@@ -194,7 +194,7 @@
               originalPattern,
               directory,
               rulesOnly,
-              blacklistedSubdirectories,
+              forbiddenSubdirectories,
               excludedSubdirectories,
               callback,
               MoreExecutors.newDirectExecutorService())
@@ -211,7 +211,7 @@
       String originalPattern,
       String directory,
       boolean rulesOnly,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories,
       BatchCallback<Target, E> callback,
       Class<E> exceptionClass,
@@ -221,7 +221,7 @@
         originalPattern,
         directory,
         rulesOnly,
-        blacklistedSubdirectories,
+        forbiddenSubdirectories,
         excludedSubdirectories,
         callback,
         executor);
@@ -232,7 +232,7 @@
       String pattern,
       String directory,
       boolean rulesOnly,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories,
       BatchCallback<Target, E> callback,
       ListeningExecutorService executor) {
@@ -256,7 +256,7 @@
           eventHandler,
           repository,
           pathFragment,
-          blacklistedSubdirectories,
+          forbiddenSubdirectories,
           excludedSubdirectories);
     } catch (TargetParsingException | QueryException e) {
       return Futures.immediateFailedFuture(e);
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/RootPackageExtractor.java b/src/main/java/com/google/devtools/build/lib/skyframe/RootPackageExtractor.java
index 65a4fa2..d77e938 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/RootPackageExtractor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/RootPackageExtractor.java
@@ -29,8 +29,8 @@
 public interface RootPackageExtractor {
 
   /**
-   * Recursively search each of the given roots in a repository for packages (while respecting
-   * blacklists and exclusions), calling the {@code results} callback as each package is discovered.
+   * Recursively search each of the given roots in a repository for packages (while respecting deny
+   * lists and exclusions), calling the {@code results} callback as each package is discovered.
    *
    * @param results callback invoked once for groups of packages as they are discovered under a root
    * @param graph skyframe graph used for retrieving the directories under each root
@@ -38,8 +38,8 @@
    * @param eventHandler receives package-loading errors for any packages loaded by graph queries
    * @param repository the repository under which the roots can be found
    * @param directory starting directory under which to find packages, relative to the roots
-   * @param blacklistedSubdirectories directories that will not be searched by policy, relative to
-   *     the roots
+   * @param forbiddenSubdirectories directories that will not be searched by policy, relative to the
+   *     roots
    * @param excludedSubdirectories directories the user requests not be searched, relative to the
    *     roots
    * @throws InterruptedException if a graph query is interrupted before all roots have been
@@ -52,7 +52,7 @@
       ExtendedEventHandler eventHandler,
       RepositoryName repository,
       PathFragment directory,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories)
       throws InterruptedException, QueryException;
 }
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TraversalInfoRootPackageExtractor.java b/src/main/java/com/google/devtools/build/lib/skyframe/TraversalInfoRootPackageExtractor.java
index ec89243..85f5d05 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/TraversalInfoRootPackageExtractor.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/TraversalInfoRootPackageExtractor.java
@@ -59,14 +59,14 @@
       ExtendedEventHandler eventHandler,
       RepositoryName repository,
       PathFragment directory,
-      ImmutableSet<PathFragment> blacklistedSubdirectories,
+      ImmutableSet<PathFragment> forbiddenSubdirectories,
       ImmutableSet<PathFragment> excludedSubdirectories)
       throws InterruptedException {
     TreeSet<TraversalInfo> dirsToCheckForPackages = new TreeSet<>(TRAVERSAL_INFO_COMPARATOR);
     for (Root root : roots) {
       RootedPath rootedDir = RootedPath.toRootedPath(root, directory);
       dirsToCheckForPackages.add(
-          new TraversalInfo(rootedDir, blacklistedSubdirectories, excludedSubdirectories));
+          new TraversalInfo(rootedDir, forbiddenSubdirectories, excludedSubdirectories));
     }
     PackageCollectingParallelVisitor visitor =
         new PackageCollectingParallelVisitor(
@@ -146,7 +146,7 @@
         traversalToKeyMapBuilder.put(
             traversalInfo,
             CollectPackagesUnderDirectoryValue.key(
-                repository, traversalInfo.rootedDir, traversalInfo.blacklistedSubdirectories));
+                repository, traversalInfo.rootedDir, traversalInfo.forbiddenSubdirectories));
       }
       ImmutableMap<TraversalInfo, SkyKey> traversalToKeyMap = traversalToKeyMapBuilder.build();
       Map<SkyKey, SkyValue> values = graph.getSuccessfulValues(traversalToKeyMap.values());
@@ -174,8 +174,8 @@
           for (RootedPath subdirectory : subdirectoryTransitivelyContainsPackages.keySet()) {
             if (subdirectoryTransitivelyContainsPackages.get(subdirectory)) {
               PathFragment subdirectoryRelativePath = subdirectory.getRootRelativePath();
-              ImmutableSet<PathFragment> blacklistedSubdirectoriesBeneathThisSubdirectory =
-                  info.blacklistedSubdirectories.stream()
+              ImmutableSet<PathFragment> forbiddenSubdirectoriesBeneathThisSubdirectory =
+                  info.forbiddenSubdirectories.stream()
                       .filter(pathFragment -> pathFragment.startsWith(subdirectoryRelativePath))
                       .collect(toImmutableSet());
               ImmutableSet<PathFragment> excludedSubdirectoriesBeneathThisSubdirectory =
@@ -187,7 +187,7 @@
                 subdirsToCheckForPackages.add(
                     new TraversalInfo(
                         subdirectory,
-                        blacklistedSubdirectoriesBeneathThisSubdirectory,
+                        forbiddenSubdirectoriesBeneathThisSubdirectory,
                         excludedSubdirectoriesBeneathThisSubdirectory));
               }
             }
@@ -213,11 +213,11 @@
   /** Value type used as visitation and output key for {@link PackageCollectingParallelVisitor}. */
   private static final class TraversalInfo {
     final RootedPath rootedDir;
-    // Set of blacklisted directories. The graph is assumed to be prepopulated with
-    // CollectPackagesUnderDirectoryValue nodes whose keys have blacklisted packages embedded in
+    // Set of forbidden directories. The graph is assumed to be prepopulated with
+    // CollectPackagesUnderDirectoryValue nodes whose keys have forbidden packages embedded in
     // them. Therefore, we need to be careful to request and use the same sort of keys here in our
     // traversal.
-    final ImmutableSet<PathFragment> blacklistedSubdirectories;
+    final ImmutableSet<PathFragment> forbiddenSubdirectories;
     // Set of directories, targets under which should be excluded from the traversal results.
     // Excluded directory information isn't part of the graph keys in the prepopulated graph, so we
     // need to perform the filtering ourselves.
@@ -225,16 +225,16 @@
 
     private TraversalInfo(
         RootedPath rootedDir,
-        ImmutableSet<PathFragment> blacklistedSubdirectories,
+        ImmutableSet<PathFragment> forbiddenSubdirectories,
         ImmutableSet<PathFragment> excludedSubdirectories) {
       this.rootedDir = rootedDir;
-      this.blacklistedSubdirectories = blacklistedSubdirectories;
+      this.forbiddenSubdirectories = forbiddenSubdirectories;
       this.excludedSubdirectories = excludedSubdirectories;
     }
 
     @Override
     public int hashCode() {
-      return Objects.hashCode(rootedDir, blacklistedSubdirectories, excludedSubdirectories);
+      return Objects.hashCode(rootedDir, forbiddenSubdirectories, excludedSubdirectories);
     }
 
     @Override
@@ -245,7 +245,7 @@
       if (obj instanceof TraversalInfo) {
         TraversalInfo otherTraversal = (TraversalInfo) obj;
         return Objects.equal(rootedDir, otherTraversal.rootedDir)
-            && Objects.equal(blacklistedSubdirectories, otherTraversal.blacklistedSubdirectories)
+            && Objects.equal(forbiddenSubdirectories, otherTraversal.forbiddenSubdirectories)
             && Objects.equal(excludedSubdirectories, otherTraversal.excludedSubdirectories);
       }
       return false;
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/AutoRegistry.java b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/AutoRegistry.java
index 7583b42..41e03da 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/AutoRegistry.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/AutoRegistry.java
@@ -41,7 +41,7 @@
         || name.startsWith("net.starlark.java");
   }
 
-  /** Class name prefixes to blacklist for {@link DynamicCodec}. */
+  /** Class name prefixes to forbid for {@link DynamicCodec}. */
   private static final ImmutableList<String> CLASS_NAME_PREFIX_BLACKLIST =
       ImmutableList.of(
           "com.google.devtools.build.lib.google",
@@ -90,7 +90,7 @@
         registry.addReferenceConstant(constant);
       }
       for (String classNamePrefix : CLASS_NAME_PREFIX_BLACKLIST) {
-        registry.blacklistClassNamePrefix(classNamePrefix);
+        registry.excludeClassNamePrefix(classNamePrefix);
       }
       return registry.build();
     } catch (IOException | ReflectiveOperationException e) {
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistry.java b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistry.java
index 2912e2a..1d8d95b 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistry.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/ObjectCodecRegistry.java
@@ -62,7 +62,7 @@
       ImmutableSet<ObjectCodec<?>> memoizingCodecs,
       ImmutableList<Object> referenceConstants,
       ImmutableSortedSet<String> classNames,
-      ImmutableList<String> blacklistedClassNamePrefixes,
+      ImmutableList<String> excludedClassNamePrefixes,
       boolean allowDefaultCodec) {
     this.allowDefaultCodec = allowDefaultCodec;
 
@@ -84,9 +84,8 @@
     this.referenceConstants = referenceConstants;
 
     this.classNames =
-        classNames
-            .stream()
-            .filter((str) -> isAllowed(str, blacklistedClassNamePrefixes))
+        classNames.stream()
+            .filter((str) -> isAllowed(str, excludedClassNamePrefixes))
             .collect(ImmutableList.toImmutableList());
     this.dynamicCodecs = createDynamicCodecs(this.classNames, nextTag);
   }
@@ -253,8 +252,7 @@
     private final Map<Class<?>, ObjectCodec<?>> codecs = new HashMap<>();
     private final ImmutableList.Builder<Object> referenceConstantsBuilder = ImmutableList.builder();
     private final ImmutableSortedSet.Builder<String> classNames = ImmutableSortedSet.naturalOrder();
-    private final ImmutableList.Builder<String> blacklistedClassNamePrefixes =
-        ImmutableList.builder();
+    private final ImmutableList.Builder<String> excludedClassNamePrefixes = ImmutableList.builder();
     private boolean allowDefaultCodec = true;
 
     /**
@@ -311,8 +309,8 @@
       return this;
     }
 
-    public Builder blacklistClassNamePrefix(String classNamePrefix) {
-      blacklistedClassNamePrefixes.add(classNamePrefix);
+    public Builder excludeClassNamePrefix(String classNamePrefix) {
+      excludedClassNamePrefixes.add(classNamePrefix);
       return this;
     }
 
@@ -321,7 +319,7 @@
           ImmutableSet.copyOf(codecs.values()),
           referenceConstantsBuilder.build(),
           classNames.build(),
-          blacklistedClassNamePrefixes.build(),
+          excludedClassNamePrefixes.build(),
           allowDefaultCodec);
     }
   }
@@ -357,9 +355,9 @@
   }
 
   private static boolean isAllowed(
-      String className, ImmutableList<String> blacklistedClassNamePefixes) {
-    for (String blacklistedClassNamePrefix : blacklistedClassNamePefixes) {
-      if (className.startsWith(blacklistedClassNamePrefix)) {
+      String className, ImmutableList<String> excludedClassNamePefixes) {
+    for (String excludedClassNamePrefix : excludedClassNamePefixes) {
+      if (className.startsWith(excludedClassNamePrefix)) {
         return false;
       }
     }
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileAccessException.java b/src/main/java/com/google/devtools/build/lib/vfs/FileAccessException.java
index ae708e5..360bcc0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileAccessException.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileAccessException.java
@@ -42,7 +42,7 @@
   /**
    * Codec for {@link FileAccessException}.
    *
-   * <p>{@link com.google.devtools.build.lib.skyframe.serialization.AutoRegistry} blacklists the
+   * <p>{@link com.google.devtools.build.lib.skyframe.serialization.AutoRegistry} excludes the
    * entire com.google.devtools.build.lib.vfs java package from having DynamicCodec support.
    * Therefore, we need to provide our own codec for @link FileAccessException}.
    */