aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils/FsUtils.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystem.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystemWithCustomStat.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java5
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java3
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java4
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java22
9 files changed, 28 insertions, 20 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils/FsUtils.java b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils/FsUtils.java
index 1b9e7bbf4f..e244098f32 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils/FsUtils.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/testutils/FsUtils.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.skyframe.serialization.testutils;
-import com.google.devtools.build.lib.vfs.DigestHashFunction;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Root;
@@ -24,7 +23,7 @@ import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
/** Common FileSystem related items for serialization tests. */
public class FsUtils {
- public static final FileSystem TEST_FILESYSTEM = new InMemoryFileSystem(DigestHashFunction.MD5);
+ public static final FileSystem TEST_FILESYSTEM = new InMemoryFileSystem();
public static final RootedPath TEST_ROOT =
RootedPath.toRootedPath(
diff --git a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
index d579ebaf83..5d507c3f95 100644
--- a/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/unix/UnixFileSystem.java
@@ -39,9 +39,6 @@ import java.util.List;
public class UnixFileSystem extends AbstractFileSystemWithCustomStat {
public UnixFileSystem() {
- // TODO(b/109764197): remove this parameter-less constructor, so that no one uses MD5 by
- // default.
- super(DigestHashFunction.MD5);
}
public UnixFileSystem(DigestHashFunction hashFunction) {
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystem.java
index a5a454c687..096ca500f4 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystem.java
@@ -30,6 +30,8 @@ public abstract class AbstractFileSystem extends FileSystem {
protected static final String ERR_PERMISSION_DENIED = " (Permission denied)";
protected static final Profiler profiler = Profiler.instance();
+ public AbstractFileSystem() {}
+
public AbstractFileSystem(DigestHashFunction digestFunction) {
super(digestFunction);
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystemWithCustomStat.java b/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystemWithCustomStat.java
index 2891f12126..2a2b06b50a 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystemWithCustomStat.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/AbstractFileSystemWithCustomStat.java
@@ -22,6 +22,8 @@ import java.io.IOException;
*/
public abstract class AbstractFileSystemWithCustomStat extends AbstractFileSystem {
+ public AbstractFileSystemWithCustomStat() {}
+
public AbstractFileSystemWithCustomStat(DigestHashFunction hashFunction) {
super(hashFunction);
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
index 63cf2823f1..8d10e5800b 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/FileSystem.java
@@ -38,6 +38,10 @@ public abstract class FileSystem {
private final DigestHashFunction digestFunction;
+ public FileSystem() {
+ this(DigestHashFunction.MD5);
+ }
+
public FileSystem(DigestHashFunction digestFunction) {
this.digestFunction = Preconditions.checkNotNull(digestFunction);
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
index 00a320fa57..1fec03f5db 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/JavaIoFileSystem.java
@@ -53,7 +53,7 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
protected static final String ERR_NOT_A_DIRECTORY = " (Not a directory)";
public JavaIoFileSystem() {
- this(new JavaClock(), DigestHashFunction.MD5);
+ this(new JavaClock());
}
public JavaIoFileSystem(DigestHashFunction hashFunction) {
@@ -62,8 +62,7 @@ public class JavaIoFileSystem extends AbstractFileSystemWithCustomStat {
}
@VisibleForTesting
- JavaIoFileSystem(Clock clock, DigestHashFunction hashFunction) {
- super(hashFunction);
+ JavaIoFileSystem(Clock clock) {
this.clock = clock;
}
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
index f52c786aa7..938f7a7ffb 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystem.java
@@ -36,8 +36,7 @@ import java.io.OutputStream;
*/
public abstract class ReadonlyFileSystem extends AbstractFileSystem {
- protected ReadonlyFileSystem(DigestHashFunction hashFunction) {
- super(hashFunction);
+ protected ReadonlyFileSystem() {
}
protected IOException modificationException() {
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
index 7ef4a093ab..f9ca4ebb87 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/ReadonlyFileSystemWithCustomStat.java
@@ -20,9 +20,7 @@ import java.io.OutputStream;
* Functionally like a {@link ReadonlyFileSystem} and a {@link AbstractFileSystemWithCustomStat}.
*/
public abstract class ReadonlyFileSystemWithCustomStat extends AbstractFileSystemWithCustomStat {
-
- protected ReadonlyFileSystemWithCustomStat(DigestHashFunction hashFunction) {
- super(hashFunction);
+ protected ReadonlyFileSystemWithCustomStat() {
}
protected IOException modificationException() {
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
index a83d6ab047..504cf21c5b 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/inmemoryfs/InMemoryFileSystem.java
@@ -13,7 +13,6 @@
// limitations under the License.
package com.google.devtools.build.lib.vfs.inmemoryfs;
-import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.devtools.build.lib.clock.Clock;
@@ -59,23 +58,33 @@ public class InMemoryFileSystem extends FileSystem {
// Maximum number of traversals before ELOOP is thrown.
private static final int MAX_TRAVERSALS = 256;
- // TODO(b/109764197): Remove the no-arg constructor from Jadep and then remove it here.
- @VisibleForTesting
+ /**
+ * Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
+ * within scope) and a default clock.
+ */
public InMemoryFileSystem() {
- this(new JavaClock(), DigestHashFunction.MD5);
+ this(new JavaClock());
}
/**
* Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
* within scope) and a default clock.
*
- * @param hashFunction
+ * @param hashFunction the function to use for calculating digests.
*/
public InMemoryFileSystem(DigestHashFunction hashFunction) {
this(new JavaClock(), hashFunction);
}
/**
+ * Creates a new InMemoryFileSystem with scope checking disabled (all
+ * paths are considered to be within scope).
+ */
+ public InMemoryFileSystem(Clock clock) {
+ this(clock, (PathFragment) null);
+ }
+
+ /**
* Creates a new InMemoryFileSystem with scope checking disabled (all paths are considered to be
* within scope).
*/
@@ -90,8 +99,7 @@ public class InMemoryFileSystem extends FileSystem {
* Creates a new InMemoryFileSystem with scope checking bound to scopeRoot, i.e. any path that's
* not below scopeRoot is considered to be out of scope.
*/
- public InMemoryFileSystem(Clock clock, PathFragment scopeRoot, DigestHashFunction hashFunction) {
- super(hashFunction);
+ public InMemoryFileSystem(Clock clock, PathFragment scopeRoot) {
this.scopeRoot = scopeRoot;
this.clock = clock;
this.rootInode = newRootInode(clock);