public boolean hasIncompatibleSuperType(ReferenceBinding otherType){
  if (this == otherType)   return false;
  ReferenceBinding[] interfacesToVisit=null;
  int nextPosition=0;
  ReferenceBinding currentType=this;
  TypeBinding match;
  do {
    match=otherType.findSuperTypeOriginatingFrom(currentType);
    if (match != null && match.isProvablyDistinct(currentType))     return true;
    ReferenceBinding[] itsInterfaces=currentType.superInterfaces();
    if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
      if (interfacesToVisit == null) {
        interfacesToVisit=itsInterfaces;
        nextPosition=interfacesToVisit.length;
      }
 else {
        int itsLength=itsInterfaces.length;
        if (nextPosition + itsLength >= interfacesToVisit.length)         System.arraycopy(interfacesToVisit,0,interfacesToVisit=new ReferenceBinding[nextPosition + itsLength + 5],0,nextPosition);
        nextInterface:         for (int a=0; a < itsLength; a++) {
          ReferenceBinding next=itsInterfaces[a];
          for (int b=0; b < nextPosition; b++)           if (next == interfacesToVisit[b])           continue nextInterface;
          interfacesToVisit[nextPosition++]=next;
        }
      }
    }
  }
 while ((currentType=currentType.superclass()) != null);
  for (int i=0; i < nextPosition; i++) {
    currentType=interfacesToVisit[i];
    if (currentType == otherType)     return false;
    match=otherType.findSuperTypeOriginatingFrom(currentType);
    if (match != null && match.isProvablyDistinct(currentType))     return true;
    ReferenceBinding[] itsInterfaces=currentType.superInterfaces();
    if (itsInterfaces != null && itsInterfaces != Binding.NO_SUPERINTERFACES) {
      int itsLength=itsInterfaces.length;
      if (nextPosition + itsLength >= interfacesToVisit.length)       System.arraycopy(interfacesToVisit,0,interfacesToVisit=new ReferenceBinding[nextPosition + itsLength + 5],0,nextPosition);
      nextInterface:       for (int a=0; a < itsLength; a++) {
        ReferenceBinding next=itsInterfaces[a];
        for (int b=0; b < nextPosition; b++)         if (next == interfacesToVisit[b])         continue nextInterface;
        interfacesToVisit[nextPosition++]=next;
      }
    }
  }
  return false;
}

public boolean hasIncompatibleSuperType ( ReferenceBinding otherType ) { if ( this == otherType ) return false ; ReferenceBinding [ ] interfacesToVisit = null ; int nextPosition = 0 ; ReferenceBinding currentType = this ; TypeBinding match ; do { match = otherType . findSuperTypeOriginatingFrom ( currentType ) ; if ( match != null && match . isProvablyDistinct ( currentType ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { if ( interfacesToVisit == null ) { interfacesToVisit = itsInterfaces ; nextPosition = interfacesToVisit . length ; } else { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , 0 , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + 5 ] , 0 , nextPosition ) ; nextInterface : for ( int a = 0 ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = 0 ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } } while ( ( currentType = currentType . superclass ( ) ) != null ) ; for ( int i = 0 ; i < nextPosition ; i ++ ) { currentType = interfacesToVisit [ i ] ; if ( currentType == otherType ) return false ; match = otherType . findSuperTypeOriginatingFrom ( currentType ) ; if ( match != null && match . isProvablyDistinct ( currentType ) ) return true ; ReferenceBinding [ ] itsInterfaces = currentType . superInterfaces ( ) ; if ( itsInterfaces != null && itsInterfaces != Binding . NO_SUPERINTERFACES ) { int itsLength = itsInterfaces . length ; if ( nextPosition + itsLength >= interfacesToVisit . length ) System . arraycopy ( interfacesToVisit , 0 , interfacesToVisit = new ReferenceBinding [ nextPosition + itsLength + 5 ] , 0 , nextPosition ) ; nextInterface : for ( int a = 0 ; a < itsLength ; a ++ ) { ReferenceBinding next = itsInterfaces [ a ] ; for ( int b = 0 ; b < nextPosition ; b ++ ) if ( next == interfacesToVisit [ b ] ) continue nextInterface ; interfacesToVisit [ nextPosition ++ ] = next ; } } } return false ; }
returns true if the two types have an incompatible common supertype , e . g . list < string > and list < integer >
