Replace more usages of DigestHashFunction#getDefaultUnchecked() by explicit statements.
PiperOrigin-RevId: 330583533
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java
index e283291..abe9f8a 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/BzlLoadFunction.java
@@ -22,6 +22,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.flogger.GoogleLogger;
+import com.google.common.hash.HashFunction;
import com.google.devtools.build.lib.actions.InconsistentFilesystemException;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.LabelConstants;
@@ -54,7 +55,6 @@
import com.google.devtools.build.lib.syntax.Statement;
import com.google.devtools.build.lib.util.Fingerprint;
import com.google.devtools.build.lib.util.Pair;
-import com.google.devtools.build.lib.vfs.DigestHashFunction;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.RecordingSkyFunctionEnvironment;
import com.google.devtools.build.skyframe.SkyFunction;
@@ -116,7 +116,7 @@
public static BzlLoadFunction create(
PackageFactory packageFactory,
- DigestHashFunction digestHashFunction,
+ HashFunction hashFunction,
Cache<ASTFileLookupValue.Key, ASTFileLookupValue> astFileLookupValueCache) {
return new BzlLoadFunction(
packageFactory,
@@ -143,8 +143,7 @@
// just a temporary thing for bzl execution. Retaining it forever is pure waste.
// (b) The memory overhead of the extra Skyframe node and edge per bzl file is pure
// waste.
- new InliningAndCachingASTManager(
- packageFactory, digestHashFunction, astFileLookupValueCache),
+ new InliningAndCachingASTManager(packageFactory, hashFunction, astFileLookupValueCache),
/*cachedBzlLoadDataManager=*/ null);
}
@@ -986,7 +985,7 @@
*/
private static class InliningAndCachingASTManager implements ASTManager {
private final PackageFactory packageFactory;
- private final DigestHashFunction digestHashFunction;
+ private final HashFunction hashFunction;
// We keep a cache of ASTFileLookupValues that have been computed but whose corresponding
// BzlLoadValue has not yet completed. This avoids repeating the ASTFileLookupValue work in case
// of Skyframe restarts. (If we weren't inlining, Skyframe would cache this for us.)
@@ -994,10 +993,10 @@
private InliningAndCachingASTManager(
PackageFactory packageFactory,
- DigestHashFunction digestHashFunction,
+ HashFunction hashFunction,
Cache<ASTFileLookupValue.Key, ASTFileLookupValue> astFileLookupValueCache) {
this.packageFactory = packageFactory;
- this.digestHashFunction = digestHashFunction;
+ this.hashFunction = hashFunction;
this.astFileLookupValueCache = astFileLookupValueCache;
}
@@ -1007,7 +1006,7 @@
throws ASTLookupFailedException, InterruptedException {
ASTFileLookupValue value = astFileLookupValueCache.getIfPresent(key);
if (value == null) {
- value = ASTFileLookupFunction.computeInline(key, env, packageFactory, digestHashFunction);
+ value = ASTFileLookupFunction.computeInline(key, env, packageFactory, hashFunction);
if (value != null) {
astFileLookupValueCache.put(key, value);
}