Make Artifact an abstract class, and break out a DerivedArtifact subclass. This will facilitate future refactorings in which a DerivedArtifact will have an ActionLookupData "owner", while a SourceArtifact will have a Label owner (or an ArtifactOwner, depending on how lazy I am).
I verified using the test in ArtifactTest, modified to use dummy classes, that derived artifacts don't use any more memory with this refactoring than they did before.
PiperOrigin-RevId: 249535371
diff --git a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
index 6da3ca7..be5cc35 100644
--- a/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/runtime/BuildEventStreamerTest.java
@@ -672,7 +672,8 @@
private Artifact makeArtifact(String pathString) {
Path path = outputBase.getRelative(PathFragment.create(pathString));
- return new Artifact(path, ArtifactRoot.asSourceRoot(Root.fromPath(outputBase)));
+ return ActionsTestUtil.createArtifact(
+ ArtifactRoot.asSourceRoot(Root.fromPath(outputBase)), path);
}
@Test