Remove throwing of InterruptedException from LabelVisitor. We never actually have any interruptible methods here.

PiperOrigin-RevId: 214648875
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
index 384ce09..8630b9a 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AbstractAttributeMapper.java
@@ -165,7 +165,7 @@
   }
 
   @Override
-  public Collection<DepEdge> visitLabels() throws InterruptedException {
+  public Collection<DepEdge> visitLabels() {
     List<DepEdge> edges = new ArrayList<>();
     Type.LabelVisitor<Attribute> visitor =
         (label, attribute) -> {
@@ -187,8 +187,7 @@
   }
 
   /** Visits all labels reachable from the given attribute. */
-  protected void visitLabels(Attribute attribute, Type.LabelVisitor<Attribute> visitor)
-      throws InterruptedException {
+  protected void visitLabels(Attribute attribute, Type.LabelVisitor<Attribute> visitor) {
     Type<?> type = attribute.getType();
     Object value = get(attribute.getName(), type);
     if (value != null) { // null values are particularly possible for computed defaults.
@@ -199,7 +198,7 @@
   @Override
   public final boolean isConfigurable(String attributeName) {
     Attribute attrDef = getAttributeDefinition(attributeName);
-    return attrDef == null ? false : getSelectorList(attributeName, attrDef.getType()) != null;
+    return attrDef != null && getSelectorList(attributeName, attrDef.getType()) != null;
   }
 
   public static <T> boolean isConfigurable(Rule rule, String attributeName, Type<T> type) {
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java b/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
index 75d3e0e..6604d4d 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AggregatingAttributeMapper.java
@@ -26,7 +26,6 @@
 import com.google.devtools.build.lib.packages.BuildType.Selector;
 import com.google.devtools.build.lib.packages.BuildType.SelectorList;
 import com.google.devtools.build.lib.syntax.Type;
-import com.google.devtools.build.lib.syntax.Type.LabelVisitor;
 import com.google.devtools.build.lib.syntax.Type.ListType;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -72,14 +71,12 @@
    * {@link #visitAttribute}'s documentation. So we want to avoid that code path when possible.
    */
   @Override
-  protected void visitLabels(Attribute attribute, Type.LabelVisitor<Attribute> visitor)
-      throws InterruptedException {
+  protected void visitLabels(Attribute attribute, Type.LabelVisitor<Attribute> visitor) {
     visitLabels(attribute, true, visitor);
   }
 
   private void visitLabels(
-      Attribute attribute, boolean includeSelectKeys, Type.LabelVisitor<Attribute> visitor)
-      throws InterruptedException {
+      Attribute attribute, boolean includeSelectKeys, Type.LabelVisitor<Attribute> visitor) {
     Type<?> type = attribute.getType();
     SelectorList<?> selectorList = getSelectorList(attribute.getName(), type);
     if (selectorList == null) {
@@ -117,18 +114,12 @@
    *
    * @param includeSelectKeys whether to include config_setting keys for configurable attributes
    */
-  public Set<Label> getReachableLabels(String attributeName, boolean includeSelectKeys)
-      throws InterruptedException {
+  public Set<Label> getReachableLabels(String attributeName, boolean includeSelectKeys) {
     final ImmutableSet.Builder<Label> builder = ImmutableSet.<Label>builder();
     visitLabels(
         getAttributeDefinition(attributeName),
         includeSelectKeys,
-        new LabelVisitor<Attribute>() {
-          @Override
-          public void visit(Label label, Attribute attribute) {
-            builder.add(label);
-          }
-        });
+        (label, attribute) -> builder.add(label));
     return builder.build();
   }
 
@@ -581,22 +572,15 @@
   }
 
   private static ImmutableList<Label> extractLabels(Type<?> type, Object value) {
-    try {
-      final ImmutableList.Builder<Label> result = ImmutableList.builder();
-      type.visitLabels(
-          new Type.LabelVisitor<Object>() {
-            @Override
-            public void visit(@Nullable Label label, Object dummy) {
-              if (label != null) {
-                result.add(label);
-              }
-            }
-          },
-          value,
-          /*context=*/ null);
-      return result.build();
-    } catch (InterruptedException e) {
-      throw new IllegalStateException("Unexpected InterruptedException", e);
-    }
+    final ImmutableList.Builder<Label> result = ImmutableList.builder();
+    type.visitLabels(
+        (label, dummy) -> {
+          if (label != null) {
+            result.add(label);
+          }
+        },
+        value,
+        /*context=*/ null);
+    return result.build();
   }
 }
diff --git a/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java b/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
index c299e64..937d19f 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/AspectDefinition.java
@@ -224,16 +224,14 @@
       final Multimap<Attribute, Label> labelBuilder,
       Aspect aspect,
       DependencyFilter dependencyFilter) {
-    LabelVisitor<Attribute> labelVisitor = new LabelVisitor<Attribute>() {
-      @Override
-      public void visit(Label label, Attribute aspectAttribute) {
-        Label repositoryRelative = maybeGetRepositoryRelativeLabel(from, label);
-        if (repositoryRelative == null) {
-          return;
-        }
-        labelBuilder.put(aspectAttribute, repositoryRelative);
-      }
-    };
+    LabelVisitor<Attribute> labelVisitor =
+        (label, aspectAttribute) -> {
+          Label repositoryRelative = maybeGetRepositoryRelativeLabel(from, label);
+          if (repositoryRelative == null) {
+            return;
+          }
+          labelBuilder.put(aspectAttribute, repositoryRelative);
+        };
     ImmutableMap<String, Attribute> attributes = aspect.getDefinition().getAttributes();
     for (final Attribute aspectAttribute : attributes.values()) {
       if (!dependencyFilter.apply(aspect, aspectAttribute)) {
@@ -243,13 +241,7 @@
       if (type.getLabelClass() != LabelClass.DEPENDENCY) {
         continue;
       }
-      try {
-        type.visitLabels(labelVisitor, aspectAttribute.getDefaultValue(from), aspectAttribute);
-      } catch (InterruptedException ex) {
-        // Because the LabelVisitor does not throw InterruptedException, it should not be thrown
-        // by visitLabels here.
-        throw new AssertionError(ex);
-      }
+      type.visitLabels(labelVisitor, aspectAttribute.getDefaultValue(from), aspectAttribute);
     }
   }
 
diff --git a/src/main/java/com/google/devtools/build/lib/packages/BuildType.java b/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
index 1e48835..5bb365d 100644
--- a/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
+++ b/src/main/java/com/google/devtools/build/lib/packages/BuildType.java
@@ -189,8 +189,7 @@
     }
 
     @Override
-    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context)
-        throws InterruptedException {
+    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context) {
       for (Label label : cast(value).getLabels()) {
         visitor.visit(label, context);
       }
@@ -240,8 +239,7 @@
     }
 
     @Override
-    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context)
-        throws InterruptedException {
+    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context) {
       visitor.visit(cast(value), context);
     }
 
@@ -443,8 +441,7 @@
     }
 
     @Override
-    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context)
-        throws InterruptedException {
+    public <T> void visitLabels(LabelVisitor<T> visitor, Object value, T context) {
       visitor.visit(cast(value), context);
     }