diff --git a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionEvent.java b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionEvent.java index b2e0f6f3a5b40f..cd9c1e6d5bcddf 100644 --- a/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionEvent.java +++ b/src/main/java/com/google/devtools/build/lib/bazel/bzlmod/BazelModuleResolutionEvent.java @@ -14,7 +14,6 @@ package com.google.devtools.build.lib.bazel.bzlmod; -import com.google.auto.value.AutoValue; import com.google.common.collect.ImmutableTable; import com.google.devtools.build.lib.events.ExtendedEventHandler.Postable; @@ -22,20 +21,39 @@ * After resolving bazel module this event is sent from {@link BazelDepGraphFunction} holding the * lockfile value with module updates, and the module extension usages. It will be received in * {@link BazelLockFileModule} to be used to update the lockfile content + * + *
Instances of this class are retained in Skyframe nodes and subject to frequent {@link
+ * java.util.Set}-based deduplication. As such, it must have a cheap implementation of {@link
+ * #hashCode()} and {@link #equals(Object)}. It currently uses reference equality since the logic
+ * that creates instances of this class already ensures that there is only one instance per build.
*/
-@AutoValue
-public abstract class BazelModuleResolutionEvent implements Postable {
+public final class BazelModuleResolutionEvent implements Postable {
+
+ private final BazelLockFileValue lockfileValue;
+ private final ImmutableTable Instances of this class are retained in Skyframe nodes and subject to frequent {@link
+ * java.util.Set}-based deduplication. As such, it must have a cheap implementation of {@link
+ * #hashCode()} and {@link #equals(Object)}. It currently uses reference equality since the logic
+ * that creates instances of this class already ensures that there is only one instance per
+ * extension id.
*/
-@AutoValue
-public abstract class ModuleExtensionResolutionEvent implements Postable {
+public final class ModuleExtensionResolutionEvent implements Postable {
+
+ private final ModuleExtensionId extensionId;
+ private final ModuleExtensionEvalFactors extensionFactors;
+ private final LockFileModuleExtension moduleExtension;
+
+ private ModuleExtensionResolutionEvent(
+ ModuleExtensionId extensionId,
+ ModuleExtensionEvalFactors extensionFactors,
+ LockFileModuleExtension moduleExtension) {
+ this.extensionId = extensionId;
+ this.extensionFactors = extensionFactors;
+ this.moduleExtension = moduleExtension;
+ }
public static ModuleExtensionResolutionEvent create(
ModuleExtensionId extensionId,
ModuleExtensionEvalFactors extensionFactors,
LockFileModuleExtension lockfileModuleExtension) {
- return new AutoValue_ModuleExtensionResolutionEvent(
+ return new ModuleExtensionResolutionEvent(
extensionId, extensionFactors, lockfileModuleExtension);
}
- public abstract ModuleExtensionId getExtensionId();
+ public ModuleExtensionId getExtensionId() {
+ return extensionId;
+ }
- public abstract ModuleExtensionEvalFactors getExtensionFactors();
+ public ModuleExtensionEvalFactors getExtensionFactors() {
+ return extensionFactors;
+ }
- public abstract LockFileModuleExtension getModuleExtension();
+ public LockFileModuleExtension getModuleExtension() {
+ return moduleExtension;
+ }
@Override
public boolean storeForReplay() {
diff --git a/src/main/java/com/google/devtools/build/lib/events/Reportable.java b/src/main/java/com/google/devtools/build/lib/events/Reportable.java
index 4601fc4ef172c1..cf8f757c5a665c 100644
--- a/src/main/java/com/google/devtools/build/lib/events/Reportable.java
+++ b/src/main/java/com/google/devtools/build/lib/events/Reportable.java
@@ -47,6 +47,9 @@ public interface Reportable {
*
* This method is not relevant for events which do not originate from {@link
* com.google.devtools.build.skyframe.SkyFunction} evaluation.
+ *
+ * Classes returning {@code true} should have cheap {@link Object#hashCode()} and {@link
+ * Object#equals(Object)} implementations.
*/
default boolean storeForReplay() {
return false;