private void addDirectSubTypes ( XClass type , ArrayList subTypes ) { if ( type . isInterface ( ) ) { if ( type . getExtendingInterfaces ( ) != null ) { subTypes . addAll ( type . getExtendingInterfaces ( ) ) ; } // we have to traverse the implementing classes as these array contains all classes that // implement the interface, not only those who have an "implement" declaration // note that for whatever reason the declared interfaces are not exported via the XClass interface // so we have to get them via the underlying class which is hopefully a subclass of AbstractClass if ( type . getImplementingClasses ( ) != null ) { Collection declaredInterfaces = null ; XClass subType ; for ( Iterator it = type . getImplementingClasses ( ) . iterator ( ) ; it . hasNext ( ) ; ) { subType = ( XClass ) it . next ( ) ; if ( subType instanceof AbstractClass ) { declaredInterfaces = ( ( AbstractClass ) subType ) . getDeclaredInterfaces ( ) ; if ( ( declaredInterfaces != null ) && declaredInterfaces . contains ( type ) ) { subTypes . add ( subType ) ; } } else { // Otherwise we have to live with the bug subTypes . add ( subType ) ; } } } } else { subTypes . addAll ( type . getDirectSubclasses ( ) ) ; } }
Adds all direct subtypes to the given list .