]> source.dussan.org Git - aspectj.git/commitdiff
246125: removing bcel/runtime dependencies from patterns
authoraclement <aclement>
Tue, 21 Oct 2008 16:09:00 +0000 (16:09 +0000)
committeraclement <aclement>
Tue, 21 Oct 2008 16:09:00 +0000 (16:09 +0000)
weaver/src/org/aspectj/weaver/IWeavingSupport.java
weaver/src/org/aspectj/weaver/bcel/BcelWeavingSupport.java
weaver/src/org/aspectj/weaver/patterns/CflowPointcut.java
weaver/src/org/aspectj/weaver/patterns/ConcreteCflowPointcut.java
weaver/src/org/aspectj/weaver/patterns/IfPointcut.java
weaver/src/org/aspectj/weaver/patterns/PerObject.java
weaver/src/org/aspectj/weaver/patterns/PerSingleton.java
weaver/src/org/aspectj/weaver/patterns/PerTypeWithin.java

index 6c5f913ba7b9704cfc02e1a468fff539e53427d7..57bf82b7b7892b70bfa7a8e17f2fd09b48d0825c 100644 (file)
  * ******************************************************************/
 package org.aspectj.weaver;
 
+import org.aspectj.weaver.ast.Var;
 import org.aspectj.weaver.patterns.PerClause;
 import org.aspectj.weaver.patterns.Pointcut;
 
 /**
- * Encapsulates operations that a world will need to support if it is actually
- * going to modify bytecode rather than just match against it. {@see
- * BcelWeavingSupport}
+ * Encapsulates operations that a world will need to support if it is actually going to modify bytecode rather than just match
+ * against it. {@see BcelWeavingSupport}
  * 
  * @author Andy Clement
  */
@@ -30,13 +30,15 @@ public interface IWeavingSupport {
        public abstract ConcreteTypeMunger makeCflowCounterFieldAdder(ResolvedMember cflowField);
 
        /**
-        * Register a munger for perclause @AJ aspect so that we add aspectOf(..) to
-        * them as needed
+        * Register a munger for perclause @AJ aspect so that we add aspectOf(..) to them as needed
         * 
-        * @see org.aspectj.weaver.bcel.BcelWorld#makePerClauseAspect(ResolvedType,
-        *      org.aspectj.weaver.patterns.PerClause.Kind)
+        * @see org.aspectj.weaver.bcel.BcelWorld#makePerClauseAspect(ResolvedType, org.aspectj.weaver.patterns.PerClause.Kind)
         */
        public abstract ConcreteTypeMunger makePerClauseAspect(ResolvedType aspect, PerClause.Kind kind);
 
        public abstract ConcreteTypeMunger concreteTypeMunger(ResolvedTypeMunger munger, ResolvedType aspectType);
+
+       public ConcreteTypeMunger createAccessForInlineMunger(ResolvedType inAspect);
+
+       public Var makeCflowAccessVar(ResolvedType formalType, Member cflowField, int arrayIndex);
 }
index 37afc4bd63579c64051aa0e77ec09c04f0c2f43e..a79681da0d12c420a323c495b68e2a6dec7ec227 100644 (file)
@@ -19,12 +19,12 @@ import org.aspectj.weaver.Member;
 import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.ast.Var;
 import org.aspectj.weaver.patterns.PerClause;
 import org.aspectj.weaver.patterns.Pointcut;
 
 /**
- * Bcel implementation of the weaving support required in a BcelWorld which will
- * actually modify bytecode.
+ * Bcel implementation of the weaving support required in a BcelWorld which will actually modify bytecode.
  * 
  * @author Andy Clement
  */
@@ -45,8 +45,7 @@ public class BcelWeavingSupport implements IWeavingSupport {
        }
 
        /**
-        * Register a munger for perclause @AJ aspect so that we add aspectOf(..) to
-        * them as needed
+        * Register a munger for perclause @AJ aspect so that we add aspectOf(..) to them as needed
         * 
         * @param aspect
         * @param kind
@@ -56,7 +55,16 @@ public class BcelWeavingSupport implements IWeavingSupport {
                return new BcelPerClauseAspectAdder(aspect, kind);
        }
 
+       public Var makeCflowAccessVar(ResolvedType formalType, Member cflowField, int arrayIndex) {
+               return new BcelCflowAccessVar(formalType, cflowField, arrayIndex);
+       }
+
        public ConcreteTypeMunger concreteTypeMunger(ResolvedTypeMunger munger, ResolvedType aspectType) {
                return new BcelTypeMunger(munger, aspectType);
        }
+
+       public ConcreteTypeMunger createAccessForInlineMunger(ResolvedType aspect) {
+               return new BcelAccessForInlineMunger(aspect);
+       }
+
 }
index 8a0a095940a6cb08d2690bfc4e7f4a8d72b7b170..05ff2d82412c0e0c6646bae01302fe54ed35244d 100644 (file)
@@ -47,11 +47,9 @@ public class CflowPointcut extends Pointcut {
        private int[] freeVars;
 
        /**
-        * Used to indicate that we're in the context of a cflow when concretizing
-        * if's
+        * Used to indicate that we're in the context of a cflow when concretizing if's
         * 
-        * Will be removed or replaced with something better when we handle this as
-        * a non-error
+        * Will be removed or replaced with something better when we handle this as a non-error
         */
        public static final ResolvedPointcutDefinition CFLOW_MARKER = new ResolvedPointcutDefinition(null, 0, null,
                        UnresolvedType.NONE, Pointcut.makeMatchesNothing(Pointcut.RESOLVED));
@@ -245,7 +243,7 @@ public class CflowPointcut extends Pointcut {
                                // it
                        }
 
-                       Pointcut ret = new ConcreteCflowPointcut(localCflowField, null, true);
+                       Pointcut ret = new ConcreteCflowPointcut(concreteAspect, localCflowField, null, true);
                        ret.copyLocationFrom(this);
                        return ret;
                } else {
@@ -309,7 +307,7 @@ public class CflowPointcut extends Pointcut {
                                                .makeCflowStackFieldAdder(localCflowField));
                                putCflowfield(xcut, concreteEntry, concreteAspect, localCflowField, "stack");
                        }
-                       Pointcut ret = new ConcreteCflowPointcut(localCflowField, slots, false);
+                       Pointcut ret = new ConcreteCflowPointcut(concreteAspect, localCflowField, slots, false);
                        ret.copyLocationFrom(this);
                        return ret;
                }
index 2d9cbc8e4d8b24bcd5cfadac862aade6b5a6d460..842384b01d5921a616d261d4722b5d560164f633 100644 (file)
@@ -10,7 +10,6 @@
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.patterns;
 
 import java.io.DataOutputStream;
@@ -33,154 +32,150 @@ import org.aspectj.weaver.WeaverMessages;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Test;
-import org.aspectj.weaver.bcel.BcelCflowAccessVar;
-
 
 public class ConcreteCflowPointcut extends Pointcut {
-       private Member cflowField;
-       List/*Slot*/ slots; // exposed for testing
-    boolean usesCounter;
-       
-    // Can either use a counter or a stack to implement cflow.
-       public ConcreteCflowPointcut(Member cflowField, List slots,boolean usesCounter) {
-               this.cflowField  = cflowField;
-               this.slots       = slots;
+       private final Member cflowField;
+       List/* Slot */slots; // exposed for testing
+       boolean usesCounter;
+       ResolvedType aspect;
+
+       // Can either use a counter or a stack to implement cflow.
+       public ConcreteCflowPointcut(ResolvedType aspect, Member cflowField, List slots, boolean usesCounter) {
+               this.aspect = aspect;
+               this.cflowField = cflowField;
+               this.slots = slots;
                this.usesCounter = usesCounter;
                this.pointcutKind = CFLOW;
        }
-    
+
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
        }
-       
-    public FuzzyBoolean fastMatch(FastMatchInfo type) {
+
+       public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return FuzzyBoolean.MAYBE;
        }
-         
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
-               //??? this is not maximally efficient
+               // ??? this is not maximally efficient
                // Check we'll be able to do the residue!
-               
+
                // this bit is for pr145693 - we cannot match at all if one of the types is missing, we will be unable
                // to create the residue
-                if (slots != null) { 
-                   for (Iterator i = slots.iterator(); i.hasNext();) {
-                         Slot slot = (Slot) i.next();
-                         ResolvedType rt = slot.formalType;
-                         if (rt.isMissing()) {
-                                 ISourceLocation[] locs = new ISourceLocation[]{getSourceLocation()};
-                                 Message m = new Message(
-                                   WeaverMessages.format(WeaverMessages.MISSING_TYPE_PREVENTS_MATCH,rt.getName()),
-                                                 "",Message.WARNING,shadow.getSourceLocation(),null,locs);
-                                 rt.getWorld().getMessageHandler().handleMessage(m);
-                                 return FuzzyBoolean.NO;
-                         }
-                   }
-                }
+               if (slots != null) {
+                       for (Iterator i = slots.iterator(); i.hasNext();) {
+                               Slot slot = (Slot) i.next();
+                               ResolvedType rt = slot.formalType;
+                               if (rt.isMissing()) {
+                                       ISourceLocation[] locs = new ISourceLocation[] { getSourceLocation() };
+                                       Message m = new Message(WeaverMessages.format(WeaverMessages.MISSING_TYPE_PREVENTS_MATCH, rt.getName()), "",
+                                                       Message.WARNING, shadow.getSourceLocation(), null, locs);
+                                       rt.getWorld().getMessageHandler().handleMessage(m);
+                                       return FuzzyBoolean.NO;
+                               }
+                       }
+               }
                return FuzzyBoolean.MAYBE;
        }
 
        // used by weaver when validating bindings
        public int[] getUsedFormalSlots() {
-               if (slots == null) return new int[0];
+               if (slots == null)
+                       return new int[0];
                int[] indices = new int[slots.size()];
                for (int i = 0; i < indices.length; i++) {
-                       indices[i] = ((Slot)slots.get(i)).formalIndex;
+                       indices[i] = ((Slot) slots.get(i)).formalIndex;
                }
                return indices;
        }
-       
+
        public void write(DataOutputStream s) throws IOException {
                throw new RuntimeException("unimplemented");
        }
 
-
        public void resolveBindings(IScope scope, Bindings bindings) {
                throw new RuntimeException("unimplemented");
        }
-       
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
+
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
                throw new RuntimeException("unimplemented");
        }
-       
+
        public boolean equals(Object other) {
-               if (!(other instanceof ConcreteCflowPointcut)) return false;
-               ConcreteCflowPointcut o = (ConcreteCflowPointcut)other;
+               if (!(other instanceof ConcreteCflowPointcut))
+                       return false;
+               ConcreteCflowPointcut o = (ConcreteCflowPointcut) other;
                return o.cflowField.equals(this.cflowField);
        }
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + cflowField.hashCode();
-        return result;
-    }
+
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + cflowField.hashCode();
+               return result;
+       }
+
        public String toString() {
                return "concretecflow(" + cflowField + ")";
        }
 
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
-               //System.out.println("find residue: " + this);
+               // System.out.println("find residue: " + this);
                if (usesCounter) {
                        return Test.makeFieldGetCall(cflowField, cflowCounterIsValidMethod, Expr.NONE);
                } else {
-                 if (slots != null) { // null for cflows managed by counters
-                   for (Iterator i = slots.iterator(); i.hasNext();) {
-                         Slot slot = (Slot) i.next();
-                         //System.out.println("slot: " + slot.formalIndex);
-                         state.set(slot.formalIndex, 
-                               new BcelCflowAccessVar(slot.formalType, cflowField, slot.arrayIndex));
-                   }
-                 }
-                 return Test.makeFieldGetCall(cflowField, cflowStackIsValidMethod, Expr.NONE);
+                       if (slots != null) { // null for cflows managed by counters
+                               for (Iterator i = slots.iterator(); i.hasNext();) {
+                                       Slot slot = (Slot) i.next();
+                                       // System.out.println("slot: " + slot.formalIndex);
+                                       state.set(slot.formalIndex, aspect.getWorld().getWeavingSupport().makeCflowAccessVar(slot.formalType,
+                                                       cflowField, slot.arrayIndex));
+                               }
+                       }
+                       return Test.makeFieldGetCall(cflowField, cflowStackIsValidMethod, Expr.NONE);
                }
        }
-       
-       private static final Member cflowStackIsValidMethod = 
-               MemberImpl.method(NameMangler.CFLOW_STACK_UNRESOLVEDTYPE, 0, ResolvedType.BOOLEAN,"isValid", UnresolvedType.NONE);
 
-       private static final Member cflowCounterIsValidMethod = 
-               MemberImpl.method(NameMangler.CFLOW_COUNTER_UNRESOLVEDTYPE, 0,ResolvedType.BOOLEAN, "isValid", UnresolvedType.NONE);
+       private static final Member cflowStackIsValidMethod = MemberImpl.method(NameMangler.CFLOW_STACK_UNRESOLVEDTYPE, 0,
+                       ResolvedType.BOOLEAN, "isValid", UnresolvedType.NONE);
+
+       private static final Member cflowCounterIsValidMethod = MemberImpl.method(NameMangler.CFLOW_COUNTER_UNRESOLVEDTYPE, 0,
+                       ResolvedType.BOOLEAN, "isValid", UnresolvedType.NONE);
 
-       
        public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                throw new RuntimeException("unimplemented");
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
-
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 
        public static class Slot {
                int formalIndex;
                ResolvedType formalType;
                int arrayIndex;
-               
-               public Slot(
-                       int formalIndex,
-                       ResolvedType formalType,
-                       int arrayIndex) {
+
+               public Slot(int formalIndex, ResolvedType formalType, int arrayIndex) {
                        this.formalIndex = formalIndex;
                        this.formalType = formalType;
                        this.arrayIndex = arrayIndex;
                }
-               
+
                public boolean equals(Object other) {
-                       if (!(other instanceof Slot)) return false;
-                       
-                       Slot o = (Slot)other;
-                       return o.formalIndex == this.formalIndex &&
-                               o.arrayIndex == this.arrayIndex &&
-                               o.formalType.equals(this.formalType);
+                       if (!(other instanceof Slot))
+                               return false;
+
+                       Slot o = (Slot) other;
+                       return o.formalIndex == this.formalIndex && o.arrayIndex == this.arrayIndex && o.formalType.equals(this.formalType);
                }
-               
-           public int hashCode() {
-               int result = 19;
-               result = 37*result + formalIndex;
-               result = 37*result + arrayIndex;
-               result = 37*result + formalType.hashCode();
-               return result;
-           }
-               
+
+               public int hashCode() {
+                       int result = 19;
+                       result = 37 * result + formalIndex;
+                       result = 37 * result + arrayIndex;
+                       result = 37 * result + formalType.hashCode();
+                       return result;
+               }
+
                public String toString() {
                        return "Slot(" + formalIndex + ", " + formalType + ", " + arrayIndex + ")";
                }
index 328cc4044f34da8b8f9bd0cf134dc7df46a8aba0..eaa2e1f61d8526f0e97a42738a80158d4bb9f258 100644 (file)
@@ -20,7 +20,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.aspectj.bridge.IMessage;
-import org.aspectj.lang.JoinPoint;
 import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.Advice;
 import org.aspectj.weaver.AjcMemberMaker;
@@ -46,32 +45,32 @@ public class IfPointcut extends Pointcut {
        public ResolvedMember testMethod;
        public int extraParameterFlags;
 
-    /**
-     * A token source dump that looks like a pointcut (but is NOT parseable at all - just here to help debugging etc)
-     */
-    private String enclosingPointcutHint;
+       /**
+        * A token source dump that looks like a pointcut (but is NOT parseable at all - just here to help debugging etc)
+        */
+       private final String enclosingPointcutHint;
 
        public Pointcut residueSource;
        int baseArgsCount;
-       
-       //XXX some way to compute args
+
+       // XXX some way to compute args
 
        public IfPointcut(ResolvedMember testMethod, int extraParameterFlags) {
                this.testMethod = testMethod;
                this.extraParameterFlags = extraParameterFlags;
                this.pointcutKind = IF;
-        this.enclosingPointcutHint = null;
+               this.enclosingPointcutHint = null;
        }
 
-    /**
-     * No-arg constructor for @AJ style, where the if() body is actually the @Pointcut annotated method
-     */
-    public IfPointcut(String enclosingPointcutHint) {
-        this.pointcutKind = IF;
-        this.enclosingPointcutHint = enclosingPointcutHint;
-        this.testMethod = null;// resolved during concretize
-        this.extraParameterFlags = -1;//allows to keep track of the @Aj style
-    }
+       /**
+        * No-arg constructor for @AJ style, where the if() body is actually the @Pointcut annotated method
+        */
+       public IfPointcut(String enclosingPointcutHint) {
+               this.pointcutKind = IF;
+               this.enclosingPointcutHint = enclosingPointcutHint;
+               this.testMethod = null;// resolved during concretize
+               this.extraParameterFlags = -1;// allows to keep track of the @Aj style
+       }
 
        public int couldMatchKinds() {
                return Shadow.ALL_SHADOW_KINDS_BITS;
@@ -80,36 +79,38 @@ public class IfPointcut extends Pointcut {
        public FuzzyBoolean fastMatch(FastMatchInfo type) {
                return FuzzyBoolean.MAYBE;
        }
-           
+
        protected FuzzyBoolean matchInternal(Shadow shadow) {
-               //??? this is not maximally efficient
+               // ??? this is not maximally efficient
                return FuzzyBoolean.MAYBE;
        }
 
        public boolean alwaysFalse() {
                return false;
        }
-       
+
        public boolean alwaysTrue() {
                return false;
        }
-       
+
        // enh 76055
        public Pointcut getResidueSource() {
                return residueSource;
        }
-       
+
        public void write(DataOutputStream s) throws IOException {
                s.writeByte(Pointcut.IF);
-               s.writeBoolean(testMethod != null);  // do we have a test method?
-               if (testMethod != null) testMethod.write(s);
+               s.writeBoolean(testMethod != null); // do we have a test method?
+               if (testMethod != null)
+                       testMethod.write(s);
                s.writeByte(extraParameterFlags);
                writeLocation(s);
        }
+
        public static Pointcut read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                boolean hasTestMethod = s.readBoolean();
-               ResolvedMember resolvedTestMethod = null;  
-               if (hasTestMethod) {  // should always have a test method unless @AJ style
+               ResolvedMember resolvedTestMethod = null;
+               if (hasTestMethod) { // should always have a test method unless @AJ style
                        resolvedTestMethod = ResolvedMemberImpl.readResolvedMember(s, context);
                }
                IfPointcut ret = new IfPointcut(resolvedTestMethod, s.readByte());
@@ -118,152 +119,154 @@ public class IfPointcut extends Pointcut {
        }
 
        public void resolveBindings(IScope scope, Bindings bindings) {
-               //??? all we need is good error messages in here in cflow contexts
+               // ??? all we need is good error messages in here in cflow contexts
        }
-               
+
        public boolean equals(Object other) {
-               if (!(other instanceof IfPointcut)) return false;
-               IfPointcut o = (IfPointcut)other;
-               if (o.testMethod==null) return (this.testMethod==null);
+               if (!(other instanceof IfPointcut))
+                       return false;
+               IfPointcut o = (IfPointcut) other;
+               if (o.testMethod == null)
+                       return (this.testMethod == null);
                return o.testMethod.equals(this.testMethod);
        }
 
-    public int hashCode() {
-        int result = 17;
-        result = 37*result + testMethod.hashCode();
-        return result;
-    }
-
-    public String toString() {
-        if (extraParameterFlags < 0) {
-            //@AJ style
-            return "if()";
-        } else {
-                   return "if(" + testMethod + ")";//FIXME AV - bad, this makes it unparsable. Perhaps we can use if() for code style behind the scene!
-        }
+       public int hashCode() {
+               int result = 17;
+               result = 37 * result + testMethod.hashCode();
+               return result;
+       }
+
+       public String toString() {
+               if (extraParameterFlags < 0) {
+                       // @AJ style
+                       return "if()";
+               } else {
+                       return "if(" + testMethod + ")";// FIXME AV - bad, this makes it unparsable. Perhaps we can use if() for code style
+                       // behind the scene!
+               }
        }
 
-       //??? The implementation of name binding and type checking in if PCDs is very convoluted
-       //    There has to be a better way...
-    private boolean findingResidue = false;
-       
+       // ??? The implementation of name binding and type checking in if PCDs is very convoluted
+       // There has to be a better way...
+       private boolean findingResidue = false;
+
        // Similar to lastMatchedShadowId - but only for if PCDs.
        private int ifLastMatchedShadowId;
        private Test ifLastMatchedShadowResidue;
-       
+
        /**
         * At each shadow that matched, the residue can be different.
         */
        protected Test findResidueInternal(Shadow shadow, ExposedState state) {
-               if (findingResidue) return Literal.TRUE;
+               if (findingResidue)
+                       return Literal.TRUE;
                findingResidue = true;
                try {
 
                        // Have we already been asked this question?
-                       if (shadow.shadowId == ifLastMatchedShadowId) return ifLastMatchedShadowResidue;
-                       
+                       if (shadow.shadowId == ifLastMatchedShadowId)
+                               return ifLastMatchedShadowResidue;
+
                        Test ret = Literal.TRUE;
                        List args = new ArrayList();
-                       
-               // code style
-            if (extraParameterFlags >= 0) {
-                // If there are no args to sort out, don't bother with the recursive call
-                if (baseArgsCount > 0) {
-                    ExposedState myState = new ExposedState(baseArgsCount);
-                    //??? we throw out the test that comes from this walk.  All we want here
-                    //    is bindings for the arguments
-                    residueSource.findResidue(shadow, myState);
-
-                                       UnresolvedType[] pTypes = (testMethod==null?null:testMethod.getParameterTypes());
-                    if (pTypes!=null && baseArgsCount>pTypes.length) { //pr155347
-                       throw new BCException("Unexpected problem with testMethod "+testMethod+": expecting "+baseArgsCount+" arguments");
-                    }
-                    // pr118149
-                    // It is possible for vars in myState (which would normally be set
-                    // in the call to residueSource.findResidue) to not be set (be null)
-                    // in an Or pointcut with if expressions in both branches, and where
-                    // one branch is known statically to not match. In this situation we
-                    // simply return Test.
-                    for (int i=0; i < baseArgsCount; i++) {
-                        Var v = myState.get(i);
-                        if (v == null) continue;  // pr118149
-                        args.add(v);
-                        ret = Test.makeAnd(ret,
-                            Test.makeInstanceof(v,
-                                pTypes[i].resolve(shadow.getIWorld())));
-                    }
-                }
-
-                // handle thisJoinPoint parameters
-                if ((extraParameterFlags & Advice.ThisJoinPoint) != 0) {
-                    args.add(shadow.getThisJoinPointVar());
-                }
-
-                if ((extraParameterFlags & Advice.ThisJoinPointStaticPart) != 0) {
-                    args.add(shadow.getThisJoinPointStaticPartVar());
-                }
-
-                if ((extraParameterFlags & Advice.ThisEnclosingJoinPointStaticPart) != 0) {
-                    args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
-                }
-            } else {
-                // @style is slightly different
-                int currentStateIndex = 0;
-                //FIXME AV - "args(jp)" test(jp, thejp) will fail here
-                for (int i = 0; i < testMethod.getParameterTypes().length; i++) {
-                    String argSignature = testMethod.getParameterTypes()[i].getSignature();
-                    if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argSignature)) {
-                        args.add(shadow.getThisJoinPointVar());
-                    } else if (AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argSignature)) {
-                        args.add(shadow.getThisJoinPointVar());
-                    } else if (AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argSignature)) {
-                        args.add(shadow.getThisJoinPointStaticPartVar());
-                    } else if (AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argSignature)) {
-                        args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
-                    } else {
-                        // we don't use i as JoinPoint.* can be anywhere in the signature in @style
-                        Var v = state.get(currentStateIndex++);
-                        args.add(v);
-                        ret = Test.makeAnd(ret,
-                            Test.makeInstanceof(v,
-                                testMethod.getParameterTypes()[i].resolve(shadow.getIWorld())));
-                    }
-                }
-            }
-
-               ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[])args.toArray(new Expr[args.size()])));
+
+                       // code style
+                       if (extraParameterFlags >= 0) {
+                               // If there are no args to sort out, don't bother with the recursive call
+                               if (baseArgsCount > 0) {
+                                       ExposedState myState = new ExposedState(baseArgsCount);
+                                       // ??? we throw out the test that comes from this walk. All we want here
+                                       // is bindings for the arguments
+                                       residueSource.findResidue(shadow, myState);
+
+                                       UnresolvedType[] pTypes = (testMethod == null ? null : testMethod.getParameterTypes());
+                                       if (pTypes != null && baseArgsCount > pTypes.length) { // pr155347
+                                               throw new BCException("Unexpected problem with testMethod " + testMethod + ": expecting " + baseArgsCount
+                                                               + " arguments");
+                                       }
+                                       // pr118149
+                                       // It is possible for vars in myState (which would normally be set
+                                       // in the call to residueSource.findResidue) to not be set (be null)
+                                       // in an Or pointcut with if expressions in both branches, and where
+                                       // one branch is known statically to not match. In this situation we
+                                       // simply return Test.
+                                       for (int i = 0; i < baseArgsCount; i++) {
+                                               Var v = myState.get(i);
+                                               if (v == null)
+                                                       continue; // pr118149
+                                               args.add(v);
+                                               ret = Test.makeAnd(ret, Test.makeInstanceof(v, pTypes[i].resolve(shadow.getIWorld())));
+                                       }
+                               }
+
+                               // handle thisJoinPoint parameters
+                               if ((extraParameterFlags & Advice.ThisJoinPoint) != 0) {
+                                       args.add(shadow.getThisJoinPointVar());
+                               }
+
+                               if ((extraParameterFlags & Advice.ThisJoinPointStaticPart) != 0) {
+                                       args.add(shadow.getThisJoinPointStaticPartVar());
+                               }
+
+                               if ((extraParameterFlags & Advice.ThisEnclosingJoinPointStaticPart) != 0) {
+                                       args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
+                               }
+                       } else {
+                               // @style is slightly different
+                               int currentStateIndex = 0;
+                               // FIXME AV - "args(jp)" test(jp, thejp) will fail here
+                               for (int i = 0; i < testMethod.getParameterTypes().length; i++) {
+                                       String argSignature = testMethod.getParameterTypes()[i].getSignature();
+                                       if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argSignature)) {
+                                               args.add(shadow.getThisJoinPointVar());
+                                       } else if (AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argSignature)) {
+                                               args.add(shadow.getThisJoinPointVar());
+                                       } else if (AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argSignature)) {
+                                               args.add(shadow.getThisJoinPointStaticPartVar());
+                                       } else if (AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argSignature)) {
+                                               args.add(shadow.getThisEnclosingJoinPointStaticPartVar());
+                                       } else {
+                                               // we don't use i as JoinPoint.* can be anywhere in the signature in @style
+                                               Var v = state.get(currentStateIndex++);
+                                               args.add(v);
+                                               ret = Test.makeAnd(ret, Test.makeInstanceof(v, testMethod.getParameterTypes()[i]
+                                                               .resolve(shadow.getIWorld())));
+                                       }
+                               }
+                       }
+
+                       ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[]) args.toArray(new Expr[args.size()])));
 
                        // Remember...
                        ifLastMatchedShadowId = shadow.shadowId;
                        ifLastMatchedShadowResidue = ret;
-                       return ret; 
+                       return ret;
                } finally {
                        findingResidue = false;
                }
        }
-       
 
-       // amc - the only reason this override seems to be here is to stop the copy, but 
+       // amc - the only reason this override seems to be here is to stop the copy, but
        // that can be prevented by overriding shouldCopyLocationForConcretization,
        // allowing me to make the method final in Pointcut.
-//     public Pointcut concretize(ResolvedType inAspect, IntMap bindings) {
-//             return this.concretize1(inAspect, bindings);
-//     }
-       
+       // public Pointcut concretize(ResolvedType inAspect, IntMap bindings) {
+       // return this.concretize1(inAspect, bindings);
+       // }
+
        protected boolean shouldCopyLocationForConcretize() {
                return false;
        }
-       
+
        private IfPointcut partiallyConcretized = null;
-       public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType,  IntMap bindings) {
-               //System.err.println("concretize: " + this + " already: " + partiallyConcretized);
-               
+
+       public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
+               // System.err.println("concretize: " + this + " already: " + partiallyConcretized);
+
                if (isDeclare(bindings.getEnclosingAdvice())) {
                        // Enforce rule about which designators are supported in declare
-                       inAspect.getWorld().showMessage(IMessage.ERROR,
-                                       WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
-                                       bindings.getEnclosingAdvice().getSourceLocation(),
-                                       null);
+                       inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
+                                       bindings.getEnclosingAdvice().getSourceLocation(), null);
                        return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                }
 
@@ -271,68 +274,64 @@ public class IfPointcut extends Pointcut {
                        return partiallyConcretized;
                }
 
-        final IfPointcut ret;
-        if (extraParameterFlags < 0 && testMethod == null) {
-            // @AJ style, we need to find the testMethod in the aspect defining the "if()" enclosing pointcut
-            ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
-            if (def != null) {
-                ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType());
-                for (Iterator memberIter = aspect.getMethods(); memberIter.hasNext();) {
-                    ResolvedMember method = (ResolvedMember) memberIter.next();
-                    if (def.getName().equals(method.getName())
-                        && def.getParameterTypes().length == method.getParameterTypes().length) {
-                        boolean sameSig = true;
-                        for (int j = 0; j < method.getParameterTypes().length; j++) {
-                            UnresolvedType argJ = method.getParameterTypes()[j];
-                            if (!argJ.equals(def.getParameterTypes()[j])) {
-                                sameSig = false;
-                                break;
-                            }
-                        }
-                        if (sameSig) {
-                            testMethod = method;
-                            break;
-                        }
-                    }
-                }
-                if (testMethod == null) {
-                    inAspect.getWorld().showMessage(
-                            IMessage.ERROR,
-                            "Cannot find if() body from '" + def.toString() + "' for '" + enclosingPointcutHint + "'",
-                            this.getSourceLocation(),
-                            null
-                    );
-                    return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
-                }
-            } else {
-                testMethod = inAspect.getWorld().resolve(bindings.getAdviceSignature());
-            }
-            ret = new IfPointcut(enclosingPointcutHint);
-            ret.testMethod = testMethod;
-        } else {
-            ret = new IfPointcut(testMethod, extraParameterFlags);
-        }
-        ret.copyLocationFrom(this);
-        partiallyConcretized = ret;
+               final IfPointcut ret;
+               if (extraParameterFlags < 0 && testMethod == null) {
+                       // @AJ style, we need to find the testMethod in the aspect defining the "if()" enclosing pointcut
+                       ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
+                       if (def != null) {
+                               ResolvedType aspect = inAspect.getWorld().resolve(def.getDeclaringType());
+                               for (Iterator memberIter = aspect.getMethods(); memberIter.hasNext();) {
+                                       ResolvedMember method = (ResolvedMember) memberIter.next();
+                                       if (def.getName().equals(method.getName())
+                                                       && def.getParameterTypes().length == method.getParameterTypes().length) {
+                                               boolean sameSig = true;
+                                               for (int j = 0; j < method.getParameterTypes().length; j++) {
+                                                       UnresolvedType argJ = method.getParameterTypes()[j];
+                                                       if (!argJ.equals(def.getParameterTypes()[j])) {
+                                                               sameSig = false;
+                                                               break;
+                                                       }
+                                               }
+                                               if (sameSig) {
+                                                       testMethod = method;
+                                                       break;
+                                               }
+                                       }
+                               }
+                               if (testMethod == null) {
+                                       inAspect.getWorld().showMessage(IMessage.ERROR,
+                                                       "Cannot find if() body from '" + def.toString() + "' for '" + enclosingPointcutHint + "'",
+                                                       this.getSourceLocation(), null);
+                                       return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
+                               }
+                       } else {
+                               testMethod = inAspect.getWorld().resolve(bindings.getAdviceSignature());
+                       }
+                       ret = new IfPointcut(enclosingPointcutHint);
+                       ret.testMethod = testMethod;
+               } else {
+                       ret = new IfPointcut(testMethod, extraParameterFlags);
+               }
+               ret.copyLocationFrom(this);
+               partiallyConcretized = ret;
 
                // It is possible to directly code your pointcut expression in a per clause
                // rather than defining a pointcut declaration and referencing it in your
-               // per clause.  If you do this, we have problems (bug #62458).  For now,
+               // per clause. If you do this, we have problems (bug #62458). For now,
                // let's police that you are trying to code a pointcut in a per clause and
                // put out a compiler error.
-               if (bindings.directlyInAdvice() && bindings.getEnclosingAdvice()==null) {
+               if (bindings.directlyInAdvice() && bindings.getEnclosingAdvice() == null) {
                        // Assumption: if() is in a per clause if we say we are directly in advice
                        // but we have no enclosing advice.
-                       inAspect.getWorld().showMessage(IMessage.ERROR,
-                                       WeaverMessages.format(WeaverMessages.IF_IN_PERCLAUSE),
-                                       this.getSourceLocation(),null);
+                       inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_IN_PERCLAUSE),
+                                       this.getSourceLocation(), null);
                        return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                }
-               
+
                if (bindings.directlyInAdvice()) {
                        ShadowMunger advice = bindings.getEnclosingAdvice();
                        if (advice instanceof Advice) {
-                               ret.baseArgsCount = ((Advice)advice).getBaseParameterCount();
+                               ret.baseArgsCount = ((Advice) advice).getBaseParameterCount();
                        } else {
                                ret.baseArgsCount = 0;
                        }
@@ -340,70 +339,69 @@ public class IfPointcut extends Pointcut {
                } else {
                        ResolvedPointcutDefinition def = bindings.peekEnclosingDefinition();
                        if (def == CflowPointcut.CFLOW_MARKER) {
-                               inAspect.getWorld().showMessage(IMessage.ERROR,
-                                               WeaverMessages.format(WeaverMessages.IF_LEXICALLY_IN_CFLOW),
+                               inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_LEXICALLY_IN_CFLOW),
                                                getSourceLocation(), null);
                                return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                        }
                        ret.baseArgsCount = def.getParameterTypes().length;
 
-            // for @style, we have implicit binding for JoinPoint.* things
-            //FIXME AV - will lead to failure for "args(jp)" test(jp, thejp) / see args() implementation
-            if (ret.extraParameterFlags < 0) {
-                ret.baseArgsCount = 0;
-                for (int i = 0; i < testMethod.getParameterTypes().length; i++) {
-                    String argSignature = testMethod.getParameterTypes()[i].getSignature();
-                    if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argSignature)
-                        || AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argSignature)
-                        || AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argSignature)
-                        || AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argSignature)) {
-                        
-                    } else {
-                        ret.baseArgsCount++;
-                    }
-                }
-            }
+                       // for @style, we have implicit binding for JoinPoint.* things
+                       // FIXME AV - will lead to failure for "args(jp)" test(jp, thejp) / see args() implementation
+                       if (ret.extraParameterFlags < 0) {
+                               ret.baseArgsCount = 0;
+                               for (int i = 0; i < testMethod.getParameterTypes().length; i++) {
+                                       String argSignature = testMethod.getParameterTypes()[i].getSignature();
+                                       if (AjcMemberMaker.TYPEX_JOINPOINT.getSignature().equals(argSignature)
+                                                       || AjcMemberMaker.TYPEX_PROCEEDINGJOINPOINT.getSignature().equals(argSignature)
+                                                       || AjcMemberMaker.TYPEX_STATICJOINPOINT.getSignature().equals(argSignature)
+                                                       || AjcMemberMaker.TYPEX_ENCLOSINGSTATICJOINPOINT.getSignature().equals(argSignature)) {
+
+                                       } else {
+                                               ret.baseArgsCount++;
+                                       }
+                               }
+                       }
 
                        IntMap newBindings = IntMap.idMap(ret.baseArgsCount);
                        newBindings.copyContext(bindings);
                        ret.residueSource = def.getPointcut().concretize(inAspect, declaringType, newBindings);
                }
-               
+
                return ret;
        }
 
        // we can't touch "if" methods
-       public Pointcut parameterizeWith(Map typeVariableMap,World w) {
+       public Pointcut parameterizeWith(Map typeVariableMap, World w) {
                return this;
        }
-       
-//     public static Pointcut MatchesNothing = new MatchesNothingPointcut();
-//     ??? there could possibly be some good optimizations to be done at this point
+
+       // public static Pointcut MatchesNothing = new MatchesNothingPointcut();
+       // ??? there could possibly be some good optimizations to be done at this point
        public static IfPointcut makeIfFalsePointcut(State state) {
                IfPointcut ret = new IfFalsePointcut();
                ret.state = state;
                return ret;
        }
 
-    public Object accept(PatternNodeVisitor visitor, Object data) {
-        return visitor.visit(this, data);
-    }
+       public Object accept(PatternNodeVisitor visitor, Object data) {
+               return visitor.visit(this, data);
+       }
 
        public static class IfFalsePointcut extends IfPointcut {
-               
+
                public IfFalsePointcut() {
-                       super(null,0);
-            this.pointcutKind = Pointcut.IF_FALSE;
+                       super(null, 0);
+                       this.pointcutKind = Pointcut.IF_FALSE;
                }
-               
+
                public int couldMatchKinds() {
                        return Shadow.NO_SHADOW_KINDS_BITS;
                }
-               
+
                public boolean alwaysFalse() {
                        return true;
                }
-               
+
                protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                        return Literal.FALSE; // can only get here if an earlier error occurred
                }
@@ -411,49 +409,39 @@ public class IfPointcut extends Pointcut {
                public FuzzyBoolean fastMatch(FastMatchInfo type) {
                        return FuzzyBoolean.NO;
                }
-               
+
                protected FuzzyBoolean matchInternal(Shadow shadow) {
                        return FuzzyBoolean.NO;
                }
-               
-               public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
-                       return FuzzyBoolean.NO;
-               }
 
                public void resolveBindings(IScope scope, Bindings bindings) {
                }
-               
+
                public void postRead(ResolvedType enclosingType) {
                }
 
-               public Pointcut concretize1(
-                       ResolvedType inAspect,
-                       ResolvedType declaringType,
-                       IntMap bindings) {
+               public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                        if (isDeclare(bindings.getEnclosingAdvice())) {
                                // Enforce rule about which designators are supported in declare
-                               inAspect.getWorld().showMessage(IMessage.ERROR,
-                                 WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
-                                 bindings.getEnclosingAdvice().getSourceLocation(),
-                                 null);
+                               inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
+                                               bindings.getEnclosingAdvice().getSourceLocation(), null);
                                return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                        }
                        return makeIfFalsePointcut(state);
                }
 
-
                public void write(DataOutputStream s) throws IOException {
                        s.writeByte(Pointcut.IF_FALSE);
                }
-               
-           public int hashCode() {
-               int result = 17;
-               return result;
-           }
-               
-           public String toString() {
+
+               public int hashCode() {
+                       int result = 17;
+                       return result;
+               }
+
+               public String toString() {
                        return "if(false)";
-               }       
+               }
        }
 
        public static IfPointcut makeIfTruePointcut(State state) {
@@ -463,16 +451,16 @@ public class IfPointcut extends Pointcut {
        }
 
        public static class IfTruePointcut extends IfPointcut {
-                       
+
                public IfTruePointcut() {
-                       super(null,0);
-            this.pointcutKind = Pointcut.IF_TRUE;
+                       super(null, 0);
+                       this.pointcutKind = Pointcut.IF_TRUE;
                }
 
                public boolean alwaysTrue() {
                        return true;
                }
-               
+
                protected Test findResidueInternal(Shadow shadow, ExposedState state) {
                        return Literal.TRUE; // can only get here if an earlier error occurred
                }
@@ -480,50 +468,39 @@ public class IfPointcut extends Pointcut {
                public FuzzyBoolean fastMatch(FastMatchInfo type) {
                        return FuzzyBoolean.YES;
                }
-               
+
                protected FuzzyBoolean matchInternal(Shadow shadow) {
                        return FuzzyBoolean.YES;
                }
-               
-               public FuzzyBoolean match(JoinPoint.StaticPart jpsp) {
-                       return FuzzyBoolean.YES;
-               }
 
                public void resolveBindings(IScope scope, Bindings bindings) {
                }
-               
+
                public void postRead(ResolvedType enclosingType) {
                }
 
-               public Pointcut concretize1(
-                       ResolvedType inAspect,
-                       ResolvedType declaringType,
-                       IntMap bindings) {
+               public Pointcut concretize1(ResolvedType inAspect, ResolvedType declaringType, IntMap bindings) {
                        if (isDeclare(bindings.getEnclosingAdvice())) {
                                // Enforce rule about which designators are supported in declare
-                               inAspect.getWorld().showMessage(IMessage.ERROR,
-                                               WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
-                                               bindings.getEnclosingAdvice().getSourceLocation(),
-                                               null);
+                               inAspect.getWorld().showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.IF_IN_DECLARE),
+                                               bindings.getEnclosingAdvice().getSourceLocation(), null);
                                return Pointcut.makeMatchesNothing(Pointcut.CONCRETE);
                        }
                        return makeIfTruePointcut(state);
                }
 
-
                public void write(DataOutputStream s) throws IOException {
                        s.writeByte(IF_TRUE);
                }
-               
-           public int hashCode() {
-               int result = 37;
-               return result;
-           }
-               
-           public String toString() {
+
+               public int hashCode() {
+                       int result = 37;
+                       return result;
+               }
+
+               public String toString() {
                        return "if(true)";
-               }       
+               }
        }
 
 }
-
index 51bee71523a65ead650ce393ea0de7ec1417f8c2..ab28c8fae8ea8778a10d06ee2b16c2038b6e3ece 100644 (file)
@@ -29,7 +29,6 @@ import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.ast.Var;
-import org.aspectj.weaver.bcel.BcelAccessForInlineMunger;
 
 public class PerObject extends PerClause {
        private final boolean isThis;
@@ -131,7 +130,7 @@ public class PerObject extends PerClause {
                // ATAJ inline around advice support - don't use a late munger to allow
                // around inling for itself
                if (inAspect.isAnnotationStyleAspect() && !inAspect.getWorld().isXnoInline()) {
-                       inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
+                       inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().createAccessForInlineMunger(inAspect));
                }
 
                return ret;
index 3e5a97023eee5bd94f1eb28e8a8e422620146e50..e91e9f45dfb5ae4174ca222562ffbada6a557d9f 100644 (file)
@@ -27,7 +27,6 @@ import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
-import org.aspectj.weaver.bcel.BcelAccessForInlineMunger;
 
 public class PerSingleton extends PerClause {
 
@@ -65,7 +64,7 @@ public class PerSingleton extends PerClause {
                // or remove
                //
                // Expr myInstance =
-               //Expr.makeCallExpr(AjcMemberMaker.perSingletonAspectOfMethod(inAspect),
+               // Expr.makeCallExpr(AjcMemberMaker.perSingletonAspectOfMethod(inAspect),
                // Expr.NONE, inAspect);
                //
                // state.setAspectInstance(myInstance);
@@ -111,6 +110,8 @@ public class PerSingleton extends PerClause {
 
                ret.copyLocationFrom(this);
 
+               World world = inAspect.getWorld();
+
                ret.inAspect = inAspect;
 
                // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
@@ -119,17 +120,15 @@ public class PerSingleton extends PerClause {
                        // dig:
                        // "can't be Serializable/Cloneable unless -XserializableAspects"
                        if (getKind() == SINGLETON) { // pr149560
-                               inAspect.crosscuttingMembers.addTypeMunger(inAspect.getWorld().getWeavingSupport().makePerClauseAspect(inAspect,
-                                               getKind()));
+                               inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind()));
                        } else {
-                               inAspect.crosscuttingMembers.addLateTypeMunger(inAspect.getWorld().getWeavingSupport().makePerClauseAspect(
-                                               inAspect, getKind()));
+                               inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind()));
                        }
                }
 
                // ATAJ inline around advice support
                if (inAspect.isAnnotationStyleAspect() && !inAspect.getWorld().isXnoInline()) {
-                       inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
+                       inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().createAccessForInlineMunger(inAspect));
                }
 
                return ret;
index df7e4085a8ac0da7b88889a699d26ad3db236006..9c1fd655bde7a3e7990425c13dcef06e95508e7f 100644 (file)
@@ -33,7 +33,6 @@ import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Expr;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
-import org.aspectj.weaver.bcel.BcelAccessForInlineMunger;
 
 // PTWIMPL Represents a parsed pertypewithin()
 public class PerTypeWithin extends PerClause {
@@ -106,8 +105,7 @@ public class PerTypeWithin extends PerClause {
                Expr myInstance = Expr.makeCallExpr(AjcMemberMaker.perTypeWithinLocalAspectOf(shadow.getEnclosingType(), inAspect/*
                                                                                                                                                                                                                                                 * shadow.
                                                                                                                                                                                                                                                 * getEnclosingType
-                                                                                                                                                                                                                                                * (
-                                                                                                                                                                                                                                                * )
+                                                                                                                                                                                                                                                * ( )
                                                                                                                                                                                                                                                 */),
                                Expr.NONE, inAspect);
                state.setAspectInstance(myInstance);
@@ -123,7 +121,7 @@ public class PerTypeWithin extends PerClause {
 
                // This is what is in the perObject variant of this ...
                // Expr myInstance =
-               //Expr.makeCallExpr(AjcMemberMaker.perTypeWithinAspectOfMethod(inAspect)
+               // Expr.makeCallExpr(AjcMemberMaker.perTypeWithinAspectOfMethod(inAspect)
                // ,
                // new Expr[] {getVar(shadow)}, inAspect);
                // state.setAspectInstance(myInstance);
@@ -159,6 +157,7 @@ public class PerTypeWithin extends PerClause {
 
                // This munger will initialize the aspect instance field in the matched
                // type
+
                inAspect.crosscuttingMembers.addConcreteShadowMunger(Advice.makePerTypeWithinEntry(world, andPcut, inAspect));
 
                ResolvedTypeMunger munger = new PerTypeWithinTargetTypeMunger(inAspect, ret);
@@ -166,14 +165,13 @@ public class PerTypeWithin extends PerClause {
 
                // ATAJ: add a munger to add the aspectOf(..) to the @AJ aspects
                if (inAspect.isAnnotationStyleAspect() && !inAspect.isAbstract()) {
-                       inAspect.crosscuttingMembers.addLateTypeMunger(inAspect.getWorld().getWeavingSupport().makePerClauseAspect(inAspect,
-                                       getKind()));
+                       inAspect.crosscuttingMembers.addLateTypeMunger(world.getWeavingSupport().makePerClauseAspect(inAspect, getKind()));
                }
 
                // ATAJ inline around advice support - don't use a late munger to allow
                // around inling for itself
-               if (inAspect.isAnnotationStyleAspect() && !inAspect.getWorld().isXnoInline()) {
-                       inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
+               if (inAspect.isAnnotationStyleAspect() && !world.isXnoInline()) {
+                       inAspect.crosscuttingMembers.addTypeMunger(world.getWeavingSupport().createAccessForInlineMunger(inAspect));
                }
 
                return ret;