public boolean catchesEqual(BasicBlock block1, BasicBlock block2) {
    TypeList catches1 = block1.getExceptionHandlerTypes();
    TypeList catches2 = block2.getExceptionHandlerTypes();

    if (!StdTypeList.equalContents(catches1, catches2)) {
      return false;
    }

    IntList succ1 = block1.getSuccessors();
    IntList succ2 = block2.getSuccessors();
    int size = succ1.size(); // Both are guaranteed to be the same size.

    int primary1 = block1.getPrimarySuccessor();
    int primary2 = block2.getPrimarySuccessor();

    if (((primary1 == -1) || (primary2 == -1)) && (primary1 != primary2)) {
      /*
       * For the current purpose, both blocks in question must
       * either both have a primary or both not have a primary to
       * be considered equal, and it turns out here that that's not
       * the case.
       */
      return false;
    }

    for (int i = 0; i < size; i++) {
      int label1 = succ1.get(i);
      int label2 = succ2.get(i);

      if (label1 == primary1) {
        /*
         * It should be the case that block2's primary is at the
         * same index. If not, we consider the blocks unequal for
         * the current purpose.
         */
        if (label2 != primary2) {
          return false;
        }
        continue;
      }

      if (label1 != label2) {
        return false;
      }
    }

    return true;
  }
Compares the catches of two blocks for equality. This includes both the catch types and target
labels.

@param block1 {@code non-null;} one block to compare
@param block2 {@code non-null;} the other block to compare
@return {@code true} if the two blocks' non-primary successors are identical
android/android_framework/dex-maker/src/main/java/com/android/dx/rop/code/BasicBlockList.java