private InterfaceDeclaration getMostDerivedControlInterface( InterfaceDeclaration controlIntfOrExt )
    {
        Queue<InterfaceDeclaration> q = new LinkedList<InterfaceDeclaration>();

        InterfaceDeclaration id = controlIntfOrExt;
        while ( id != null )
        {
            if ( id.getAnnotation(ControlInterface.class) != null )
                break;

            Collection<InterfaceType> supers = id.getSuperinterfaces();
            for ( InterfaceType s : supers )
                q.offer( s.getDeclaration() );

            id = q.poll();
        }

        return id;
    }
private InterfaceDeclaration getMostDerivedControlInterface ( InterfaceDeclaration controlIntfOrExt ) { Queue < InterfaceDeclaration > q = new LinkedList < InterfaceDeclaration > ( ) ; InterfaceDeclaration id = controlIntfOrExt ; while ( id != null ) { if ( id . getAnnotation ( ControlInterface . class ) != null ) break ; Collection < InterfaceType > supers = id . getSuperinterfaces ( ) ; for ( InterfaceType s : supers ) q . offer ( s . getDeclaration ( ) ) ; id = q . poll ( ) ; } return id ; }
Given a control interface or extension, do a BFS of its inheritance heirarchy for
the first one marked with @ControlInterface.  This represents the point in the
heirarchy where use of @ControlExtension changes to use of @ControlInterface.

@param controlIntfOrExt an interface annotated with @ControlInterface or @ControlExtension.
@return most derived interface in the heirarchy annotated with @ControlInterface, null
if no such interface found.