Give instances of NonAttributeDependencyKind a useful printed name for debugging.
@@ -92,7 +92,11 @@ public abstract class DependencyResolver {
/** A dependency caused by something that's not an attribute. Special cases enumerated below. */
private static final class NonAttributeDependencyKind implements DependencyKind {
- private NonAttributeDependencyKind() {}
+ private final String name;
+
+ private NonAttributeDependencyKind(String name) {
+ this.name = name;
+ }
@Override
public Attribute getAttribute() {
@@ -104,16 +108,24 @@ public abstract class DependencyResolver {
public AspectClass getOwningAspect() {
throw new IllegalStateException();
}
+
+ @Override
+ public String toString() {
+ return String.format("%s(%s)", getClass().getSimpleName(), this.name);
+ }
}
/** A dependency for visibility. */
- public static final DependencyKind VISIBILITY_DEPENDENCY = new NonAttributeDependencyKind();
+ public static final DependencyKind VISIBILITY_DEPENDENCY =
+ new NonAttributeDependencyKind("VISIBILITY");
/** The dependency on the rule that creates a given output file. */
- public static final DependencyKind OUTPUT_FILE_RULE_DEPENDENCY = new NonAttributeDependencyKind();
+ public static final DependencyKind OUTPUT_FILE_RULE_DEPENDENCY =
+ new NonAttributeDependencyKind("OUTPUT_FILE");
/** A dependency on a resolved toolchain. */
- public static final DependencyKind TOOLCHAIN_DEPENDENCY = new NonAttributeDependencyKind();
+ public static final DependencyKind TOOLCHAIN_DEPENDENCY =
+ new NonAttributeDependencyKind("TOOLCHAIN");
/** A dependency through an attribute, either that of an aspect or the rule itself. */
@AutoValue
