Windows, tests: move code into WindowsTestUtil
Additionally:
- clean up the corresponding BUILD file a bit
- add a comment to Path
A subsequent change will add tests for
WindowsFileSystem, then fix a bug there.
--
MOS_MIGRATED_REVID=132408212
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/Path.java b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
index c6245b0..532a5f0 100644
--- a/src/main/java/com/google/devtools/build/lib/vfs/Path.java
+++ b/src/main/java/com/google/devtools/build/lib/vfs/Path.java
@@ -20,7 +20,6 @@
import com.google.devtools.build.lib.util.OS;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.util.StringCanonicalizer;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -797,15 +796,18 @@
public void createSymbolicLink(PathFragment target) throws IOException {
fileSystem.createSymbolicLink(this, target);
}
-
+
/**
- * Returns the target of the current path, which must be a symbolic link. The
- * link contents are returned exactly, and may contain an absolute or relative
- * path. Analogous to readlink(2).
+ * Returns the target of the current path, which must be a symbolic link. The link contents are
+ * returned exactly, and may contain an absolute or relative path. Analogous to readlink(2).
+ *
+ * <p>Note: for {@link FileSystem}s where {@link FileSystem#supportsSymbolicLinksNatively()}
+ * returns false, this method will throw an {@link UnsupportedOperationException} if the link
+ * points to a non-existent file.
*
* @return the content (i.e. target) of the symbolic link
- * @throws IOException if the current path is not a symbolic link, or the
- * contents of the link could not be read for any reason
+ * @throws IOException if the current path is not a symbolic link, or the contents of the link
+ * could not be read for any reason
*/
public PathFragment readSymbolicLink() throws IOException {
return fileSystem.readSymbolicLink(this);