if (type.isTypeVariableReference()) { if (debug) { System.err.println("Not putting a type variable reference type into the typemap: key=" + key + " type=" + type);
/** * Some TypeFactory operations create resolved types directly, but these won't be in the typeMap - this resolution process puts * them there. Resolved types are also told their world which is needed for the special autoboxing resolved types. */ public ResolvedType resolve(ResolvedType ty) { if (ty.isTypeVariableReference()) { return ty; // until type variables have proper sigs... } ResolvedType resolved = typeMap.get(ty.getSignature()); if (resolved == null) { resolved = ensureRawTypeIfNecessary(ty); typeMap.put(ty.getSignature(), resolved); resolved = ty; } resolved.world = this; return resolved; }
protected boolean matchesSubtypes(ResolvedType type) { // System.out.println("matching: " + this + " to " + type); if (matchesExactly(type)) { return true; } // pr124808 Iterator<ResolvedType> typesIterator = null; if (type.isTypeVariableReference()) { typesIterator = ((TypeVariableReference) type).getTypeVariable().getFirstBound().resolve(type.getWorld()) .getDirectSupertypes(); } else { // pr223605 if (type.isRawType()) { type = type.getGenericType(); } typesIterator = type.getDirectSupertypes(); } for (Iterator<ResolvedType> i = typesIterator; i.hasNext();) { ResolvedType superType = i.next(); if (matchesSubtypes(superType, type)) { return true; } } return false; }
@Override protected void resolveBindings(IScope scope, Bindings bindings) { if (!scope.getWorld().isInJava5Mode()) { scope.message(MessageUtil.error(WeaverMessages.format(isThis ? WeaverMessages.ATTHIS_ONLY_SUPPORTED_AT_JAVA5_LEVEL : WeaverMessages.ATTARGET_ONLY_SUPPORTED_AT_JAVA5_LEVEL), getSourceLocation())); return; } annotationTypePattern = (ExactAnnotationTypePattern) annotationTypePattern.resolveBindings(scope, bindings, true); // must be either a Var, or an annotation type pattern // if annotationType does not have runtime retention, this is an error if (annotationTypePattern.annotationType == null) { // it's a formal with a binding error return; } ResolvedType rAnnotationType = (ResolvedType) annotationTypePattern.annotationType; if (rAnnotationType.isTypeVariableReference()) { return; // we'll deal with this next check when the type var is actually bound... } verifyRuntimeRetention(rAnnotationType); }
ResolvedType pLookingFor = lookingForParams[j].resolve(world); if (pMember.isTypeVariableReference()) { pMember = ((TypeVariableReference) pMember).getTypeVariable().getFirstBound().resolve(world); if (pLookingFor.isTypeVariableReference()) { pLookingFor = ((TypeVariableReference) pLookingFor).getTypeVariable().getFirstBound() .resolve(world);
@Override protected boolean matchesExactly(ResolvedType matchType, ResolvedType annotatedType) { boolean typeMatch = this.type.equals(matchType); if (!typeMatch && (matchType.isParameterizedType() || matchType.isGenericType())) { typeMatch = this.type.equals(matchType.getRawType()); } if (!typeMatch && matchType.isTypeVariableReference()) { typeMatch = matchesTypeVariable((TypeVariableReferenceType) matchType); } annotationPattern.resolve(matchType.getWorld()); boolean annMatch = false; if (annotatedType.temporaryAnnotationTypes != null) { annMatch = annotationPattern.matches(annotatedType, annotatedType.temporaryAnnotationTypes).alwaysTrue(); } else { annMatch = annotationPattern.matches(annotatedType).alwaysTrue(); } return (typeMatch && annMatch); }
@Override protected boolean matchesExactly(ResolvedType matchType) { boolean typeMatch = this.type.equals(matchType); if (!typeMatch && (matchType.isParameterizedType() || matchType.isGenericType())) { typeMatch = this.type.equals(matchType.getRawType()); } if (!typeMatch && matchType.isTypeVariableReference()) { typeMatch = matchesTypeVariable((TypeVariableReferenceType) matchType); } if (!typeMatch) { return false; } annotationPattern.resolve(matchType.getWorld()); boolean annMatch = false; if (matchType.temporaryAnnotationTypes != null) { annMatch = annotationPattern.matches(matchType, matchType.temporaryAnnotationTypes).alwaysTrue(); } else { annMatch = annotationPattern.matches(matchType).alwaysTrue(); } return (typeMatch && annMatch); }
.isTypeVariableReference()) { TypeVariableReferenceType tvrt = (TypeVariableReferenceType) myTypeParameters[i]; TypeVariable tv = tvrt.getTypeVariable(); .isTypeVariableReference()) { TypeVariableReferenceType tvrt = (TypeVariableReferenceType) theirTypeParameters[i]; TypeVariable tv = tvrt.getTypeVariable();
if (!rty.isTypeVariableReference() || ((TypeVariableReferenceType) rty).isTypeVariableResolved()) { return rty;
if (myParameters[i].isTypeVariableReference() && theirParameters[i].isTypeVariableReference()) { TypeVariable myTV = ((TypeVariableReferenceType) myParameters[i]) .getTypeVariable(); if (isTypeVariableReference() && !other.isTypeVariableReference()) { TypeVariable aVar = ((TypeVariableReference) this) .getTypeVariable(); if (other.isTypeVariableReference()) { TypeVariableReferenceType otherType = (TypeVariableReferenceType) other; if (this instanceof TypeVariableReference) {
if (aType.isTypeVariableReference()
searchType = scope.getEnclosingType(); if (searchType.isTypeVariableReference()) { searchType = ((TypeVariableReference) searchType).getTypeVariable().getFirstBound().resolve(scope.getWorld()); if (parameterTypes[i].isTypeVariableReference() && p.getExactType().isTypeVariableReference()) { UnresolvedType One = ((TypeVariableReference) parameterTypes[i]).getTypeVariable().getFirstBound(); UnresolvedType Two = ((TypeVariableReference) p.getExactType()).getTypeVariable().getFirstBound();
@Override public void resolve(IScope scope) { exception = exception.resolveBindings(scope, null, false, true); ResolvedType excType = exception.getExactType().resolve(scope.getWorld()); if (!excType.isMissing()) { if (excType.isTypeVariableReference()) { TypeVariableReferenceType typeVariableRT = (TypeVariableReferenceType) excType; // a declare soft in a generic abstract aspect, we need to check the upper bound // WIBBLE excType = typeVariableRT.getTypeVariable().getFirstBound().resolve(scope.getWorld()); } if (!scope.getWorld().getCoreType(UnresolvedType.THROWABLE).isAssignableFrom(excType)) { scope.getWorld() .showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.NOT_THROWABLE, excType.getName()), exception.getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } // ENH 42743 suggests that we don't soften runtime exceptions. if (scope.getWorld().getCoreType(UnresolvedType.RUNTIME_EXCEPTION).isAssignableFrom(excType)) { scope.getWorld().getLint().runtimeExceptionNotSoftened.signal(new String[] { excType.getName() }, exception .getSourceLocation(), null); pointcut = Pointcut.makeMatchesNothing(Pointcut.RESOLVED); return; } } pointcut = pointcut.resolve(scope); }
&& !exactType.isTypeVariableReference()) { scope.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.CLASSES_IN_PRECEDENCE, exactType.getName()), pi.getSourceLocation(),