@Override
  public final int compareTo(OffsettedItem other) {
    if (this == other) {
      return 0;
    }

    ItemType thisType = itemType();
    ItemType otherType = other.itemType();

    if (thisType != otherType) {
      return thisType.compareTo(otherType);
    }

    return compareTo0(other);
  }
{@inheritDoc}

<p>Comparisons for this class are defined to be class-major (if the classes don't match then
the objects are not equal), with {@link #compareTo0} deciding same-class comparisons.
android/android_framework/dex-maker/src/main/java/com/android/dx/dex/file/OffsettedItem.java