diff options
author | nharmata <nharmata@google.com> | 2017-04-04 17:11:39 +0000 |
---|---|---|
committer | Damien Martin-Guillerez <dmarting@google.com> | 2017-04-05 15:18:20 +0200 |
commit | b4060b6e53944a7c3bdc5e62b288e7293a87652a (patch) | |
tree | 59b0f1f3d3e8e99412e060bb98b5a37fe90d9b6e /src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java | |
parent | 3ac77cb94a4cf1bd1993a97fe79f2005b2b1a711 (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/analysis/BuildViewTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java index 3bf92ec39d..106ccd119c 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java @@ -162,7 +162,7 @@ public class BuildViewTest extends BuildViewTestBase { outputArtifact.getRoot()); assertEquals(outputCT.getConfiguration().getBinFragment().getRelative("pkg/a.out"), outputArtifact.getExecPath()); - assertEquals(new PathFragment("pkg/a.out"), outputArtifact.getRootRelativePath()); + assertEquals(PathFragment.create("pkg/a.out"), outputArtifact.getRootRelativePath()); Action action = getGeneratingAction(outputArtifact); assertSame(FailAction.class, action.getClass()); @@ -775,9 +775,9 @@ public class BuildViewTest extends BuildViewTestBase { Path cycles2BuildFilePath = scratch.file("cycles2/BUILD", "sh_library(name = 'cycles2', srcs = glob(['*.sh']))"); cycles1BuildFilePath.getParentDirectory().getRelative("cycles1.sh").createSymbolicLink( - new PathFragment("cycles1.sh")); + PathFragment.create("cycles1.sh")); cycles2BuildFilePath.getParentDirectory().getRelative("cycles2.sh").createSymbolicLink( - new PathFragment("cycles2.sh")); + PathFragment.create("cycles2.sh")); reporter.removeHandler(failFastHandler); EventBus eventBus = new EventBus(); LoadingFailureRecorder recorder = new LoadingFailureRecorder(); |