diff options
author | tomlu <tomlu@google.com> | 2018-02-09 12:56:56 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-09 12:58:54 -0800 |
commit | bc52ffcc63dd970c8c5ab802d7cd0bcf2b986d45 (patch) | |
tree | 9dadb6dfc7bc8798ae35782d41e0a734811b0204 /src/main/java/com/google/devtools/build/lib/vfs | |
parent | 8a56b164facce7844718a0c80554f6c11ba155f2 (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.java | 8 |
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() { |