Remove superfluous BuildEventId Java class. The protobuf is just as good, and it reduces complexity to not have these wrapper classes floating around.

Probably will have no noticeable effect on performance/memory, but can't hurt.

PiperOrigin-RevId: 304197948
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 d78c92a..94b80d4 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
@@ -46,10 +46,11 @@
 import com.google.devtools.build.lib.buildeventstream.BuildEvent;
 import com.google.devtools.build.lib.buildeventstream.BuildEventArtifactUploader;
 import com.google.devtools.build.lib.buildeventstream.BuildEventContext;
-import com.google.devtools.build.lib.buildeventstream.BuildEventId;
+import com.google.devtools.build.lib.buildeventstream.BuildEventIdUtil;
 import com.google.devtools.build.lib.buildeventstream.BuildEventProtocolOptions;
 import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos;
 import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.Aborted.AbortReason;
+import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId;
 import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildEventId.NamedSetOfFilesId;
 import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.File;
 import com.google.devtools.build.lib.buildeventstream.BuildEventTransport;
@@ -321,7 +322,7 @@
   }
 
   private static BuildEventId testId(String opaque) {
-    return BuildEventId.unknownBuildEventId(opaque);
+    return BuildEventIdUtil.unknownBuildEventId(opaque);
   }
 
   private static class EventBusHandler {
@@ -359,8 +360,9 @@
 
     BuildEvent startEvent =
         new GenericBuildEvent(
-            testId("Initial"), ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE,
-            BuildEventId.buildFinished()));
+            testId("Initial"),
+            ImmutableSet.of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
 
     streamer.buildEvent(startEvent);
 
@@ -379,7 +381,8 @@
     assertThat(finalStream).hasSize(3);
     assertThat(ImmutableSet.of(finalStream.get(1).getEventId(), finalStream.get(2).getEventId()))
         .isEqualTo(
-            ImmutableSet.of(BuildEventId.buildFinished(), ProgressEvent.INITIAL_PROGRESS_UPDATE));
+            ImmutableSet.of(
+                BuildEventIdUtil.buildFinished(), ProgressEvent.INITIAL_PROGRESS_UPDATE));
 
     // verify the "last_message" flag.
     assertThat(transport.getEventProtos().get(0).getLastMessage()).isFalse();
@@ -463,8 +466,8 @@
     BuildEvent startEvent =
         new GenericBuildEvent(
             testId("Initial"),
-            ImmutableSet.<BuildEventId>of(ProgressEvent.INITIAL_PROGRESS_UPDATE,
-                BuildEventId.buildFinished()));
+            ImmutableSet.<BuildEventId>of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
     BuildEvent earlyEvent =
         new GenericBuildEvent(testId("unexpected"), ImmutableSet.<BuildEventId>of());
     BuildEvent lateReference =
@@ -532,7 +535,8 @@
     BuildEvent startEvent =
         new GenericBuildEvent(
             testId("Initial"),
-            ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+            ImmutableSet.of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
     streamer.buildEvent(startEvent);
 
     int numThreads = 12;
@@ -589,7 +593,8 @@
       BuildEvent startEvent =
           new GenericBuildEvent(
               testId("Initial"),
-              ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+              ImmutableSet.of(
+                  ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
       streamer.buildEvent(startEvent);
 
       int numThreads = 12;
@@ -640,8 +645,10 @@
     BuildEvent startEvent =
         new GenericBuildEvent(
             testId("Initial"),
-            ImmutableSet.<BuildEventId>of(ProgressEvent.INITIAL_PROGRESS_UPDATE, expectedId,
-                BuildEventId.buildFinished()));
+            ImmutableSet.<BuildEventId>of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                expectedId,
+                BuildEventIdUtil.buildFinished()));
     BuildEventId rootCauseId = testId("failure event");
     BuildEvent failedTarget =
         new GenericOrderEvent(expectedId, ImmutableSet.<BuildEventId>of(rootCauseId));
@@ -654,7 +661,7 @@
     List<BuildEvent> allEventsSeen = transport.getEvents();
     assertThat(allEventsSeen).hasSize(6);
     assertThat(allEventsSeen.get(0).getEventId()).isEqualTo(startEvent.getEventId());
-    assertThat(allEventsSeen.get(1).getEventId()).isEqualTo(BuildEventId.buildFinished());
+    assertThat(allEventsSeen.get(1).getEventId()).isEqualTo(BuildEventIdUtil.buildFinished());
     BuildEvent linkEvent = allEventsSeen.get(2);
     assertThat(linkEvent.getEventId()).isEqualTo(ProgressEvent.INITIAL_PROGRESS_UPDATE);
     assertThat(allEventsSeen.get(3).getEventId()).isEqualTo(rootCauseId);
@@ -888,9 +895,9 @@
     assertThat(allEventsSeen.get(0).getEventId()).isEqualTo(startEvent.getEventId());
     assertThat(allEventsSeen.get(1).getEventId()).isEqualTo(ProgressEvent.INITIAL_PROGRESS_UPDATE);
     assertThat(allEventsSeen.get(2)).isEqualTo(configuration.toBuildEvent());
-    assertThat(allEventsSeen.get(3).getEventId()).isEqualTo(BuildEventId.progressId(1));
+    assertThat(allEventsSeen.get(3).getEventId()).isEqualTo(BuildEventIdUtil.progressId(1));
     assertThat(allEventsSeen.get(4)).isEqualTo(firstWithConfiguration);
-    assertThat(allEventsSeen.get(5).getEventId()).isEqualTo(BuildEventId.progressId(2));
+    assertThat(allEventsSeen.get(5).getEventId()).isEqualTo(BuildEventIdUtil.progressId(2));
     assertThat(allEventsSeen.get(6)).isEqualTo(secondWithConfiguration);
   }
 
@@ -1071,7 +1078,7 @@
         new GenericOrderEvent(
             testId("event depending on start"),
             ImmutableList.of(),
-            ImmutableList.of(BuildEventId.buildStartedId()));
+            ImmutableList.of(BuildEventIdUtil.buildStartedId()));
 
     streamer.buildEvent(orderEvent);
     streamer.buildEvent(new BuildCompleteEvent(new BuildResult(0)));
@@ -1079,11 +1086,12 @@
     assertThat(streamer.isClosed()).isTrue();
     List<BuildEvent> eventsSeen = transport.getEvents();
     assertThat(eventsSeen).hasSize(4);
-    assertThat(eventsSeen.get(0).getEventId()).isEqualTo(BuildEventId.buildStartedId());
+    assertThat(eventsSeen.get(0).getEventId()).isEqualTo(BuildEventIdUtil.buildStartedId());
     assertThat(eventsSeen.get(1).getEventId()).isEqualTo(orderEvent.getEventId());
     assertThat(ImmutableSet.of(eventsSeen.get(2).getEventId(), eventsSeen.get(3).getEventId()))
         .isEqualTo(
-            ImmutableSet.of(BuildEventId.buildFinished(), ProgressEvent.INITIAL_PROGRESS_UPDATE));
+            ImmutableSet.of(
+                BuildEventIdUtil.buildFinished(), ProgressEvent.INITIAL_PROGRESS_UPDATE));
     assertThat(transport.getEventProtos().get(3).getLastMessage()).isTrue();
   }
 
@@ -1094,7 +1102,8 @@
     BuildEvent startEvent =
         new GenericBuildEvent(
             testId("Initial"),
-            ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+            ImmutableSet.of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
     BuildEventId lateId = testId("late event");
     BuildEvent finishedEvent = new BuildCompleteEvent(new BuildResult(0), ImmutableList.of(lateId));
 
@@ -1107,7 +1116,7 @@
     List<BuildEvent> eventsSeen = transport.getEvents();
     assertThat(eventsSeen).hasSize(4);
     assertThat(eventsSeen.get(0).getEventId()).isEqualTo(startEvent.getEventId());
-    assertThat(eventsSeen.get(1).getEventId()).isEqualTo(BuildEventId.buildFinished());
+    assertThat(eventsSeen.get(1).getEventId()).isEqualTo(BuildEventIdUtil.buildFinished());
     assertThat(ImmutableSet.of(eventsSeen.get(2).getEventId(), eventsSeen.get(3).getEventId()))
         .isEqualTo(ImmutableSet.of(lateId, ProgressEvent.INITIAL_PROGRESS_UPDATE));
   }
@@ -1120,21 +1129,22 @@
     BuildEvent startEvent =
         new GenericBuildEvent(
             testId("Initial"),
-            ImmutableSet.of(ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+            ImmutableSet.of(
+                ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventIdUtil.buildFinished()));
     BuildEventId lateId = testId("late event");
     BuildEvent finishedEvent = new BuildCompleteEvent(new BuildResult(0), ImmutableList.of(lateId));
 
     streamer.buildEvent(startEvent);
     streamer.buildEvent(
         new GenericOrderEvent(
-            lateId, ImmutableSet.of(), ImmutableList.of(BuildEventId.buildFinished())));
+            lateId, ImmutableSet.of(), ImmutableList.of(BuildEventIdUtil.buildFinished())));
     streamer.buildEvent(finishedEvent);
     assertThat(streamer.isClosed()).isTrue();
 
     List<BuildEvent> eventsSeen = transport.getEvents();
     assertThat(eventsSeen).hasSize(4);
     assertThat(eventsSeen.get(0).getEventId()).isEqualTo(startEvent.getEventId());
-    assertThat(eventsSeen.get(1).getEventId()).isEqualTo(BuildEventId.buildFinished());
+    assertThat(eventsSeen.get(1).getEventId()).isEqualTo(BuildEventIdUtil.buildFinished());
     assertThat(ImmutableSet.of(eventsSeen.get(2).getEventId(), eventsSeen.get(3).getEventId()))
         .isEqualTo(ImmutableSet.of(lateId, ProgressEvent.INITIAL_PROGRESS_UPDATE));
   }
@@ -1206,9 +1216,11 @@
     BuildEventId buildEventId = testId("abort_expected");
     BuildEvent startEvent =
         new GenericBuildEvent(
-            BuildEventId.buildStartedId(),
+            BuildEventIdUtil.buildStartedId(),
             ImmutableSet.of(
-                buildEventId, ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+                buildEventId,
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                BuildEventIdUtil.buildFinished()));
     BuildCompleteEvent buildCompleteEvent =
         buildCompleteEvent(ExitCode.BUILD_FAILURE, true, null, false);
 
@@ -1228,9 +1240,11 @@
     BuildEventId buildEventId = testId("abort_expected");
     BuildEvent startEvent =
         new GenericBuildEvent(
-            BuildEventId.buildStartedId(),
+            BuildEventIdUtil.buildStartedId(),
             ImmutableSet.of(
-                buildEventId, ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+                buildEventId,
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                BuildEventIdUtil.buildFinished()));
     BuildCompleteEvent buildCompleteEvent =
         buildCompleteEvent(ExitCode.BUILD_FAILURE, true, new RuntimeException(), false);
 
@@ -1250,9 +1264,11 @@
     BuildEventId buildEventId = testId("abort_expected");
     BuildEvent startEvent =
         new GenericBuildEvent(
-            BuildEventId.buildStartedId(),
+            BuildEventIdUtil.buildStartedId(),
             ImmutableSet.of(
-                buildEventId, ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+                buildEventId,
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                BuildEventIdUtil.buildFinished()));
     BuildCompleteEvent buildCompleteEvent =
         buildCompleteEvent(ExitCode.BUILD_FAILURE, true, null, true);
 
@@ -1272,9 +1288,11 @@
     BuildEventId buildEventId = testId("abort_expected");
     BuildEvent startEvent =
         new GenericBuildEvent(
-            BuildEventId.buildStartedId(),
+            BuildEventIdUtil.buildStartedId(),
             ImmutableSet.of(
-                buildEventId, ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+                buildEventId,
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                BuildEventIdUtil.buildFinished()));
 
     streamer.buildEvent(startEvent);
     streamer.close(AbortReason.TIME_OUT);
@@ -1285,7 +1303,7 @@
     assertThat(aborted0.getAborted().getReason()).isEqualTo(AbortReason.TIME_OUT);
     assertThat(aborted0.getAborted().getDescription()).isEmpty();
 
-    BuildEventStreamProtos.BuildEvent aborted1 = getBepEvent(BuildEventId.buildFinished());
+    BuildEventStreamProtos.BuildEvent aborted1 = getBepEvent(BuildEventIdUtil.buildFinished());
     assertThat(aborted1).isNotNull();
     assertThat(aborted1.hasAborted()).isNotNull();
     assertThat(aborted1.getAborted().getReason()).isEqualTo(AbortReason.TIME_OUT);
@@ -1297,9 +1315,11 @@
     BuildEventId buildEventId = testId("abort_expected");
     BuildEvent startEvent =
         new GenericBuildEvent(
-            BuildEventId.buildStartedId(),
+            BuildEventIdUtil.buildStartedId(),
             ImmutableSet.of(
-                buildEventId, ProgressEvent.INITIAL_PROGRESS_UPDATE, BuildEventId.buildFinished()));
+                buildEventId,
+                ProgressEvent.INITIAL_PROGRESS_UPDATE,
+                BuildEventIdUtil.buildFinished()));
     BuildCompleteEvent buildCompleteEvent =
         buildCompleteEvent(ExitCode.BUILD_FAILURE, false, new RuntimeException(), false);
 
@@ -1319,7 +1339,7 @@
   @Nullable
   private BuildEventStreamProtos.BuildEvent getBepEvent(BuildEventId buildEventId) {
     return transport.getEventProtos().stream()
-        .filter(e -> e.getId().equals(buildEventId.asStreamProto()))
+        .filter(e -> e.getId().equals(buildEventId))
         .findFirst()
         .orElse(null);
   }