/** * Constructs the BoundedReferenceType representing an unbounded wildcard '?'. In this situation the signature is '*' and the * erased signature is Ljava/lang/Object; */ public BoundedReferenceType(World world) { super("*", "Ljava/lang/Object;", world); this.kind = UNBOUND; upperBound = world.resolve(UnresolvedType.OBJECT); setDelegate(new BoundedReferenceTypeDelegate((ReferenceType) upperBound)); }
/** * only for use when resolving GenericsWildcardTypeX or a TypeVariableReferenceType */ protected BoundedReferenceType(String signature, String erasedSignature, World world) { super(signature, erasedSignature, world); if (signature.equals("*")) { // pure wildcard this.kind = UNBOUND; upperBound = world.resolve(UnresolvedType.OBJECT); } else { upperBound = world.resolve(forSignature(erasedSignature)); } setDelegate(new BoundedReferenceTypeDelegate((ReferenceType) upperBound)); }
public BoundedReferenceType(ReferenceType aBound, boolean isExtends, World world) { super((isExtends ? "+" : "-") + aBound.signature, aBound.signatureErasure, world); if (isExtends) { this.kind = EXTENDS; } else { this.kind = SUPER; } if (isExtends) { upperBound = aBound; } else { lowerBound = aBound; upperBound = world.resolve(UnresolvedType.OBJECT); } setDelegate(new BoundedReferenceTypeDelegate((ReferenceType) getUpperBound())); }
/** * For a TypeVariableReferenceType the delegate is the delegate for the first bound. */ @Override public ReferenceTypeDelegate getDelegate() { if (this.delegate == null) { ResolvedType resolvedFirstBound = typeVariable.getFirstBound().resolve(world); BoundedReferenceTypeDelegate brtd = null; if (resolvedFirstBound.isMissing()) { brtd = new BoundedReferenceTypeDelegate((ReferenceType) world.resolve(UnresolvedType.OBJECT)); setDelegate(brtd); // set now because getSourceLocation() below will cause a recursive step to discover the delegate world.getLint().cantFindType.signal( "Unable to find type for generic bound. Missing type is " + resolvedFirstBound.getName(), getSourceLocation()); } else { brtd = new BoundedReferenceTypeDelegate((ReferenceType) resolvedFirstBound); setDelegate(brtd); } } return this.delegate; }