aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
diff options
context:
space:
mode:
authorGravatar Eric Fellheimer <felly@google.com>2015-11-19 02:16:24 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-11-19 10:04:36 +0000
commit26b3d8532cda8e38244b33222935e5c478d25ad0 (patch)
tree85becd59cc73bbcff56365a59fb41bfaf24c1b3c /src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
parent3ac42bf4a979c96e73fd79fb8f5416ae7d7621eb (diff)
Allow SkyValues to be marked not "comparable". Such values are not compared for the purpose of change pruning.
-- MOS_MIGRATED_REVID=108203369
Diffstat (limited to 'src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java')
-rw-r--r--src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java b/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
index 6eab026445..b7024334a2 100644
--- a/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
+++ b/src/main/java/com/google/devtools/build/skyframe/ValueWithMetadata.java
@@ -60,7 +60,7 @@ public abstract class ValueWithMetadata implements SkyValue {
if (errorInfo == null) {
return transitiveEvents.isEmpty()
? value
- : new ValueWithEvents(value, transitiveEvents);
+ : ValueWithEvents.createValueWithEvents(value, transitiveEvents);
}
return new ErrorInfoValue(errorInfo, value, transitiveEvents);
}
@@ -75,15 +75,24 @@ public abstract class ValueWithMetadata implements SkyValue {
public abstract NestedSet<TaggedEvents> getTransitiveEvents();
/** Implementation of {@link ValueWithMetadata} for the value case. */
- public static final class ValueWithEvents extends ValueWithMetadata {
+ public static class ValueWithEvents extends ValueWithMetadata {
private final NestedSet<TaggedEvents> transitiveEvents;
- public ValueWithEvents(SkyValue value, NestedSet<TaggedEvents> transitiveEvents) {
+ private ValueWithEvents(SkyValue value, NestedSet<TaggedEvents> transitiveEvents) {
super(Preconditions.checkNotNull(value));
this.transitiveEvents = Preconditions.checkNotNull(transitiveEvents);
}
+ public static ValueWithEvents createValueWithEvents(SkyValue value,
+ NestedSet<TaggedEvents> transitiveEvents) {
+ if (value instanceof NotComparableSkyValue) {
+ return new NotComparableValueWithEvents(value, transitiveEvents);
+ } else {
+ return new ValueWithEvents(value, transitiveEvents);
+ }
+ }
+
@Nullable
@Override
ErrorInfo getErrorInfo() { return null; }
@@ -124,8 +133,21 @@ public abstract class ValueWithMetadata implements SkyValue {
public String toString() { return value.toString(); }
}
- /** Implementation of {@link ValueWithMetadata} for the error case. */
- private static final class ErrorInfoValue extends ValueWithMetadata {
+ private static final class NotComparableValueWithEvents extends ValueWithEvents
+ implements NotComparableSkyValue {
+ private NotComparableValueWithEvents(SkyValue value,
+ NestedSet<TaggedEvents> transitiveEvents) {
+ super(value, transitiveEvents);
+ }
+ }
+
+ /**
+ * Implementation of {@link ValueWithMetadata} for the error case.
+ *
+ * ErorInfo does not override equals(), so it may as well be marked NotComparableSkyValue.
+ */
+ private static final class ErrorInfoValue extends ValueWithMetadata
+ implements NotComparableSkyValue {
private final ErrorInfo errorInfo;
private final NestedSet<TaggedEvents> transitiveEvents;
@@ -198,7 +220,7 @@ public abstract class ValueWithMetadata implements SkyValue {
if (value instanceof ValueWithMetadata) {
return (ValueWithMetadata) value;
}
- return new ValueWithEvents(value, NO_EVENTS);
+ return ValueWithEvents.createValueWithEvents(value, NO_EVENTS);
}
@Nullable