* up before the inter-type declaration weaving stage (unsurprisingly).
*
* All members are concrete.
+ *
+ * @author Jim Hugunin
*/
-
public class CrosscuttingMembers {
private ResolvedTypeX inAspect;
private World world;
public boolean replaceWith(CrosscuttingMembers other) {
boolean changed = false;
+ //XXX what if perClause is null
if (!perClause.equals(other.perClause)) {
changed = true;
perClause = other.perClause;
}
//XXX all of the below should be set equality rather than list equality
+ //System.err.println("old: " + shadowMungers + " new: " + other.shadowMungers);
if (!shadowMungers.equals(other.shadowMungers)) {
changed = true;
shadowMungers = other.shadowMungers;
/**
* This holds on to all CrosscuttingMembers for a world. It handles
* management of change.
+ *
+ * @author Jim Hugunin
*/
-
public class CrosscuttingMembersSet {
private World world;
private Map members = new HashMap();
}
}
- public void deleteAspect(TypeX aspectType) {
- members.remove(aspectType);
+ public boolean deleteAspect(TypeX aspectType) {
+ boolean isAspect = members.remove(aspectType) != null;
clearCaches();
+ return isAspect;
}
//XXX only for testing
import org.apache.bcel.classfile.*;
import org.apache.bcel.classfile.JavaClass;
+import org.aspectj.bridge.IMessage;
import org.aspectj.util.FileUtil;
import org.aspectj.weaver.*;
UnwovenClassFile jc = (UnwovenClassFile)i.next();
String name = jc.getClassName();
ResolvedTypeX type = world.resolve(name);
+ //System.err.println("added: " + type + " aspect? " + type.isAspect());
if (type.isAspect()) {
needToReweaveWorld |= xcutSet.addOrReplaceAspect(type);
}
for (Iterator i = deletedTypenames.iterator(); i.hasNext(); ) {
String name = (String)i.next();
- xcutSet.deleteAspect(TypeX.forName(name));
- needToReweaveWorld = true;
+ if (xcutSet.deleteAspect(TypeX.forName(name))) needToReweaveWorld = true;
}
shadowMungerList = xcutSet.getShadowMungers();
public Collection weave() throws IOException {
prepareForWeave();
Collection filesToWeave;
+
if (needToReweaveWorld) {
filesToWeave = sourceJavaClasses.values();
} else {
}
Collection wovenClassNames = new ArrayList();
+ world.showMessage(IMessage.INFO, "might need to weave " + filesToWeave +
+ "(world=" + needToReweaveWorld + ")", null, null);
+
//XXX this isn't quite the right place for this...
for (Iterator i = filesToWeave.iterator(); i.hasNext(); ) {