public BindingScope(ResolvedType type, ISourceContext sourceContext, FormalBinding[] bindings) { super(type.getWorld(), bindings); this.enclosingType = type; this.sourceContext = sourceContext; }
public CrosscuttingMembers(ResolvedType inAspect, boolean shouldConcretizeIfNeeded) { this.inAspect = inAspect; world = inAspect.getWorld(); this.shouldConcretizeIfNeeded = shouldConcretizeIfNeeded; }
public BcelAccessForInlineMunger(ResolvedType aspectType) { super(null, aspectType); if (aspectType.getWorld().isXnoInline()) { throw new Error("This should not happen"); } }
/** * Parameterize the Checker by parameterizing the pointcut */ @Override public ShadowMunger parameterizeWith(ResolvedType declaringType, Map<String, UnresolvedType> typeVariableMap) { Checker ret = new Checker(this.pointcut.parameterizeWith(typeVariableMap, declaringType.getWorld()), this.start, this.end, this.sourceContext, this.message, this.isError); return ret; }
@Override protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { annotationPattern.resolve(type.getWorld()); return annotationPattern.matches(annotatedType).alwaysTrue(); }
public static ResolvedType makeArray(ResolvedType type, int dim) { if (dim == 0) { return type; } ResolvedType array = new ArrayReferenceType("[" + type.getSignature(), "[" + type.getErasureSignature(), type.getWorld(), type); return makeArray(array, dim - 1); }
public boolean match(ResolvedType typeX) { if (!child.matchesStatically(typeX)) { return false; } if (typeX.getWorld().getLint().typeNotExposedToWeaver.isEnabled() && !typeX.isExposedToWeaver()) { typeX.getWorld().getLint().typeNotExposedToWeaver.signal(typeX.getName(), getSourceLocation()); } return true; }
/** * For declare atType. */ public boolean matches(ResolvedType type) { if (!typePattern.matchesStatically(type)) { return false; } if (type.getWorld().getLint().typeNotExposedToWeaver.isEnabled() && !type.isExposedToWeaver()) { type.getWorld().getLint().typeNotExposedToWeaver.signal(type.getName(), getSourceLocation()); } return true; }
public ResolvedType parameterizedWith(UnresolvedType[] typeParameters) { if (!(isGenericType() || isParameterizedType())) { return this; } return TypeFactory.createParameterizedType(this.getGenericType(), typeParameters, getWorld()); }
public void visit(HasAnnotation hasAnnotation) { ReflectionVar v = (ReflectionVar) hasAnnotation.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType actualVarType = world.resolve(value.getClass().getName()); ResolvedType requiredAnnotationType = hasAnnotation.getAnnotationType().resolve(world); matches = actualVarType.hasAnnotation(requiredAnnotationType); }
public static ResolvedMember perObjectField(UnresolvedType declaringType, ResolvedType aspectType) { int modifiers = Modifier.PRIVATE; if (!UnresolvedType.SERIALIZABLE.resolve(aspectType.getWorld()).isAssignableFrom(aspectType)) { modifiers |= Modifier.TRANSIENT; } return new ResolvedMemberImpl(Member.FIELD, declaringType, modifiers, aspectType, NameMangler.perObjectInterfaceField(aspectType), UnresolvedType.NONE); }
public void visit(Instanceof instanceofTest) { ReflectionVar v = (ReflectionVar) instanceofTest.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType desiredType = instanceofTest.getType().resolve(world); if (value == null) { matches = false; } else { ResolvedType actualType = world.resolve(value.getClass().getName()); matches = desiredType.isAssignableFrom(actualType); } }
@Override protected boolean matchesExactly(ResolvedType type) { annotationPattern.resolve(type.getWorld()); boolean b = false; if (type.temporaryAnnotationTypes != null) { b = annotationPattern.matches(type, type.temporaryAnnotationTypes).alwaysTrue(); } else { b = annotationPattern.matches(type).alwaysTrue(); } return b; }
/** * @see org.aspectj.weaver.TypePattern#matchesInstanceof(IType) */ @Override public FuzzyBoolean matchesInstanceof(ResolvedType type) { // XXX hack to let unmatched types just silently remain so if (maybeGetSimpleName() != null) { return FuzzyBoolean.NO; } type.getWorld().getMessageHandler().handleMessage( new Message("can't do instanceof matching on patterns with wildcards", IMessage.ERROR, null, getSourceLocation())); return FuzzyBoolean.NO; }
public boolean isVisible(ResolvedType fromType) { UnresolvedType declaringType = getDeclaringType(); ResolvedType type = null; if (fromType.equals(declaringType)) { type = fromType; } else { World world = fromType.getWorld(); type = declaringType.resolve(world); } return ResolvedType.isVisible(getModifiers(), type, fromType); }
private void verifyRuntimeRetention(ResolvedType rAnnotationType) { if (!(rAnnotationType.isAnnotationWithRuntimeRetention())) { IMessage m = MessageUtil.error(WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION, rAnnotationType.getName()), getSourceLocation()); rAnnotationType.getWorld().getMessageHandler().handleMessage(m); } }
@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.IF_IN_DECLARE), bindings.getEnclosingAdvice().getSourceLocation(), null); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } return makeIfFalsePointcut(state); }
@Override public ShadowMunger parameterizeWith(ResolvedType declaringType, Map<String, UnresolvedType> typeVariableMap) { Pointcut pc = getPointcut().parameterizeWith(typeVariableMap, declaringType.getWorld()); BcelAdvice ret = null; Member adviceSignature = signature; // allows for around advice where the return value is a type variable (see pr115250) if (signature instanceof ResolvedMember && signature.getDeclaringType().isGenericType()) { adviceSignature = ((ResolvedMember) signature).parameterizedWith(declaringType.getTypeParameters(), declaringType, declaringType.isParameterizedType()); } ret = new BcelAdvice(this.attribute, pc, adviceSignature, this.concreteAspect); return ret; }
@Override protected boolean matchesExactly(ResolvedType type, ResolvedType annotatedType) { String targetTypeName = type.getName(); // System.err.println("match: " + targetTypeName + ", " + knownMatches); //Arrays.asList(importedPrefixes)); // Ensure the annotation pattern is resolved annotationPattern.resolve(type.getWorld()); return matchesExactlyByName(targetTypeName, type.isAnonymous(), type.isNested()) && matchesParameters(type, STATIC) && matchesBounds(type, STATIC) && annotationPattern.matches(annotatedType, type.temporaryAnnotationTypes).alwaysTrue(); }
protected 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.ARGS_IN_DECLARE), bindings.getEnclosingAdvice().getSourceLocation(), null); return Pointcut.makeMatchesNothing(Pointcut.CONCRETE); } AnnotationPatternList list = arguments.resolveReferences(bindings); Pointcut ret = new ArgsAnnotationPointcut(list); ret.copyLocationFrom(this); return ret; }