]> source.dussan.org Git - aspectj.git/commitdiff
changed class name to match change from declare dominates to
authorjhugunin <jhugunin>
Tue, 21 Jan 2003 18:55:23 +0000 (18:55 +0000)
committerjhugunin <jhugunin>
Tue, 21 Jan 2003 18:55:23 +0000 (18:55 +0000)
declare precedence

weaver/src/org/aspectj/weaver/CrosscuttingMembers.java
weaver/src/org/aspectj/weaver/World.java
weaver/src/org/aspectj/weaver/patterns/Declare.java
weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java [deleted file]
weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/patterns/PatternParser.java
weaver/testsrc/org/aspectj/weaver/bcel/WeaveOrderTestCase.java

index 21be96474fa359922edd5643dd0b08ab910a0e57..1ffb5dfdfee6f7e3149bd912f8d84177b41918c5 100644 (file)
@@ -93,7 +93,7 @@ public class CrosscuttingMembers {
                if (declare instanceof DeclareErrorOrWarning) {
                        ShadowMunger m = new Checker((DeclareErrorOrWarning)declare);
                        addShadowMunger(m);
-               } else if (declare instanceof DeclareDominates) {
+               } else if (declare instanceof DeclarePrecedence) {
                        declareDominates.add(declare);
                } else if (declare instanceof DeclareParents) {
                        DeclareParents dp = (DeclareParents)declare;
index 156c449acd6fe247762779ee42090a497caf9492..a97664fd6a5c9a44048f1e564aa1a53efc76df6e 100644 (file)
@@ -278,7 +278,7 @@ public abstract class World {
                //??? This method can be called a large number of times.
                int order = 0;
                for (Iterator i = crosscuttingMembersSet.getDeclareDominates().iterator(); i.hasNext(); ) {
-                       DeclareDominates d = (DeclareDominates)i.next();
+                       DeclarePrecedence d = (DeclarePrecedence)i.next();
                        int thisOrder = d.compare(aspect1, aspect2);
                        //System.out.println("comparing: " + thisOrder + ": " + d);
                        if (thisOrder != 0) {
index 415043dee74d1acf8b3d608f48780d34208e99b5..14e04eae10c603fe89f1c1d905252ca3aa05e6fb 100644 (file)
@@ -29,7 +29,7 @@ public abstract class Declare extends PatternNode {
                        case ERROR_OR_WARNING:
                                return DeclareErrorOrWarning.read(s, context);
                        case DOMINATES:
-                               return DeclareDominates.read(s, context);
+                               return DeclarePrecedence.read(s, context);
                        case PARENTS:
                                return DeclareParents.read(s, context);
                        case SOFT:
diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java b/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java
deleted file mode 100644 (file)
index b5c9f56..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-/* *******************************************************************
- * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Common Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/cpl-v10.html 
- *  
- * Contributors: 
- *     PARC     initial implementation 
- * ******************************************************************/
-
-
-package org.aspectj.weaver.patterns;
-
-import java.io.*;
-import java.util.List;
-
-import org.aspectj.bridge.IMessage;
-import org.aspectj.weaver.*;
-import org.aspectj.weaver.ResolvedTypeX;
-
-public class DeclareDominates extends Declare {
-       private TypePatternList patterns;
-       
-
-       public DeclareDominates(List patterns) {
-               this(new TypePatternList(patterns));
-       }
-       
-       private DeclareDominates(TypePatternList patterns) {
-               this.patterns = patterns;
-       }
-       
-       public String toString() {
-               StringBuffer buf = new StringBuffer();
-               buf.append("declare precedence: ");
-               buf.append(patterns);
-               buf.append(";");
-               return buf.toString();
-       }
-       
-       public boolean equals(Object other) { 
-               if (!(other instanceof DeclareDominates)) return false;
-               DeclareDominates o = (DeclareDominates)other;
-               return o.patterns.equals(patterns);
-       }
-    
-    public int hashCode() {
-       return patterns.hashCode();
-    }
-
-
-       public void write(DataOutputStream s) throws IOException {
-               s.writeByte(Declare.DOMINATES);
-               patterns.write(s);
-               writeLocation(s);
-       }
-
-       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
-               Declare ret = new DeclareDominates(TypePatternList.read(s, context));
-               ret.readLocation(context, s);
-               return ret;
-       }
-       
-    public void resolve(IScope scope) {
-       patterns = patterns.resolveBindings(scope, Bindings.NONE, false, false); 
-       
-       for (int i=0; i < patterns.size(); i++) {
-               TypePattern pi = patterns.get(i);
-               if (pi.isStar()) continue;
-               ResolvedTypeX exactType = pi.getExactType().resolve(scope.getWorld());
-               if (exactType == ResolvedTypeX.MISSING) continue;
-               for (int j=0; j < patterns.size(); j++) {
-                       if (j == i) continue;
-                       TypePattern pj = patterns.get(j);
-                       if (pj.isStar()) continue;
-                       if (pj.matchesStatically(exactType)) {
-                               scope.getWorld().showMessage(IMessage.ERROR,
-                                       "circularity in declare dominates, '" + exactType.getName() + 
-                                               "' matches two patterns", pi.getSourceLocation(), pj.getSourceLocation());
-                       }
-               }
-       }       
-    }
-
-       public TypePatternList getPatterns() {
-               return patterns;
-       }
-
-       private int matchingIndex(ResolvedTypeX a) {
-               int knownMatch = -1;
-               int starMatch = -1;
-               for (int i=0, len=patterns.size(); i < len; i++) {
-                       TypePattern p = patterns.get(i);
-                       if (p.isStar()) {
-                               starMatch = i;
-                       } else if (p.matchesStatically(a)) {
-                               if (knownMatch != -1) {
-                                       a.getWorld().showMessage(IMessage.ERROR, "multiple matches for " + a + 
-                                                       ", matches both " + patterns.get(knownMatch) + " and " + p,
-                                                       patterns.get(knownMatch).getSourceLocation(), p.getSourceLocation());
-                                       return -1;
-                               } else {
-                                       knownMatch = i;
-                               }
-                       }
-               }
-               if (knownMatch == -1) return starMatch;
-               else return knownMatch;
-       }
-       
-
-       public int compare(ResolvedTypeX aspect1, ResolvedTypeX aspect2) {
-               int index1 = matchingIndex(aspect1);
-               int index2 = matchingIndex(aspect2);
-               
-               //System.out.println("a1: " + aspect1 + ", " + aspect2 + " = " + index1 + ", " + index2);
-               
-               if (index1 == -1 || index2 == -1) return 0;
-               
-               if (index1 == index2) return 0;
-               else if (index1 > index2) return -1;
-               else return +1;
-       }
-       
-       public boolean isAdviceLike() {
-               return false;
-       }
-
-}
diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java b/weaver/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
new file mode 100644 (file)
index 0000000..837bbc7
--- /dev/null
@@ -0,0 +1,131 @@
+/* *******************************************************************
+ * Copyright (c) 2002 Palo Alto Research Center, Incorporated (PARC).
+ * All rights reserved. 
+ * This program and the accompanying materials are made available 
+ * under the terms of the Common Public License v1.0 
+ * which accompanies this distribution and is available at 
+ * http://www.eclipse.org/legal/cpl-v10.html 
+ *  
+ * Contributors: 
+ *     PARC     initial implementation 
+ * ******************************************************************/
+
+
+package org.aspectj.weaver.patterns;
+
+import java.io.*;
+import java.util.List;
+
+import org.aspectj.bridge.IMessage;
+import org.aspectj.weaver.*;
+import org.aspectj.weaver.ResolvedTypeX;
+
+public class DeclarePrecedence extends Declare {
+       private TypePatternList patterns;
+       
+
+       public DeclarePrecedence(List patterns) {
+               this(new TypePatternList(patterns));
+       }
+       
+       private DeclarePrecedence(TypePatternList patterns) {
+               this.patterns = patterns;
+       }
+       
+       public String toString() {
+               StringBuffer buf = new StringBuffer();
+               buf.append("declare precedence: ");
+               buf.append(patterns);
+               buf.append(";");
+               return buf.toString();
+       }
+       
+       public boolean equals(Object other) { 
+               if (!(other instanceof DeclarePrecedence)) return false;
+               DeclarePrecedence o = (DeclarePrecedence)other;
+               return o.patterns.equals(patterns);
+       }
+    
+    public int hashCode() {
+       return patterns.hashCode();
+    }
+
+
+       public void write(DataOutputStream s) throws IOException {
+               s.writeByte(Declare.DOMINATES);
+               patterns.write(s);
+               writeLocation(s);
+       }
+
+       public static Declare read(DataInputStream s, ISourceContext context) throws IOException {
+               Declare ret = new DeclarePrecedence(TypePatternList.read(s, context));
+               ret.readLocation(context, s);
+               return ret;
+       }
+       
+    public void resolve(IScope scope) {
+       patterns = patterns.resolveBindings(scope, Bindings.NONE, false, false); 
+       
+       for (int i=0; i < patterns.size(); i++) {
+               TypePattern pi = patterns.get(i);
+               if (pi.isStar()) continue;
+               ResolvedTypeX exactType = pi.getExactType().resolve(scope.getWorld());
+               if (exactType == ResolvedTypeX.MISSING) continue;
+               for (int j=0; j < patterns.size(); j++) {
+                       if (j == i) continue;
+                       TypePattern pj = patterns.get(j);
+                       if (pj.isStar()) continue;
+                       if (pj.matchesStatically(exactType)) {
+                               scope.getWorld().showMessage(IMessage.ERROR,
+                                       "circularity in declare dominates, '" + exactType.getName() + 
+                                               "' matches two patterns", pi.getSourceLocation(), pj.getSourceLocation());
+                       }
+               }
+       }       
+    }
+
+       public TypePatternList getPatterns() {
+               return patterns;
+       }
+
+       private int matchingIndex(ResolvedTypeX a) {
+               int knownMatch = -1;
+               int starMatch = -1;
+               for (int i=0, len=patterns.size(); i < len; i++) {
+                       TypePattern p = patterns.get(i);
+                       if (p.isStar()) {
+                               starMatch = i;
+                       } else if (p.matchesStatically(a)) {
+                               if (knownMatch != -1) {
+                                       a.getWorld().showMessage(IMessage.ERROR, "multiple matches for " + a + 
+                                                       ", matches both " + patterns.get(knownMatch) + " and " + p,
+                                                       patterns.get(knownMatch).getSourceLocation(), p.getSourceLocation());
+                                       return -1;
+                               } else {
+                                       knownMatch = i;
+                               }
+                       }
+               }
+               if (knownMatch == -1) return starMatch;
+               else return knownMatch;
+       }
+       
+
+       public int compare(ResolvedTypeX aspect1, ResolvedTypeX aspect2) {
+               int index1 = matchingIndex(aspect1);
+               int index2 = matchingIndex(aspect2);
+               
+               //System.out.println("a1: " + aspect1 + ", " + aspect2 + " = " + index1 + ", " + index2);
+               
+               if (index1 == -1 || index2 == -1) return 0;
+               
+               if (index1 == index2) return 0;
+               else if (index1 > index2) return -1;
+               else return +1;
+       }
+       
+       public boolean isAdviceLike() {
+               return false;
+       }
+
+}
index 315272981b8b63827b797d8c7fdfdd839aa95168..9b1ce7455138ad05b8555054c00ed3697a95fc9f 100644 (file)
@@ -109,13 +109,13 @@ public class PatternParser {
                return ret;
        }
 
-       public DeclareDominates parseDominates() {
+       public DeclarePrecedence parseDominates() {
                List l = new ArrayList();
                do {
                        l.add(parseTypePattern());
                } while (maybeEat(","));
                
-               return new DeclareDominates(l);
+               return new DeclarePrecedence(l);
        }
 
        private Declare parseParents() {
index 270faf6fc9b8377f8a1329e8f1b32aeec3f5c3cd..da9818622f08ff15279b3752512e32b4f587d0b2 100644 (file)
@@ -19,7 +19,7 @@ import java.io.*;
 import org.apache.bcel.Constants;
 import org.apache.bcel.generic.*;
 import org.aspectj.weaver.patterns.*;
-import org.aspectj.weaver.patterns.DeclareDominates;
+import org.aspectj.weaver.patterns.DeclarePrecedence;
 import org.aspectj.weaver.*;
 
 /**.