private Set<Integer> findAssignableTypes(Dex dex, int typeIndex) {
    Set<Integer> assignableTypes = new HashSet<Integer>();
    assignableTypes.add(typeIndex);

    for (ClassDef classDef : dex.classDefs()) {
      if (assignableTypes.contains(classDef.getSupertypeIndex())) {
        assignableTypes.add(classDef.getTypeIndex());
        continue;
      }

      for (int implemented : classDef.getInterfaces()) {
        if (assignableTypes.contains(implemented)) {
          assignableTypes.add(classDef.getTypeIndex());
          break;
        }
      }
    }

    return assignableTypes;
  }
Returns the set of types that can be assigned to {@code typeIndex}.
android/android_framework/dex-maker/src/main/java/com/android/dx/command/findusages/FindUsages.java