@ SuppressWarnings ( "unchecked" ) private < T > Node registerClass ( final Class < T > c ) throws ClassHierarchyException { if ( c . isArray ( ) ) { throw new UnsupportedOperationException ( "Can't register array types" ) ; } try { return getAlreadyBoundNode ( c ) ; } catch ( final NameResolutionException ignored ) { // node not bound yet } final Node n = buildPathToNode ( c ) ; if ( n instanceof ClassNode ) { final ClassNode < T > cn = ( ClassNode < T > ) n ; final Class < T > superclass = ( Class < T > ) c . getSuperclass ( ) ; if ( superclass != null ) { try { ( ( ClassNode < T > ) getAlreadyBoundNode ( superclass ) ) . putImpl ( cn ) ; } catch ( final NameResolutionException e ) { throw new IllegalStateException ( e ) ; } } for ( final Class < ? > interf : c . getInterfaces ( ) ) { try { ( ( ClassNode < T > ) getAlreadyBoundNode ( interf ) ) . putImpl ( cn ) ; } catch ( final NameResolutionException e ) { throw new IllegalStateException ( e ) ; } } } return n ; }
Assumes that all of the parents of c have been registered already .