[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/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;
}
}