Rename allImmediateImplementsSubtypes and allImmediateExtendsSubtypes

This will make the purpose of the method a bit clearer and be
consistent with allImmediateSubtypes.

Change-Id: Iac7b5af6c2720cf2fb55a6a5f0bc36d42290af25
diff --git a/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java b/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
index 1d92188..4b2cb70 100644
--- a/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
+++ b/src/main/java/com/android/tools/r8/graph/AppInfoWithSubtyping.java
@@ -597,11 +597,11 @@
    * from the dex-file encoding, where subinterfaces "implement" their super interfaces. However, it
    * is consistent with the source language.
    */
-  public void forAllExtendsSubtypes(DexType type, Consumer<DexType> f) {
-    allExtendsSubtypes(type).forEach(f);
+  public void forAllImmediateExtendsSubtypes(DexType type, Consumer<DexType> f) {
+    allImmediateExtendsSubtypes(type).forEach(f);
   }
 
-  public Iterable<DexType> allExtendsSubtypes(DexType type) {
+  public Iterable<DexType> allImmediateExtendsSubtypes(DexType type) {
     TypeInfo info = getTypeInfo(type);
     assert info.hierarchyLevel != UNKNOWN_LEVEL;
     if (info.hierarchyLevel == INTERFACE_LEVEL) {
@@ -621,11 +621,11 @@
    * interfaces "implement" their super interfaces. Instead it takes the view of the source
    * language, where interfaces "extend" their superinterface.
    */
-  public void forAllImplementsSubtypes(DexType type, Consumer<DexType> f) {
-    allImplementsSubtypes(type).forEach(f);
+  public void forAllImmediateImplementsSubtypes(DexType type, Consumer<DexType> f) {
+    allImmediateImplementsSubtypes(type).forEach(f);
   }
 
-  public Iterable<DexType> allImplementsSubtypes(DexType type) {
+  public Iterable<DexType> allImmediateImplementsSubtypes(DexType type) {
     TypeInfo info = getTypeInfo(type);
     if (info.hierarchyLevel == INTERFACE_LEVEL) {
       return Iterables.filter(info.directSubtypes, subtype -> !getTypeInfo(subtype).isInterface());
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/MemberPoolCollection.java b/src/main/java/com/android/tools/r8/ir/optimize/MemberPoolCollection.java
index 776738c..3b1284d 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/MemberPoolCollection.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/MemberPoolCollection.java
@@ -136,11 +136,11 @@
     Deque<DexClass> worklist = new ArrayDeque<>();
     appView
         .appInfo()
-        .forAllExtendsSubtypes(
+        .forAllImmediateExtendsSubtypes(
             subject.type, type -> addNonNull(worklist, appView.definitionFor(type)));
     appView
         .appInfo()
-        .forAllImplementsSubtypes(
+        .forAllImmediateImplementsSubtypes(
             subject.type, type -> addNonNull(worklist, appView.definitionFor(type)));
     while (!worklist.isEmpty()) {
       DexClass clazz = worklist.pop();
@@ -150,11 +150,11 @@
       if (subTypes.add(clazz)) {
         appView
             .appInfo()
-            .forAllExtendsSubtypes(
+            .forAllImmediateExtendsSubtypes(
                 clazz.type, type -> addNonNull(worklist, appView.definitionFor(type)));
         appView
             .appInfo()
-            .forAllImplementsSubtypes(
+            .forAllImmediateImplementsSubtypes(
                 clazz.type, type -> addNonNull(worklist, appView.definitionFor(type)));
       }
     }
diff --git a/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java b/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
index b0e61ad..8896b56 100644
--- a/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/FieldNameMinifier.java
@@ -101,7 +101,8 @@
 
       // For interfaces, propagate reserved names to all implementing classes.
       if (clazz.isInterface() && reservedNames != null) {
-        for (DexType implementationType : appView.appInfo().allImplementsSubtypes(clazz.type)) {
+        for (DexType implementationType :
+            appView.appInfo().allImmediateImplementsSubtypes(clazz.type)) {
           DexClass implementation = appView.definitionFor(implementationType);
           if (implementation != null) {
             assert !implementation.isInterface();
@@ -197,7 +198,8 @@
 
     Set<DexType> visited = Sets.newIdentityHashSet();
     for (DexClass clazz : partition) {
-      for (DexType implementationType : appView.appInfo().allImplementsSubtypes(clazz.type)) {
+      for (DexType implementationType :
+          appView.appInfo().allImmediateImplementsSubtypes(clazz.type)) {
         if (!visited.add(implementationType)) {
           continue;
         }
@@ -316,7 +318,7 @@
           if (visited.add(clazz.superType)) {
             worklist.add(clazz.superType);
           }
-          for (DexType subclass : appView.appInfo().allExtendsSubtypes(type)) {
+          for (DexType subclass : appView.appInfo().allImmediateExtendsSubtypes(type)) {
             if (visited.add(subclass)) {
               worklist.add(subclass);
             }
diff --git a/src/main/java/com/android/tools/r8/naming/MethodNameMinifier.java b/src/main/java/com/android/tools/r8/naming/MethodNameMinifier.java
index f21bd13..7cc5d03 100644
--- a/src/main/java/com/android/tools/r8/naming/MethodNameMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/MethodNameMinifier.java
@@ -214,7 +214,7 @@
         assignNameToMethod(method, namingState);
       }
     }
-    for (DexType subType : appView.appInfo().allExtendsSubtypes(type)) {
+    for (DexType subType : appView.appInfo().allImmediateExtendsSubtypes(type)) {
       assignNamesToClassesMethods(subType, namingState);
     }
   }
@@ -250,7 +250,7 @@
     // frontier forward. This will ensure all reservations are put on the library frontier for
     // classpath and program path.
     DexClass holder = appView.definitionFor(type);
-    for (DexType subtype : appView.appInfo().allExtendsSubtypes(type)) {
+    for (DexType subtype : appView.appInfo().allImmediateExtendsSubtypes(type)) {
       reserveNamesInClasses(
           subtype,
           holder == null || holder.isLibraryClass() ? subtype : libraryFrontier,
diff --git a/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java b/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
index 3440c4b..fdcc686 100644
--- a/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
+++ b/src/main/java/com/android/tools/r8/naming/ProguardMapMinifier.java
@@ -240,12 +240,12 @@
       buildUpNames.addLast(nonPrivateMembers);
       appView
           .appInfo()
-          .forAllExtendsSubtypes(type, subType -> computeMapping(subType, buildUpNames));
+          .forAllImmediateExtendsSubtypes(type, subType -> computeMapping(subType, buildUpNames));
       buildUpNames.removeLast();
     } else {
       appView
           .appInfo()
-          .forAllExtendsSubtypes(type, subType -> computeMapping(subType, buildUpNames));
+          .forAllImmediateExtendsSubtypes(type, subType -> computeMapping(subType, buildUpNames));
     }
   }
 
diff --git a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
index a1006fe..aab5240 100644
--- a/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
+++ b/src/main/java/com/android/tools/r8/optimize/ClassAndMemberPublicizer.java
@@ -100,7 +100,7 @@
       }
     }
 
-    appView.appInfo().forAllExtendsSubtypes(type, this::publicizeType);
+    appView.appInfo().forAllImmediateExtendsSubtypes(type, this::publicizeType);
   }
 
   private boolean publicizeMethod(DexClass holder, DexEncodedMethod encodedMethod) {
diff --git a/src/main/java/com/android/tools/r8/shaking/AbstractMethodRemover.java b/src/main/java/com/android/tools/r8/shaking/AbstractMethodRemover.java
index efeaff7..fdd4da0 100644
--- a/src/main/java/com/android/tools/r8/shaking/AbstractMethodRemover.java
+++ b/src/main/java/com/android/tools/r8/shaking/AbstractMethodRemover.java
@@ -43,7 +43,7 @@
         holder.setVirtualMethods(newVirtualMethods);
       }
     }
-    appInfo.forAllExtendsSubtypes(type, this::processClass);
+    appInfo.forAllImmediateExtendsSubtypes(type, this::processClass);
     scope = scope.getParent();
   }
 
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
index d11adc8..b6bd78f 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
@@ -897,7 +897,7 @@
       // For kept types we do not know all subtypes, so abort.
       return DexEncodedMethod.SENTINEL;
     }
-    for (DexType subtype : allExtendsSubtypes(type)) {
+    for (DexType subtype : allImmediateExtendsSubtypes(type)) {
       DexClass clazz = definitionFor(subtype);
       DexEncodedMethod target = clazz.lookupVirtualMethod(method);
       if (target != null && !target.isPrivateMethod()) {