@ Override public void visitEnd ( ) { // prepare class annotations if ( classAnnotations != null ) { annotations = classAnnotations . toArray ( new AnnotationInfo [ 0 ] ) ; classAnnotations = null ; } List < String > superList = new ArrayList <> ( ) ; Set < String > allInterfaces = new HashSet <> ( ) ; if ( nextInterfaces != null ) { allInterfaces . addAll ( nextInterfaces ) ; } // check all public super methods that are not overridden in superclass while ( nextSupername != null ) { InputStream inputStream = null ; ClassReader cr ; try { inputStream = ClassLoaderUtil . getClassAsStream ( nextSupername , classLoader ) ; cr = new ClassReader ( inputStream ) ; } catch ( IOException ioex ) { throw new ProxettaException ( "Unable to inspect super class: " + nextSupername , ioex ) ; } finally { StreamUtil . close ( inputStream ) ; } superList . add ( nextSupername ) ; superClassReaders . add ( cr ) ; // remember the super class reader cr . accept ( new SuperClassVisitor ( ) , 0 ) ; if ( cr . getInterfaces ( ) != null ) { Collections . addAll ( allInterfaces , cr . getInterfaces ( ) ) ; } } superClasses = superList . toArray ( new String [ 0 ] ) ; // check all interface methods that are not overridden in super-interface Set < String > todoInterfaces = new HashSet <> ( allInterfaces ) ; Set < String > newCollectedInterfaces = new HashSet <> ( ) ; while ( true ) { for ( String next : todoInterfaces ) { InputStream inputStream = null ; ClassReader cr ; try { inputStream = ClassLoaderUtil . getClassAsStream ( next , classLoader ) ; cr = new ClassReader ( inputStream ) ; } catch ( IOException ioex ) { throw new ProxettaException ( "Unable to inspect super interface: " + next , ioex ) ; } finally { StreamUtil . close ( inputStream ) ; } superClassReaders . add ( cr ) ; // remember the super class reader cr . accept ( new SuperClassVisitor ( ) , 0 ) ; if ( cr . getInterfaces ( ) != null ) { for ( String newInterface : cr . getInterfaces ( ) ) { if ( ! allInterfaces . contains ( newInterface ) && ! todoInterfaces . contains ( newInterface ) ) { // new interface found newCollectedInterfaces . add ( newInterface ) ; } } } } // perform collection allInterfaces . addAll ( todoInterfaces ) ; if ( newCollectedInterfaces . isEmpty ( ) ) { // no new interface found break ; } todoInterfaces . clear ( ) ; todoInterfaces . addAll ( newCollectedInterfaces ) ; newCollectedInterfaces . clear ( ) ; } }
Stores signatures for all super public methods not already overridden by target class . All this methods will be accepted for proxyfication .