List < List < MessageType > > normalizeTypes ( int idx , List < MessageType > msgTypes ) { if ( msgTypes . size ( ) == idx ) return Collections . singletonList ( Collections . emptyList ( ) ) ; MessageType head = msgTypes . get ( idx ) ; List < List < MessageType > > buf = new ArrayList <> ( ) ; for ( MessageType alternative : head . accept ( normalizeVisitor , null ) ) { for ( List < MessageType > rest : normalizeTypes ( idx + 1 , msgTypes ) ) { List < MessageType > temp = new ArrayList <> ( rest ) ; temp . add ( 0 , alternative ) ; buf . add ( temp ) ; } } return buf ; }
Normalize parsed types in a comment line . If one or more types in the line contains alternatives this routine generate a list of overloaded normalized signatures .