aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-01-03 19:23:38 +0000
committerjhugunin <jhugunin>2003-01-03 19:23:38 +0000
commitf685f979a4d3eb3844f74850deece1da265bc975 (patch)
tree9ec4140075cec24a8157a94753d4fd8fcb560581 /weaver
parentef5c2cbf024c8f221ec4f76b12fa16c478e8e5f2 (diff)
downloadaspectj-f685f979a4d3eb3844f74850deece1da265bc975.tar.gz
aspectj-f685f979a4d3eb3844f74850deece1da265bc975.zip
minor improvements to incremental mode
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/CrosscuttingMembers.java5
-rw-r--r--weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java8
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java3
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java9
4 files changed, 19 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
index 22e73efb7..aedffd0b6 100644
--- a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
+++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
@@ -29,8 +29,9 @@ import org.aspectj.bridge.*;
* 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;
@@ -153,12 +154,14 @@ public class CrosscuttingMembers {
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;
diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
index ceebbfeb6..a7e9f5748 100644
--- a/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
+++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
@@ -23,8 +23,9 @@ import org.aspectj.bridge.*;
/**
* 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();
@@ -59,9 +60,10 @@ public class CrosscuttingMembersSet {
}
}
- 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
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
index 303e12561..e02410a7b 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
@@ -196,6 +196,9 @@ public class BcelObjectType extends ResolvedTypeX.Name {
this.perClause = null;
this.weaverState = null;
this.lazyClassGen = null;
+
+ isObject = (javaClass.getSuperclassNameIndex() == 0);
+ unpackAspectAttributes();
//XXX is clearing these caches sufficient
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
index c0e475cbd..f22bec950 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
@@ -19,6 +19,7 @@ import java.util.zip.*;
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.*;
@@ -157,6 +158,7 @@ public class BcelWeaver implements IWeaver {
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);
}
@@ -164,8 +166,7 @@ public class BcelWeaver implements IWeaver {
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();
@@ -211,6 +212,7 @@ public class BcelWeaver implements IWeaver {
public Collection weave() throws IOException {
prepareForWeave();
Collection filesToWeave;
+
if (needToReweaveWorld) {
filesToWeave = sourceJavaClasses.values();
} else {
@@ -218,6 +220,9 @@ public class BcelWeaver implements IWeaver {
}
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(); ) {