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; }
private void addCustomMungers() { if (customMungerFactory != null) { for (Iterator<UnwovenClassFile> i = addedClasses.iterator(); i.hasNext();) { UnwovenClassFile jc = i.next(); String name = jc.getClassName(); ResolvedType type = world.resolve(name); if (type.isAspect()) { Collection<ShadowMunger> shadowMungers = customMungerFactory.createCustomShadowMungers(type); if (shadowMungers != null) { shadowMungerList.addAll(shadowMungers); } Collection<ConcreteTypeMunger> typeMungers = customMungerFactory.createCustomTypeMungers(type); if (typeMungers != null) { typeMungerList.addAll(typeMungers); } } } } }
private List<ResolvedType> addAspectsFromJarFile(File inFile) throws FileNotFoundException, IOException { ZipInputStream inStream = new ZipInputStream(new FileInputStream(inFile)); // ??? buffered List<ResolvedType> addedAspects = new ArrayList<ResolvedType>(); try { while (true) { ZipEntry entry = inStream.getNextEntry(); if (entry == null) { break; } if (entry.isDirectory() || !entry.getName().endsWith(".class")) { continue; } // FIXME ASC performance? of this alternative soln. int size = (int) entry.getSize(); ClassParser parser = new ClassParser(new ByteArrayInputStream(FileUtil.readAsByteArray(inStream)), entry.getName()); JavaClass jc = parser.parse(); inStream.closeEntry(); ResolvedType type = world.addSourceObjectType(jc, false).getResolvedTypeX(); type.setBinaryPath(inFile.getAbsolutePath()); if (type.isAspect()) { addedAspects.add(type); } else { world.demote(type); } } } finally { inStream.close(); } return addedAspects; }
public final List<Declare> collectDeclares(boolean includeAdviceLike) { if (!this.isAspect()) { return Collections.emptyList();
if (type.isAspect()) { return type; } else {
if (type != null && !type.isAspect() && !type.equals(UnresolvedType.OBJECT) && !type.isPrimitiveType()) { List<ConcreteTypeMunger> typeMungers = type.getInterTypeMungers(); if (typeMungers == null || typeMungers.size() == 0) { continue; if (type != null && !type.isAspect() && !type.equals(UnresolvedType.OBJECT) && !type.isPrimitiveType()) { List<ConcreteTypeMunger> typeMungers = type.getInterTypeMungers(); if (typeMungers == null || typeMungers.size() == 0) {
public void check(World world) { if (getSignature().getDeclaringType().resolve(world).isAspect()) { world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_CONS_ON_ASPECT), getSignature() .getSourceLocation(), null); } }
/** * @return true if the supplied type is of the category specified for this type pattern */ private boolean isRightCategory(ResolvedType type) { switch (category) { case CLASS: return type.isClass(); case INTERFACE: return type.isInterface(); case ASPECT: return type.isAspect(); case ANONYMOUS: return type.isAnonymous(); case INNER: return type.isNested(); case ENUM: return type.isEnum(); case ANNOTATION: return type.isAnnotation(); case FINAL: return Modifier.isFinal(type.getModifiers()); } return false; }
if (type.isAspect()) { needToReweaveWorld |= xcutSet.addOrReplaceAspect(type);
if (!(parent.isAspect() || parent.equals(ResolvedType.OBJECT))) { reportError("Attempt to concretize a non aspect: " + stringify()); return false;
String className = classFile.getClassName(); ResolvedType theType = world.resolve(className); if (theType.isAspect()) { BcelObjectType classType = BcelWorld.getBcelObjectType(theType); if (classType == null) { String className = classFile.getClassName(); ResolvedType theType = world.resolve(className); if (!theType.isAspect()) { BcelObjectType classType = BcelWorld.getBcelObjectType(theType); if (classType == null) {
/** * 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; }
if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType = new HashSet<String>(); if (clazz.getType().isAspect()) { isChanged = true; if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature()); if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.addAll(findAspectsForMungers(member)); if (typeMungerAffectedType) { isChanged = true; if (inReweavableMode || clazz.getType().isAspect()) { aspectsAffectingType.add(munger.getAspectType().getSignature());
boolean fastMatchingOnAspect = info.getType().isAspect();
if (hasAtAspectJAnnotation && !type.isAspect()) { // isAnnotationStyleAspect())
if (!exactType.isAspect() && !exactType.isAnnotationStyleAspect() && !pi.isIncludeSubtypes() && !exactType.isTypeVariableReference()) { scope.getWorld().showMessage(IMessage.ERROR,