@Override public boolean isBangVoid() { if (!checked) { isBangVoid = negatedPattern.getExactType().isVoid(); checked = true; } return isBangVoid; }
public List<UnresolvedType> getExactTypes() { List<UnresolvedType> ret = new ArrayList<UnresolvedType>(); for (int i = 0; i < typePatterns.length; i++) { UnresolvedType t = typePatterns[i].getExactType(); if (!ResolvedType.isMissing(t)) { ret.add(t); } } return ret; }
private static void setParentTypesOnDeclareParentsNode(DeclareParents decp, IProgramElement decpElement) { TypePatternList tpl = decp.getParents(); List<String> parents = new ArrayList<String>(); for (int i = 0; i < tpl.size(); i++) { parents.add(tpl.get(i).getExactType().getName().replaceAll("\\$", ".")); } decpElement.setParentTypes(parents); }
public boolean parentsIncludeInterface(World w) { for (int i = 0; i < parents.size(); i++) { if (parents.get(i).getExactType().resolve(w).isInterface()) { return true; } } return false; }
public boolean parentsIncludeClass(World w) { for (int i = 0; i < parents.size(); i++) { if (parents.get(i).getExactType().resolve(w).isClass()) { return true; } } return false; }
@Override protected boolean couldEverMatchSameTypesAs(TypePattern other) { if (super.couldEverMatchSameTypesAs(other)) { return true; } // false is necessary but not sufficient UnresolvedType otherType = other.getExactType(); if (!ResolvedType.isMissing(otherType)) { if (namePatterns.length > 0) { if (!namePatterns[0].matches(otherType.getName())) { return false; } } } if (other instanceof WildTypePattern) { WildTypePattern owtp = (WildTypePattern) other; String mySimpleName = namePatterns[0].maybeGetSimpleName(); String yourSimpleName = owtp.namePatterns[0].maybeGetSimpleName(); if (mySimpleName != null && yourSimpleName != null) { return (mySimpleName.startsWith(yourSimpleName) || yourSimpleName.startsWith(mySimpleName)); } } return true; }
@Override protected boolean couldEverMatchSameTypesAs(TypePattern other) { if (super.couldEverMatchSameTypesAs(other)) { return true; } // false is necessary but not sufficient UnresolvedType otherType = other.getExactType(); if (!ResolvedType.isMissing(otherType)) { return type.equals(otherType); } if (other instanceof WildTypePattern) { WildTypePattern owtp = (WildTypePattern) other; String yourSimpleNamePrefix = owtp.getNamePatterns()[0].maybeGetSimpleName(); if (yourSimpleNamePrefix != null) { return (type.getName().startsWith(yourSimpleNamePrefix)); } } return true; }
if ((upperBound != null) && ResolvedType.isMissing(upperBound.getExactType())) { canBeExact = false; if ((lowerBound != null) && ResolvedType.isMissing(lowerBound.getExactType())) { canBeExact = false; canBeExact = false; } else { ReferenceType upper = (ReferenceType) upperBound.getExactType().resolve(scope.getWorld()); type = new BoundedReferenceType(upper, true, scope.getWorld()); canBeExact = false; } else { ReferenceType lower = (ReferenceType) lowerBound.getExactType().resolve(scope.getWorld()); type = new BoundedReferenceType(lower, false, scope.getWorld());
protected Test exposeStateForVar(Var var,TypePattern type, ExposedState state, World world) { if (type instanceof BindingTypePattern) { BindingTypePattern b = (BindingTypePattern)type; state.set(b.getFormalIndex(), var); } ResolvedType myType = type.getExactType().resolve(world); if (myType.isParameterizedType()) { // unchecked warning already issued... myType = (ResolvedType) myType.getRawType(); } return Test.makeInstanceof(var, myType.resolve(world)); }
if (upperBound != null && ResolvedType.isMissing(upperBound.getExactType())) { canCreateExactTypePattern = false; if (lowerBound != null && ResolvedType.isMissing(lowerBound.getExactType())) { canCreateExactTypePattern = false; if (ResolvedType.isMissing(additionalInterfaceBounds[i].getExactType())) { canCreateExactTypePattern = false; TypeVariable tv = tvrType.getTypeVariable(); if (upperBound != null) { tv.setSuperclass(upperBound.getExactType()); ifBounds[i] = additionalInterfaceBounds[i].getExactType();
@Override protected FuzzyBoolean matchInternal(Shadow shadow) { if (!couldMatch(shadow)) { return FuzzyBoolean.NO; } UnresolvedType typeToMatch = isThis ? shadow.getThisType() : shadow.getTargetType(); // optimization for case of this(Object) or target(Object) // works for an ExactTypePattern (and we know there are no annotations to match here of course) if (typePattern.getExactType().equals(ResolvedType.OBJECT)) { return FuzzyBoolean.YES; } return typePattern.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC); }
public void resolveBindings(IScope scope, Bindings bindings) { exceptionType = exceptionType.resolveBindings(scope, bindings, false, false); boolean invalidParameterization = false; if (exceptionType.getTypeParameters().size() > 0) { invalidParameterization = true; } UnresolvedType exactType = exceptionType.getExactType(); if (exactType != null && exactType.isParameterizedType()) { invalidParameterization = true; } if (invalidParameterization) { // no parameterized or generic types for handler scope.message(MessageUtil.error(WeaverMessages.format(WeaverMessages.HANDLER_PCD_DOESNT_SUPPORT_PARAMETERS), getSourceLocation())); } // XXX add error if exact binding and not an exception }
@Override public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) { if (isDeclare(bindings.getEnclosingAdvice())) { // Enforce rule about which designators are supported in declare inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.THIS_OR_TARGET_IN_DECLARE, isThis ? "this" : "target"), bindings.getEnclosingAdvice().getSourceLocation(), null); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } TypePattern newType = typePattern.remapAdviceFormals(bindings); if (inAspect.crosscuttingMembers != null) { inAspect.crosscuttingMembers.exposeType(newType.getExactType()); } Pointcut ret = new ThisOrTargetPointcut(isThis, newType); ret.copyLocationFrom(this); return ret; }
if (typeParameters.areAllExactWithNoSubtypesAllowed()) { for (int i = 0; i < tvs.length; i++) { UnresolvedType ut = typeParamPatterns[i].getExactType(); boolean continueCheck = true;
if (parameterTypes[i].isTypeVariableReference() && p.getExactType().isTypeVariableReference()) { UnresolvedType One = ((TypeVariableReference) parameterTypes[i]).getTypeVariable().getFirstBound(); UnresolvedType Two = ((TypeVariableReference) p.getExactType()).getTypeVariable().getFirstBound(); reportProblem = !One.resolve(scope.getWorld()).isAssignableFrom(Two.resolve(scope.getWorld())); } else { reportProblem = !p.matchesSubtypes(parameterTypes[i]) && !p.getExactType().equals(UnresolvedType.OBJECT);
@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); }
continue; ResolvedType exactType = pi.getExactType().resolve(scope.getWorld()); if (exactType.isMissing()) { continue;
ResolvedType typeToExpose = type.getExactType().resolve(world); if (typeToExpose.isParameterizedType()) { boolean inDoubt = (type.matchesInstanceof(argRTX) == FuzzyBoolean.MAYBE);
UnresolvedType exactDeclaringType = signature.getDeclaringType().getExactType();
UnresolvedType iType = typePattern.getExactType(); ResolvedType parentType = iType.resolve(world);