]> source.dussan.org Git - aspectj.git/commitdiff
added information about proceed to around advice attribute
authorjhugunin <jhugunin>
Tue, 31 Dec 2002 19:11:48 +0000 (19:11 +0000)
committerjhugunin <jhugunin>
Tue, 31 Dec 2002 19:11:48 +0000 (19:11 +0000)
20 files changed:
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseAdvice.java
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseWorld.java
weaver/src/org/aspectj/weaver/Advice.java
weaver/src/org/aspectj/weaver/AjAttribute.java
weaver/src/org/aspectj/weaver/IntMap.java
weaver/src/org/aspectj/weaver/ResolvedMember.java
weaver/src/org/aspectj/weaver/ResolvedPointcutDefinition.java
weaver/src/org/aspectj/weaver/TypeX.java
weaver/src/org/aspectj/weaver/World.java
weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java
weaver/src/org/aspectj/weaver/patterns/WithinPointcut.java
weaver/testdata/dummyAspect.jar
weaver/testdata/megatrace.jar
weaver/testdata/megatraceNoweave.jar
weaver/testdata/tracing.jar
weaver/testsrc/org/aspectj/weaver/bcel/PointcutResidueTestCase.java

index 65bf5c3527b95f3e3ffe2c4882e1ab05e282db78..15e28461f78100f1232cc621de9458940ec0fbf8 100644 (file)
@@ -43,11 +43,16 @@ public class AdviceDeclaration extends MethodDeclaration {
        public Argument extraArgument;
        
        public AdviceKind kind;
-       
        private int extraArgumentFlags = 0;
        
        public MethodBinding proceedMethodBinding;
        
+       public boolean proceedInInners;
+       public ResolvedMember[] proceedCallSignatures;
+       public boolean[] formalsUnchangedToProceed;
+       public TypeX[] declaredExceptions;
+       
+       
        public AdviceDeclaration(CompilationResult result, AdviceKind kind) {
                super(result);
                this.returnType = TypeReference.baseTypeReference(T_void, 0);
@@ -63,8 +68,15 @@ public class AdviceDeclaration extends MethodDeclaration {
        }
        
        public AjAttribute makeAttribute() {
-               return new AjAttribute.AdviceAttribute(kind, pointcutDesignator.getPointcut(), 
-                               extraArgumentFlags, sourceStart, sourceEnd, null);
+               if (kind == AdviceKind.Around) {
+                       return new AjAttribute.AdviceAttribute(kind, pointcutDesignator.getPointcut(), 
+                                       extraArgumentFlags, sourceStart, sourceEnd, null,
+                                       proceedInInners, proceedCallSignatures, formalsUnchangedToProceed, 
+                                       declaredExceptions);
+               } else {
+                       return new AjAttribute.AdviceAttribute(kind, pointcutDesignator.getPointcut(), 
+                                       extraArgumentFlags, sourceStart, sourceEnd, null);
+               }
        }
 
        public void resolveStatements(ClassScope upperScope) {
@@ -88,6 +100,13 @@ public class AdviceDeclaration extends MethodDeclaration {
                
                
                if (kind == AdviceKind.Around && binding != null) {
+                       //XXX set these correctly
+                       proceedInInners = false;
+                       proceedCallSignatures = new ResolvedMember[0];
+                       formalsUnchangedToProceed = new boolean[baseArgumentCount];
+                       declaredExceptions = new TypeX[0];
+                       
+                       
                        ReferenceBinding[] exceptions = 
                                new ReferenceBinding[] { upperScope.getJavaLangThrowable() };
                        proceedMethodBinding = new MethodBinding(Modifier.STATIC,
index 41cab4c62d254faad5ff9d1044a3812790facd0b..f2d750031b5ccf541b135af48d084719b529c662 100644 (file)
@@ -19,14 +19,9 @@ import org.aspectj.weaver.patterns.Pointcut;
 
 
 public class EclipseAdvice extends Advice {
-       public EclipseAdvice(
-               AdviceKind kind,
-               Pointcut pointcut,
-               Member signature,
-               int extraParameterFlags,
-               int start, int end, ISourceContext context) {
+       public EclipseAdvice(AjAttribute.AdviceAttribute attribute, Pointcut pointcut, Member signature) {
                        
-               super(kind, pointcut, signature, extraParameterFlags, start, end, context);
+               super(attribute, pointcut, signature);
        }
 
 
index 272127064651bc9f9146afb402cee4e3278e3094..c5ebf3dee31f7d3a0cf27597aef51709c04e046f 100644 (file)
@@ -50,10 +50,13 @@ public class EclipseWorld extends World {
                setMessageHandler(handler);
        }
        
-       public Advice concreteAdvice(AdviceKind kind, Pointcut p, Member m, int extraMods,
-        int start, int end, ISourceContext context)
+    public Advice concreteAdvice(
+               AjAttribute.AdviceAttribute attribute,
+       Pointcut pointcut,
+        Member signature)
     {
-       return new EclipseAdvice(kind, p, m, extraMods, start, end, context);
+       //System.err.println("concrete advice: " + signature + " context " + sourceContext);
+        return new EclipseAdvice(attribute, pointcut, signature);
     }
 
     public ConcreteTypeMunger concreteTypeMunger(
index e903b6c420844c32acc22358be8b83c825a2b961..b6714333ff04aa53296d98f754232dce5e421d47 100644 (file)
@@ -21,10 +21,10 @@ import org.aspectj.weaver.patterns.*;
 
 public abstract class Advice extends ShadowMunger {
 
-    protected AdviceKind kind;
+       AjAttribute.AdviceAttribute attribute; // the pointcut field is ignored
+
+    protected AdviceKind kind; // alias of attribute.getKind()
     protected Member signature;
-    protected int extraParameterFlags;
-    protected int lexicalPosition;
     
     // not necessarily declaring aspect, this is a semantics change from 1.0
     protected ResolvedTypeX concreteAspect; // null until after concretize
@@ -73,14 +73,12 @@ public abstract class Advice extends ShadowMunger {
     }
        
 
-    public Advice(AdviceKind kind, Pointcut pointcut, Member signature, 
-       int extraParameterFlags, int start, int end, ISourceContext sourceContext)
+    public Advice(AjAttribute.AdviceAttribute attribute, Pointcut pointcut, Member signature)
     {
-       super(pointcut, start, end, sourceContext);
-               this.kind = kind;
+       super(pointcut, attribute.getStart(), attribute.getEnd(), attribute.getSourceContext());
+               this.attribute = attribute;
+               this.kind = attribute.getKind(); // alias
                this.signature = signature;
-               this.extraParameterFlags = extraParameterFlags;
-               this.lexicalPosition = start;  //XXX should go away
     }    
 
        
@@ -143,11 +141,15 @@ public abstract class Advice extends ShadowMunger {
        }
        
        public boolean hasExtraParameter() {
-               return (extraParameterFlags & ExtraArgument) != 0;
+               return (getExtraParameterFlags() & ExtraArgument) != 0;
+       }
+
+       protected int getExtraParameterFlags() {
+               return attribute.getExtraParameterFlags();
        }
 
        protected int getExtraParameterCount() {
-               return countOnes(extraParameterFlags & ParameterMask);
+               return countOnes(getExtraParameterFlags() & ParameterMask);
        }
        
        public static int countOnes(int bits) {
@@ -160,7 +162,7 @@ public abstract class Advice extends ShadowMunger {
        }
        
        public int getBaseParameterCount() {
-               return signature.getParameterTypes().length - getExtraParameterCount();
+               return getSignature().getParameterTypes().length - getExtraParameterCount();
        }
 
        public TypeX getExtraParameterType() {
@@ -173,10 +175,10 @@ public abstract class Advice extends ShadowMunger {
        }
 
        protected String extraParametersToString() {
-               if (extraParameterFlags == 0) {
+               if (getExtraParameterFlags() == 0) {
                        return "";
                } else {
-                       return "(extraFlags: " + extraParameterFlags + ")";
+                       return "(extraFlags: " + getExtraParameterFlags() + ")";
                }
     }
 
@@ -197,7 +199,7 @@ public abstract class Advice extends ShadowMunger {
                p.state = Pointcut.CONCRETE;
         }
         
-               Advice munger = world.concreteAdvice(kind, p, signature, extraParameterFlags, start, end, sourceContext);
+               Advice munger = world.concreteAdvice(attribute, p, signature);
                munger.concreteAspect = fromType;
        //System.err.println("concretizing here " + p + " with clause " + clause);
         return munger;
@@ -218,8 +220,9 @@ public abstract class Advice extends ShadowMunger {
     public boolean equals(Object other) {
         if (! (other instanceof Advice)) return false;
         Advice o = (Advice) other;
-        return o.kind == kind && o.pointcut.equals(pointcut) && o.signature.equals(signature) &&
-            o.extraParameterFlags == extraParameterFlags;
+        return o.attribute.equals(attribute) 
+               && o.pointcut.equals(pointcut) 
+               && o.signature.equals(signature);
     }
     private volatile int hashCode = 0;
     public int hashCode() {
@@ -243,9 +246,11 @@ public abstract class Advice extends ShadowMunger {
        public static final int ParameterMask = 0xf;
        
        public static final int CanInline = 0x40;
-       
+
+
+       // for testing only     
        public void setLexicalPosition(int lexicalPosition) {
-               this.lexicalPosition = lexicalPosition;
+               start = lexicalPosition;
        }
 
        public ResolvedTypeX getConcreteAspect() {
index 864513371b1843a82bc920d7a0f9c8d24ec88152..85e0195a40450e574be95fcb2b95a2654a2f64c1 100644 (file)
@@ -185,7 +185,7 @@ public abstract class AjAttribute {
                }
                public void write(DataOutputStream s) throws IOException {
                        s.writeUTF(sourceFileName);
-                       FileUtil.writeIntArray(s, lineBreaks);
+                       FileUtil.writeIntArray(lineBreaks, s);
                }
                
                public static SourceContextAttribute read(DataInputStream s) throws IOException {
@@ -249,51 +249,101 @@ public abstract class AjAttribute {
                
                private AdviceKind kind;
                private Pointcut pointcut;
-               private int extraArgumentFlags;
+               private int extraParameterFlags;
                private int start;
                private int end;
                private ISourceContext sourceContext;
                
+               // these are only used by around advice
+               private boolean proceedInInners;
+               private ResolvedMember[] proceedCallSignatures; // size == # of proceed calls in body
+               private boolean[] formalsUnchangedToProceed; // size == formals.size
+               private TypeX[] declaredExceptions;
+               
                /**
                 * @param lexicalPosition must be greater than the lexicalPosition 
                 * of any advice declared before this one in an aspect, otherwise,
                 * it can be any value.
                 */
-               public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, int start, int end, ISourceContext sourceContext) {
+               public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, 
+                                                               int start, int end, ISourceContext sourceContext) {
+                       this.kind = kind;
+                       this.pointcut = pointcut;
+                       this.extraParameterFlags = extraArgumentFlags;
+                       this.start = start;
+                       this.end = end;
+                       this.sourceContext = sourceContext;
+
+                       //XXX put this back when testing works better (or fails better)
+                       //if (kind == AdviceKind.Around) throw new IllegalArgumentException("not for around");
+               }
+               
+               public AdviceAttribute(AdviceKind kind, Pointcut pointcut, int extraArgumentFlags, 
+                                                               int start, int end, ISourceContext sourceContext,
+                                                               boolean proceedInInners, ResolvedMember[] proceedCallSignatures,
+                                                               boolean[] formalsUnchangedToProceed, TypeX[] declaredExceptions) {
                        this.kind = kind;
                        this.pointcut = pointcut;
-                       this.extraArgumentFlags = extraArgumentFlags;
+                       this.extraParameterFlags = extraArgumentFlags;
                        this.start = start;
                        this.end = end;
                        this.sourceContext = sourceContext;
+                       
+                       if (kind != AdviceKind.Around) throw new IllegalArgumentException("only for around");
+                       
+                       this.proceedInInners = proceedInInners;
+                       this.proceedCallSignatures = proceedCallSignatures;
+                       this.formalsUnchangedToProceed = formalsUnchangedToProceed;
+                       this.declaredExceptions = declaredExceptions;
                }
                
                public static AdviceAttribute read(DataInputStream s, ISourceContext context) throws IOException {
-                       return new AdviceAttribute(
-                               AdviceKind.read(s),
-                               Pointcut.read(s, context),
-                               s.readByte(),
-                               s.readInt(), s.readInt(), context);
+                       AdviceKind kind = AdviceKind.read(s);
+                       if (kind == AdviceKind.Around) {
+                               return new AdviceAttribute(
+                                       kind,
+                                       Pointcut.read(s, context),
+                                       s.readByte(),
+                                       s.readInt(), s.readInt(), context,
+                                       s.readBoolean(),
+                                       ResolvedMember.readResolvedMemberArray(s, context),
+                                       FileUtil.readBooleanArray(s),
+                                       TypeX.readArray(s));
+                       } else {
+                               return new AdviceAttribute(
+                                       kind,
+                                       Pointcut.read(s, context),
+                                       s.readByte(),
+                                       s.readInt(), s.readInt(), context);
+                       }
                }
  
                public void write(DataOutputStream s) throws IOException {
                        kind.write(s);
                        pointcut.write(s);
-                       s.writeByte(extraArgumentFlags);
+                       s.writeByte(extraParameterFlags);
                        s.writeInt(start);
                        s.writeInt(end);
+                       
+                       if (kind == AdviceKind.Around) {
+                               s.writeBoolean(proceedInInners);
+                               ResolvedMember.writeArray(proceedCallSignatures, s);
+                               FileUtil.writeBooleanArray(formalsUnchangedToProceed, s);
+                               TypeX.writeArray(declaredExceptions, s);
+                       }
                }
+               
                public Advice reify(Member signature, World world) {
-                       return world.concreteAdvice(kind, pointcut, signature, extraArgumentFlags, start, end, sourceContext);
+                       return world.concreteAdvice(this, pointcut, signature);
                }
                
                public String toString() {
                        return "AdviceAttribute(" + kind + ", " + pointcut + ", " + 
-                                               extraArgumentFlags + ", " + start+")";
+                                               extraParameterFlags + ", " + start+")";
                }
                
-               public int getExtraArgumentFlags() {
-                       return extraArgumentFlags;
+               public int getExtraParameterFlags() {
+                       return extraParameterFlags;
                }
 
                public AdviceKind getKind() {
@@ -304,6 +354,34 @@ public abstract class AjAttribute {
                        return pointcut;
                }
 
+               public TypeX[] getDeclaredExceptions() {
+                       return declaredExceptions;
+               }
+
+               public boolean[] getFormalsUnchangedToProceed() {
+                       return formalsUnchangedToProceed;
+               }
+
+               public ResolvedMember[] getProceedCallSignatures() {
+                       return proceedCallSignatures;
+               }
+
+               public boolean isProceedInInners() {
+                       return proceedInInners;
+               }
+
+               public int getEnd() {
+                       return end;
+               }
+
+               public ISourceContext getSourceContext() {
+                       return sourceContext;
+               }
+
+               public int getStart() {
+                       return start;
+               }
+
        }
                
        public static class Aspect extends AjAttribute {
@@ -339,10 +417,7 @@ public abstract class AjAttribute {
                        this.accessedMembers = accessedMembers;
                }
                public void write(DataOutputStream s) throws IOException {
-                       s.writeInt(accessedMembers.length);
-                       for (int i = 0, len = accessedMembers.length; i < len; i++) {
-                               accessedMembers[i].write(s);
-                       }
+                       ResolvedMember.writeArray(accessedMembers, s);
                }               
                
                public ResolvedMember[] getAccessedMembers() {
@@ -350,12 +425,7 @@ public abstract class AjAttribute {
                }
 
                public static PrivilegedAttribute read(DataInputStream s, ISourceContext context) throws IOException {
-                       int len = s.readInt();
-                       ResolvedMember[] members = new ResolvedMember[len];
-                       for (int i=0; i < len; i++) {
-                               members[i] = ResolvedMember.readResolvedMember(s, context);
-                       }
-                       return new PrivilegedAttribute(members);
+                       return new PrivilegedAttribute(ResolvedMember.readResolvedMemberArray(s, context));
                }
        }       
        
index 7a12bf0f680d09912c40a5ef0259db478b5779ff..a1b24d382125e171985b356f76035972f37524fe 100644 (file)
@@ -54,7 +54,7 @@ public class IntMap {
        }
        
        public Member getAdviceSignature() {
-               if (enclosingAdvice instanceof Advice) return ((Advice)enclosingAdvice).signature;
+               if (enclosingAdvice instanceof Advice) return ((Advice)enclosingAdvice).getSignature();
                else return null;
        }
        
index 4851f917457e28ba3bf5034a967685bedff9c963..6469ee5f22c59555f605a1ddd6afd75db8ff07f3 100644 (file)
@@ -92,12 +92,20 @@ public class ResolvedMember extends Member implements IHasPosition {
        s.writeInt(modifiers);
        s.writeUTF(getName());
        s.writeUTF(getSignature());
-               TypeX.write(getExceptions(), s);
+               TypeX.writeArray(getExceptions(), s);
 
                s.writeInt(getStart());
                s.writeInt(getEnd());
 
     }
+
+    public static void writeArray(ResolvedMember[] members, DataOutputStream s) throws IOException {
+               s.writeInt(members.length);
+               for (int i = 0, len = members.length; i < len; i++) {
+                       members[i].write(s);
+               }
+    }
+
     
     public static ResolvedMember readResolvedMember(DataInputStream s, ISourceContext sourceContext) throws IOException {
        ResolvedMember m = new ResolvedMember(Kind.read(s), TypeX.read(s), s.readInt(), s.readUTF(), s.readUTF());
@@ -108,6 +116,17 @@ public class ResolvedMember extends Member implements IHasPosition {
                return m;
     }
     
+    public static ResolvedMember[] readResolvedMemberArray(DataInputStream s, ISourceContext context) throws IOException {
+       int len = s.readInt();
+               ResolvedMember[] members = new ResolvedMember[len];
+               for (int i=0; i < len; i++) {
+                       members[i] = ResolvedMember.readResolvedMember(s, context);
+               }
+               return members;
+    }
+    
+    
+    
        public ResolvedMember resolve(World world) {
                return this;
        }
index 5dfc055d82240bb41a53706e507e338cf77e24f7..49cec0f6193610369007cf33c54c0bf016e5b3e4 100644 (file)
@@ -46,7 +46,7 @@ public class ResolvedPointcutDefinition extends ResolvedMember {
                getDeclaringType().write(s);
                s.writeInt(getModifiers());
                s.writeUTF(getName());
-               TypeX.write(getParameterTypes(), s);
+               TypeX.writeArray(getParameterTypes(), s);
                pointcut.write(s);
        }
        
index 7d5c46fd43f9105d2d57bb7891e6029fcef75006..42cc3b09c91e452d30c34744cd786cb10ca633fe 100644 (file)
@@ -599,7 +599,7 @@ public class TypeX {
                }
        }
        
-       public static void write(TypeX[] types, DataOutputStream s) throws IOException {
+       public static void writeArray(TypeX[] types, DataOutputStream s) throws IOException {
                int len = types.length;
                s.writeShort(len);
                for (int i=0; i < len; i++) {
index d31b9e7a4bf353710d1ba1b798b411f1305c2249..4ed8abb49222e38cd642dd538116e784a02c33f2 100644 (file)
@@ -177,8 +177,7 @@ public abstract class World {
         public ResolvedTypeX resolveObjectType(TypeX ty) {
             return ResolvedTypeX.MISSING;
         }
-        public Advice concreteAdvice(AdviceKind kind, Pointcut p, Member m, int extraMods,
-        int start, int end, ISourceContext context) {
+        public Advice concreteAdvice(AjAttribute.AdviceAttribute attribute, Pointcut p, Member m) {
             throw new RuntimeException("unimplemented");
         }
         public ConcreteTypeMunger concreteTypeMunger(ResolvedTypeMunger munger, ResolvedTypeX aspectType) {
@@ -188,11 +187,9 @@ public abstract class World {
     
     
     public abstract Advice concreteAdvice(
-        AdviceKind kind,
-        Pointcut p,
-        Member signature,
-        int extraParameterFlags,
-        int start, int end, ISourceContext context);
+       AjAttribute.AdviceAttribute attribute,
+       Pointcut pointcut,
+        Member signature);
         
     public final Advice concreteAdvice(
        AdviceKind kind,
@@ -201,7 +198,9 @@ public abstract class World {
         int extraParameterFlags,
         IHasSourceLocation loc)
     {
-       return concreteAdvice(kind, p, signature, extraParameterFlags, loc.getStart(), loc.getEnd(), loc.getSourceContext());
+       AjAttribute.AdviceAttribute attribute = 
+               new AjAttribute.AdviceAttribute(kind, p, extraParameterFlags, loc.getStart(), loc.getEnd(), loc.getSourceContext());
+               return concreteAdvice(attribute, p, signature);
     }
         
         
index e6ff472eef85b35a0b3c1aa4837d6712c0d54ed1..e27102cfaf24a7a085eb9053ff71150f41056fc7 100644 (file)
@@ -28,12 +28,23 @@ public class BcelAdvice extends Advice {
        private Test pointcutTest;
        private ExposedState exposedState;
 
+       public BcelAdvice(
+               AjAttribute.AdviceAttribute attribute,
+               Pointcut pointcut,
+               Member signature,
+               ResolvedTypeX concreteAspect) 
+       {
+               super(attribute, pointcut, signature);
+               this.concreteAspect = concreteAspect;
+       }
+
+       // !!! only used for testing
        public BcelAdvice(AdviceKind kind, Pointcut pointcut, Member signature,
                int extraArgumentFlags,
         int start, int end, ISourceContext sourceContext, ResolvedTypeX concreteAspect)
     {
-               super(kind, pointcut, signature, extraArgumentFlags, start, end, sourceContext);
-               this.concreteAspect = concreteAspect;
+               this(new AjAttribute.AdviceAttribute(kind, pointcut, extraArgumentFlags, start, end, sourceContext), 
+                       pointcut, signature, concreteAspect);
        }
 
     // ---- implementations of ShadowMunger's methods
@@ -61,15 +72,15 @@ public class BcelAdvice extends Advice {
                pointcutTest = getPointcut().findResidue(shadow, exposedState);
                
         // make sure thisJoinPoint parameters are initialized
-        if ((extraParameterFlags & ThisJoinPointStaticPart) != 0) {
+        if ((getExtraParameterFlags() & ThisJoinPointStaticPart) != 0) {
                ((BcelShadow)shadow).getThisJoinPointStaticPartVar();
         }
 
-        if ((extraParameterFlags & ThisJoinPoint) != 0) {
+        if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
                ((BcelShadow)shadow).getThisJoinPointVar();
         }
         
-        if ((extraParameterFlags & ThisEnclosingJoinPointStaticPart) != 0) {
+        if ((getExtraParameterFlags() & ThisEnclosingJoinPointStaticPart) != 0) {
                ((BcelShadow)shadow).getThisEnclosingJoinPointStaticPartVar();
         }
     }   
@@ -214,16 +225,16 @@ public class BcelAdvice extends Advice {
         // handle thisJoinPoint parameters
         // these need to be in that same order as parameters in 
         // org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration
-        if ((extraParameterFlags & ThisJoinPointStaticPart) != 0) {
+        if ((getExtraParameterFlags() & ThisJoinPointStaticPart) != 0) {
                shadow.getThisJoinPointStaticPartBcelVar().appendLoad(il, fact);
         }
         
-        if ((extraParameterFlags & ThisJoinPoint) != 0) {
+        if ((getExtraParameterFlags() & ThisJoinPoint) != 0) {
                shadow.getThisJoinPointBcelVar().appendLoad(il, fact);
         }
         
 
-        if ((extraParameterFlags & ThisEnclosingJoinPointStaticPart) != 0) {
+        if ((getExtraParameterFlags() & ThisEnclosingJoinPointStaticPart) != 0) {
                shadow.getThisEnclosingJoinPointStaticPartBcelVar().appendLoad(il, fact);
         }
         
@@ -289,9 +300,9 @@ public class BcelAdvice extends Advice {
                
                if (declaringAspect == o_declaringAspect) {
                    if (kind.isAfter() || o.kind.isAfter()) {
-                       return this.lexicalPosition < o.lexicalPosition ? -1: +1;
+                       return this.getStart() < o.getStart() ? -1: +1;
                    } else {
-                       return this.lexicalPosition < o.lexicalPosition ? +1: -1;
+                       return this.getStart()< o.getStart() ? +1: -1;
                    }
                } else if (declaringAspect.isAssignableFrom(o_declaringAspect)) {
                        return -1;
index 1ff0c4e34f5cb80d6a504482c311483989d198cc..6b6987e163f416d07c84505f939ad3025c03baba 100644 (file)
@@ -106,7 +106,7 @@ public class BcelWorld extends World {
         Pointcut p =
                pointcut.resolve(new SimpleScope(this, bindings));
 
-        return concreteAdvice(kind, p, m, extraFlag, 0, 0, null);
+        return new BcelAdvice(kind, p, m, extraFlag, 0, 0, null, null);
     }
     
     private String[] parseIds(String str) {
@@ -297,14 +297,12 @@ public class BcelWorld extends World {
        }
 
     public Advice concreteAdvice(
-        AdviceKind kind,
-        Pointcut p,
-        Member signature,
-        int extraParameterFlags,
-        int start, int end, ISourceContext sourceContext) 
+               AjAttribute.AdviceAttribute attribute,
+       Pointcut pointcut,
+        Member signature)
     {
        //System.err.println("concrete advice: " + signature + " context " + sourceContext);
-        return new BcelAdvice(kind, p, signature, extraParameterFlags, start, end, sourceContext, null);
+        return new BcelAdvice(attribute, pointcut, signature, null);
     }
     
     public ConcreteTypeMunger concreteTypeMunger(
index 39566938ddf9859f1ccd4a341cfbd29d5741ae98..7eeb586293831c2b9295185c74b3f0c59a092783 100644 (file)
@@ -55,7 +55,7 @@ public class CflowPointcut extends Pointcut {
                s.writeByte(Pointcut.CFLOW);
                entry.write(s);
                s.writeBoolean(isBelow);
-               FileUtil.writeIntArray(s, freeVars);
+               FileUtil.writeIntArray(freeVars, s);
                writeLocation(s);
        }
        public static Pointcut read(DataInputStream s, ISourceContext context) throws IOException {
index c12c0e8dc5b37bec99b73824ce2c6def81852ccf..4eef87f664b16a282859ed56782968eb00dad5f0 100644 (file)
@@ -433,8 +433,8 @@ public class WildTypePattern extends TypePattern {
                s.writeInt(dim);
                //??? storing this information with every type pattern is wasteful of .class
                //    file size. Storing it on enclosing types would be more efficient
-               FileUtil.writeStringArray(s, knownMatches);
-               FileUtil.writeStringArray(s, importedPrefixes);
+               FileUtil.writeStringArray(knownMatches, s);
+               FileUtil.writeStringArray(importedPrefixes, s);
                writeLocation(s);
        }
        
index 7e8663ca2ee2449e3b5b6d8bf793d1276652058a..81c6bfcd4df22fb73e0e54b71556e7f332e876e9 100644 (file)
@@ -28,6 +28,10 @@ public class WithinPointcut extends Pointcut {
     
        public FuzzyBoolean match(Shadow shadow) {
                TypeX enclosingType = shadow.getEnclosingType();
+//             if (shadow.getKind() == Shadow.FieldSet) {
+//                     System.err.println("within?" + type  + " matches " + enclosingType + " on " + shadow);
+//             }
+               
                while (enclosingType != null) {
                        if (type.matchesStatically(shadow.getIWorld().resolve(enclosingType))) {
                                return FuzzyBoolean.YES;
index 5cadbea53213818a1e79fb944dda8935b0fc4ad9..784a3b611f19fcdcc97e313a39ebf6b39e50394b 100644 (file)
Binary files a/weaver/testdata/dummyAspect.jar and b/weaver/testdata/dummyAspect.jar differ
index e227960ccf488c19447841a10207b4e966202863..eda290200f41cc7af67a1af558cbd2222c9f4115 100644 (file)
Binary files a/weaver/testdata/megatrace.jar and b/weaver/testdata/megatrace.jar differ
index 86df6e86d26080e8e2e11fb2081095732d1c6cb6..fcf480940144bbe2bbc206e9252235e6649dbff6 100644 (file)
Binary files a/weaver/testdata/megatraceNoweave.jar and b/weaver/testdata/megatraceNoweave.jar differ
index ed778dde5539d5dc6ea8087e33eb8a7c4b3e5a55..c3f5201332c1a3bf44549313a9b764dd2b422cb5 100644 (file)
Binary files a/weaver/testdata/tracing.jar and b/weaver/testdata/tracing.jar differ
index 7dafd2f9b7faf0d91fad4b7cbc2a44cd6d6eb26b..e2fd9dd8758b0f0ca420762ad700719a700620f2 100644 (file)
@@ -183,7 +183,7 @@ public class PointcutResidueTestCase extends WeaveTestCase {
                 ));
 
         ShadowMunger pp =
-            world.concreteAdvice(
+            new BcelAdvice(
                 AdviceKind.Before,
                 rp,
                 Member.method(
@@ -193,7 +193,7 @@ public class PointcutResidueTestCase extends WeaveTestCase {
                     Member.typesToSignature(
                         ResolvedTypeX.VOID,
                         TypeX.forNames(formalTypes))),
-               0, -1, -1, null);
+               0, -1, -1, null, null);
 
                ResolvedTypeX inAspect = world.resolve("Aspect");
                CrosscuttingMembers xcut = new CrosscuttingMembers(inAspect);