Type copyType(Type bound) { return new WildcardType(bound, isExtends, annotationArray()); }
public String toString() { StringBuilder builder = new StringBuilder(); appendAnnotations(builder); builder.append('?'); if (isExtends && bound != OBJECT) { builder.append(" extends ").append(bound); } if (!isExtends && bound != null) { builder.append(" super ").append(bound); } return builder.toString(); }
private static String getBindingKey(WildcardType type) { if (type.extendsBound() != null) { return "+" + getGeneralTypeBindingKey(type.extendsBound()); } else if (type.superBound() != null) { return "-" + getGeneralTypeBindingKey(type.superBound()); } else { return "*"; } }
/** * Create a new mock instance of WildcardType. * * @param bound the bound (lower or upper) * @param isExtends true if lower, false if upper (super) * @return thew new mock instance * * @since 2.1 */ public static WildcardType create(Type bound, boolean isExtends) { return new WildcardType(bound, isExtends); }
private Type searchTypePath(Type type, TypeAnnotationState typeAnnotationState) { PathElementStack elements = typeAnnotationState.pathElements; PathElement element = elements.pop(); if (element == null) { return type; } switch (element.kind) { case ARRAY: { ArrayType arrayType = type.asArrayType(); int dimensions = arrayType.dimensions(); while (--dimensions > 0 && elements.size() > 0 && elements.peek().kind == PathElement.Kind.ARRAY) { elements.pop(); } assert dimensions == 0; return searchTypePath(arrayType.component(), typeAnnotationState); } case PARAMETERIZED: { ParameterizedType parameterizedType = type.asParameterizedType(); return searchTypePath(parameterizedType.argumentsArray()[element.pos], typeAnnotationState); } case WILDCARD_BOUND: { return searchTypePath(type.asWildcardType().bound(), typeAnnotationState); } case NESTED: { int depth = popNestedDepth(elements); return searchNestedType(type, depth, typeAnnotationState); } } throw new IllegalStateException("Unknown path element"); }
@Override Type copyType(AnnotationInstance[] newAnnotations) { return new WildcardType(bound, isExtends, newAnnotations); }
break; case WILDCARD_TYPE: addType(type.asWildcardType().bound()); break; case PARAMETERIZED_TYPE:
private Type parseWildCard(boolean isExtends) { Type bound = parseReferenceType(); return new WildcardType(bound, isExtends); }
Type bound = typeTable[stream.readPackedU32()]; AnnotationInstance[] annotations = readAnnotations(stream, null); return new WildcardType(bound, isExtends, annotations);