private List < Type > closureMin ( List < Type > cl ) { ListBuffer < Type > classes = new ListBuffer <> ( ) ; ListBuffer < Type > interfaces = new ListBuffer <> ( ) ; Set < Type > toSkip = new HashSet <> ( ) ; while ( ! cl . isEmpty ( ) ) { Type current = cl . head ; boolean keep = ! toSkip . contains ( current ) ; if ( keep && current . hasTag ( TYPEVAR ) ) { // skip lower-bounded variables with a subtype in cl.tail for ( Type t : cl . tail ) { if ( isSubtypeNoCapture ( t , current ) ) { keep = false ; break ; } } } if ( keep ) { if ( current . isInterface ( ) ) interfaces . append ( current ) ; else classes . append ( current ) ; for ( Type t : cl . tail ) { // skip supertypes of 'current' in cl.tail if ( isSubtypeNoCapture ( current , t ) ) toSkip . add ( t ) ; } } cl = cl . tail ; } return classes . appendList ( interfaces ) . toList ( ) ; }
Return the minimum types of a closure suitable for computing compoundMin or glb .