diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs/Root.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/vfs/Root.java | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/Root.java b/src/main/java/com/google/devtools/build/lib/vfs/Root.java index 73ff687b56..6f090e41a7 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/Root.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/Root.java @@ -16,7 +16,7 @@ package com.google.devtools.build.lib.vfs; import com.google.common.base.Objects; import com.google.common.base.Preconditions; import com.google.devtools.build.lib.skyframe.serialization.DeserializationContext; -import com.google.devtools.build.lib.skyframe.serialization.InjectingObjectCodec; +import com.google.devtools.build.lib.skyframe.serialization.ObjectCodec; import com.google.devtools.build.lib.skyframe.serialization.SerializationContext; import com.google.devtools.build.lib.skyframe.serialization.SerializationException; import com.google.protobuf.CodedInputStream; @@ -35,7 +35,7 @@ import javax.annotation.Nullable; */ public interface Root extends Comparable<Root>, Serializable { - InjectingObjectCodec<Root, FileSystemProvider> CODEC = new RootCodec(); + ObjectCodec<Root> CODEC = new RootCodec(); /** Constructs a root from a path. */ static Root fromPath(Path path) { @@ -258,7 +258,7 @@ public interface Root extends Comparable<Root>, Serializable { } /** Codec to serialize {@link Root}s. */ - class RootCodec implements InjectingObjectCodec<Root, FileSystemProvider> { + class RootCodec implements ObjectCodec<Root> { @Override public Class<Root> getEncodedClass() { return Root.class; @@ -266,16 +266,16 @@ public interface Root extends Comparable<Root>, Serializable { @Override public void serialize( - FileSystemProvider dependency, SerializationContext context, Root obj, CodedOutputStream codedOut) throws SerializationException, IOException { if (obj instanceof PathRoot) { codedOut.writeBoolNoTag(false); - Path.CODEC.serialize(dependency, context, ((PathRoot) obj).path, codedOut); + Path.CODEC.serialize(context, ((PathRoot) obj).path, codedOut); } else if (obj instanceof AbsoluteRoot) { - Preconditions.checkArgument(((AbsoluteRoot) obj).fileSystem == dependency.getFileSystem()); + Preconditions.checkArgument( + ((AbsoluteRoot) obj).fileSystem == context.getDependency(FileSystem.class)); codedOut.writeBoolNoTag(true); } else { throw new AssertionError("Unknown Root subclass: " + obj.getClass().getName()); @@ -283,14 +283,13 @@ public interface Root extends Comparable<Root>, Serializable { } @Override - public Root deserialize( - FileSystemProvider dependency, DeserializationContext context, CodedInputStream codedIn) + public Root deserialize(DeserializationContext context, CodedInputStream codedIn) throws SerializationException, IOException { boolean isAbsolute = codedIn.readBool(); if (isAbsolute) { - return dependency.getFileSystem().getAbsoluteRoot(); + return context.getDependency(FileSystem.class).getAbsoluteRoot(); } else { - Path path = Path.CODEC.deserialize(dependency, context, codedIn); + Path path = Path.CODEC.deserialize(context, codedIn); return new PathRoot(path); } } |