private static void createSuperForwarder ( ClassNode targetNode , MethodNode forwarder , final Map < String , ClassNode > genericsSpec ) { List < ClassNode > interfaces = new ArrayList < ClassNode > ( Traits . collectAllInterfacesReverseOrder ( targetNode , new LinkedHashSet < ClassNode > ( ) ) ) ; String name = forwarder . getName ( ) ; Parameter [ ] forwarderParameters = forwarder . getParameters ( ) ; LinkedHashSet < ClassNode > traits = new LinkedHashSet < ClassNode > ( ) ; List < MethodNode > superForwarders = new LinkedList < MethodNode > ( ) ; for ( ClassNode node : interfaces ) { if ( Traits . isTrait ( node ) ) { MethodNode method = node . getDeclaredMethod ( name , forwarderParameters ) ; if ( method != null ) { // a similar method exists, we need a super bridge // trait$super$foo(Class currentTrait, ...) traits . add ( node ) ; superForwarders . add ( method ) ; } } } for ( MethodNode superForwarder : superForwarders ) { doCreateSuperForwarder ( targetNode , superForwarder , traits . toArray ( ClassNode . EMPTY_ARRAY ) , genericsSpec ) ; } }
Creates if necessary a super forwarder method for stackable traits .