diff --git a/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java b/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java index c74062eacc0869..96e2b0b541d7a7 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java @@ -16,6 +16,7 @@ import static com.google.common.base.Preconditions.checkArgument; import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; +import com.google.devtools.build.lib.util.OS; import com.google.devtools.build.skyframe.SkyKey; import java.util.Comparator; import javax.annotation.Nullable; @@ -53,6 +54,11 @@ public final class RootedPath implements Comparable, FileStateKey { @AutoCodec.Instantiator @AutoCodec.VisibleForSerialization static RootedPath createInternal(Root root, PathFragment rootRelativePath) { + if (OS.getCurrent() == OS.WINDOWS && root.isAbsolute() && rootRelativePath.toString() + .equals("/")) { + throw new IllegalStateException( + "Path " + rootRelativePath + ", " + rootRelativePath.getClass()); + } checkArgument( rootRelativePath.isAbsolute() == root.isAbsolute(), "rootRelativePath: %s root: %s",