private static WildcardType canonicalizeWildcardType ( TypeVariable < ? > declaration , WildcardType type ) { Type [ ] declared = declaration . getBounds ( ) ; List < Type > upperBounds = new ArrayList <> ( ) ; for ( Type bound : type . getUpperBounds ( ) ) { if ( ! any ( declared ) . isSubtypeOf ( bound ) ) { upperBounds . add ( canonicalizeWildcardsInType ( bound ) ) ; } } return new Types . WildcardTypeImpl ( type . getLowerBounds ( ) , upperBounds . toArray ( new Type [ 0 ] ) ) ; }
Just don t ever let the user access it .