Example #1
0
 public WildcardType getWildcardType(TypeMirror extendsBound, TypeMirror superBound) {
   BoundKind bkind;
   Type bound;
   if (extendsBound == null && superBound == null) {
     bkind = BoundKind.UNBOUND;
     bound = syms.objectType;
   } else if (superBound == null) {
     bkind = BoundKind.EXTENDS;
     bound = (Type) extendsBound;
   } else if (extendsBound == null) {
     bkind = BoundKind.SUPER;
     bound = (Type) superBound;
   } else {
     throw new IllegalArgumentException("Extends and super bounds cannot both be provided");
   }
   switch (bound.getKind()) {
     case ARRAY:
     case DECLARED:
     case ERROR:
     case TYPEVAR:
       return new Type.WildcardType(bound, bkind, syms.boundClass);
     default:
       throw new IllegalArgumentException(bound.toString());
   }
 }