private void addShadowMunger(ShadowMunger m) { if (inAspect.isAbstract()) { return; // mungers for abstract aspects are not added } addConcreteShadowMunger(m.concretize(inAspect, world, perClause)); }
private final List<ShadowMunger> collectShadowMungers() { if (!this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers()) { return Collections.emptyList(); } List<ShadowMunger> acc = new ArrayList<ShadowMunger>(); final Iterators.Filter<ResolvedType> dupFilter = Iterators.dupFilter(); Iterators.Getter<ResolvedType, ResolvedType> typeGetter = new Iterators.Getter<ResolvedType, ResolvedType>() { @Override public Iterator<ResolvedType> get(ResolvedType o) { return dupFilter.filter((o).getDirectSupertypes()); } }; Iterator<ResolvedType> typeIterator = Iterators.recur(this, typeGetter); while (typeIterator.hasNext()) { ResolvedType ty = typeIterator.next(); acc.addAll(ty.getDeclaredShadowMungers()); } return acc; }
if (!this.isAbstract()) {
public List<ResolvedMember> getExposedPointcuts() { List<ResolvedMember> ret = new ArrayList<ResolvedMember>(); if (getSuperclass() != null) { ret.addAll(getSuperclass().getExposedPointcuts()); } for (ResolvedType type : getDeclaredInterfaces()) { addPointcutsResolvingConflicts(ret, Arrays.asList(type.getDeclaredPointcuts()), false); } addPointcutsResolvingConflicts(ret, Arrays.asList(getDeclaredPointcuts()), true); for (ResolvedMember member : ret) { ResolvedPointcutDefinition inherited = (ResolvedPointcutDefinition) member; if (inherited != null && inherited.isAbstract()) { if (!this.isAbstract()) { getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.POINCUT_NOT_CONCRETE, inherited, this.getName()), inherited.getSourceLocation(), this.getSourceLocation()); } } } return ret; }
if (aspectType.isAbstract()) {
if (!(parent.isAbstract() || parent.equals(ResolvedType.OBJECT))) { reportError("Attempt to concretize a non-abstract aspect: " + stringify()); return false;
public PerClause concretize(ResolvedType inAspect) { PerCflow ret = new PerCflow(entry, isBelow); ret.inAspect = inAspect; if (inAspect.isAbstract()) { return ret; if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { inAspect.crosscuttingMembers.addLateTypeMunger(inAspect.getWorld().getWeavingSupport() .makePerClauseAspect(inAspect, getKind()));
/** * Check if any parent aspects of the supplied aspect have unresolved dependencies (and so * should cause this aspect to be turned off). * @param aspectType the aspect whose parents should be checked * @return true if this aspect should be excluded because of a parents' missing dependencies */ private boolean excludeDueToParentAspectHavingUnresolvedDependency(ResolvedType aspectType) { ResolvedType parent = aspectType.getSuperclass(); boolean excludeDueToParent = false; while (parent != null) { if (parent.isAspect() && parent.isAbstract() && world.hasUnsatisfiedDependency(parent)) { if (!world.getMessageHandler().isIgnoring(IMessage.INFO)) { world.getMessageHandler().handleMessage( MessageUtil.info("deactivating aspect '" + aspectType.getName() + "' as the parent aspect '"+parent.getName()+ "' has unsatisfied dependencies")); } excludeDueToParent = true; } parent = parent.getSuperclass(); } return excludeDueToParent; }
public PerClause concretize(ResolvedType inAspect) { PerObject ret = new PerObject(entry, isThis); ret.inAspect = inAspect; if (inAspect.isAbstract()) { return ret; } World world = inAspect.getWorld(); Pointcut concreteEntry = entry.concretize(inAspect, inAspect, 0, null); // concreteEntry = new AndPointcut(this, concreteEntry); // concreteEntry.state = Pointcut.CONCRETE; inAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makePerObjectEntry(world, concreteEntry, isThis, inAspect)); // FIXME AV - don't use lateMunger here due to test // "inheritance, around advice and abstract pointcuts" // see #75442 thread. Issue with weaving order. ResolvedTypeMunger munger = new PerObjectInterfaceTypeMunger(inAspect, concreteEntry); inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().concreteTypeMunger(munger, inAspect)); // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { inAspect.crosscuttingMembers.addLateTypeMunger(inAspect.getWorld().getWeavingSupport().makePerClauseAspect(inAspect, getKind())); } // ATAJ inline around advice support - don't use a late munger to allow // around inling for itself if (inAspect.isAnnotationStyleAspect() && !inAspect.getWorld().isXnoInline()) { inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().createAccessForInlineMunger(inAspect)); } return ret; }
ret.copyLocationFrom(this); ret.inAspect = inAspect; if (inAspect.isAbstract()) { return ret; if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind()));
if (!struct.enclosingType.getSuperclass().isAbstract() && struct.enclosingType.getSuperclass().isAspect()) { reportError("cannot extend a concrete aspect", struct); return false;
public PerClause concretize(ResolvedType inAspect) { PerSingleton ret = new PerSingleton(); ret.copyLocationFrom(this); World world = inAspect.getWorld(); ret.inAspect = inAspect; // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) { // TODO will those change be ok if we add a serializable aspect ? // dig: // "can't be Serializable/Cloneable unless -XserializableAspects" if (getKind() == SINGLETON) { // pr149560 inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind())); } else { inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind())); } } // ATAJ inline around advice support if (inAspect.isAnnotationStyleAspect() && !inAspect.getWorld().isXnoInline()) { inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().createAccessForInlineMunger(inAspect)); } return ret; }
/** * Check: 1) That we don't have any abstract type mungers unless this type is abstract. 2) That an abstract ITDM on an interface * is declared public. (Compiler limitation) (PR70794) */ public void checkInterTypeMungers() { if (isAbstract()) { return; } boolean itdProblem = false; for (ConcreteTypeMunger munger : getInterTypeMungersIncludingSupers()) { itdProblem = checkAbstractDeclaration(munger) || itdProblem; // Rule 2 } if (itdProblem) { return; // If the rules above are broken, return right now } for (ConcreteTypeMunger munger : getInterTypeMungersIncludingSupers()) { if (munger.getSignature() != null && munger.getSignature().isAbstract() && munger.getMunger().getKind()!=ResolvedTypeMunger.PrivilegedAccess) { // Rule 1 if (munger.getMunger().getKind() == ResolvedTypeMunger.MethodDelegate2) { // ignore for @AJ ITD as munger.getSignature() is the // interface method hence abstract } else { world.getMessageHandler() .handleMessage( new Message("must implement abstract inter-type declaration: " + munger.getSignature(), "", IMessage.ERROR, getSourceLocation(), null, new ISourceLocation[] { getMungerLocation(munger) })); } } } }
scope.message(IMessage.ERROR, this, "can't make static reference to abstract pointcut"); return; } else if (!searchType.isAbstract()) { scope.message(IMessage.ERROR, this, "can't use abstract pointcut in concrete context"); return;