aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/vfs
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-02-09 12:56:56 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-02-09 12:58:54 -0800
commitbc52ffcc63dd970c8c5ab802d7cd0bcf2b986d45 (patch)
tree9dadb6dfc7bc8798ae35782d41e0a734811b0204 /src/main/java/com/google/devtools/build/lib/vfs
parent8a56b164facce7844718a0c80554f6c11ba155f2 (diff)
Do not store Path object in RootedPath.
This can be computed on the fly if we need it. RELNOTES: None PiperOrigin-RevId: 185180257
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r--src/main/java/com/google/devtools/build/lib/vfs/RootedPath.java8
1 files changed, 1 insertions, 7 deletions
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 09ab3139a4..82335c7921 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
@@ -37,7 +37,6 @@ public class RootedPath implements Serializable {
private final Root root;
private final PathFragment rootRelativePath;
- private final Path path;
/** Constructs a {@link RootedPath} from a {@link Root} and path fragment relative to the root. */
private RootedPath(Root root, PathFragment rootRelativePath) {
@@ -48,7 +47,6 @@ public class RootedPath implements Serializable {
root);
this.root = root;
this.rootRelativePath = rootRelativePath;
- this.path = root.getRelative(this.rootRelativePath);
}
/** Returns a rooted path representing {@code rootRelativePath} relative to {@code root}. */
@@ -89,11 +87,7 @@ public class RootedPath implements Serializable {
}
public Path asPath() {
- // Ideally, this helper method would not be needed. But Skyframe's FileFunction and
- // DirectoryListingFunction need to do filesystem operations on the absolute path and
- // Path#getRelative(relPath) is O(relPath.segmentCount()). Therefore we precompute the absolute
- // path represented by this relative path.
- return path;
+ return root.getRelative(rootRelativePath);
}
public Root getRoot() {