aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
diff options
context:
space:
mode:
authorGravatar nharmata <nharmata@google.com>2017-04-04 17:11:39 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-04-05 15:18:20 +0200
commitb4060b6e53944a7c3bdc5e62b288e7293a87652a (patch)
tree59b0f1f3d3e8e99412e060bb98b5a37fe90d9b6e /src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
parent3ac77cb94a4cf1bd1993a97fe79f2005b2b1a711 (diff)
Refactor all ctor callsites of PathFragment to instead call a static 'create' method.
This paves the way for changing PathFragment to e.g. an abstract class with multiple subclasses. This way we can split out the windows-specific stuff into one of these concrete classes, making the code more readable and also saving memory (since the shallow heap size of the NonWindowsPathFragment subclass will hopefully be smaller than that of the current PathFragment). This also lets us pursue gc churn optimizations. We can now do interning in PathFragment#create and can also get rid of unnecessary intermediate PathFragment allocations. RELNOTES: None PiperOrigin-RevId: 152145768
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
index 9f9480c19b..b048748861 100644
--- a/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
+++ b/src/test/java/com/google/devtools/build/lib/vfs/SymlinkAwareFileSystemTest.java
@@ -200,7 +200,7 @@ public abstract class SymlinkAwareFileSystemTest extends FileSystemTest {
};
Path linkPath = absolutize("link");
for (String linkTarget : linkTargets) {
- PathFragment relative = new PathFragment(linkTarget);
+ PathFragment relative = PathFragment.create(linkTarget);
linkPath.delete();
createSymbolicLink(linkPath, relative);
if (supportsSymlinks) {
@@ -246,7 +246,7 @@ public abstract class SymlinkAwareFileSystemTest extends FileSystemTest {
@Test
public void testLinkToFragmentContainingLinkResolvesCorrectly() throws IOException {
Path link1 = absolutize("link1");
- PathFragment link1target = new PathFragment("link2/foo");
+ PathFragment link1target = PathFragment.create("link2/foo");
Path link2 = absolutize("link2");
Path link2target = xNonEmptyDirectory;
@@ -331,7 +331,7 @@ public abstract class SymlinkAwareFileSystemTest extends FileSystemTest {
String prefix = "./";
while ((ancestor = ancestor.getParentDirectory()) != null) {
xLinkToFile.delete();
- createSymbolicLink(xLinkToFile, new PathFragment(prefix + xFile.relativeTo(ancestor)));
+ createSymbolicLink(xLinkToFile, PathFragment.create(prefix + xFile.relativeTo(ancestor)));
assertEquals(xFile, xLinkToFile.resolveSymbolicLinks());
prefix += "../";