]> source.dussan.org Git - aspectj.git/commitdiff
minor improvements to incremental mode
authorjhugunin <jhugunin>
Fri, 3 Jan 2003 19:23:38 +0000 (19:23 +0000)
committerjhugunin <jhugunin>
Fri, 3 Jan 2003 19:23:38 +0000 (19:23 +0000)
weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
weaver/src/org/aspectj/weaver/CrosscuttingMembersSet.java
weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

index 22e73efb75e452bdfb55b7ff60c9261b092b3787..aedffd0b6dd07d59d0b5c219d226326270972c44 100644 (file)
@@ -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;
index ceebbfeb63c11a0be8cd5c8a9846c0437eac9c05..a7e9f57480637347ad2044ac07b7cbfebc83ff56 100644 (file)
@@ -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
index 303e12561d2c541b57ad60948b643cddd6601f1b..e02410a7b0c9b1c3ae2cb56c4f34a77133f522cd 100644 (file)
@@ -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
        }
 
index c0e475cbdd0c4e33174965dbc97d04c8a96f8268..f22bec950ee86b6c5e28ba858dc0c02177c2fe58 100644 (file)
@@ -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(); ) {