]> source.dussan.org Git - aspectj.git/commitdiff
246125: move dependencies on bcel out of org.aspectj.weaver.ast org.aspectj.weaver...
authoraclement <aclement>
Tue, 21 Oct 2008 15:25:26 +0000 (15:25 +0000)
committeraclement <aclement>
Tue, 21 Oct 2008 15:25:26 +0000 (15:25 +0000)
weaver/src/org/aspectj/weaver/PoliceExtensionUse.java [new file with mode: 0644]
weaver/src/org/aspectj/weaver/ast/Var.java
weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java [deleted file]
weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
weaver/src/org/aspectj/weaver/patterns/Pointcut.java

diff --git a/weaver/src/org/aspectj/weaver/PoliceExtensionUse.java b/weaver/src/org/aspectj/weaver/PoliceExtensionUse.java
new file mode 100644 (file)
index 0000000..e35a9b8
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *    Andy Clement - initial API and implementation
+ *******************************************************************************/
+package org.aspectj.weaver;
+
+import org.aspectj.bridge.IMessage;
+import org.aspectj.bridge.MessageUtil;
+import org.aspectj.weaver.patterns.AbstractPatternNodeVisitor;
+import org.aspectj.weaver.patterns.AndPointcut;
+import org.aspectj.weaver.patterns.KindedPointcut;
+import org.aspectj.weaver.patterns.NotPointcut;
+import org.aspectj.weaver.patterns.OrPointcut;
+import org.aspectj.weaver.patterns.Pointcut;
+
+/**
+ * Walks a pointcut and determines if the synchronization related designators have been used: lock() or unlock()
+ */
+public class PoliceExtensionUse extends AbstractPatternNodeVisitor {
+
+       private boolean synchronizationDesignatorEncountered;
+       private World world;
+       private Pointcut p;
+
+       public PoliceExtensionUse(World w, Pointcut p) {
+               this.world = w;
+               this.p = p;
+               this.synchronizationDesignatorEncountered = false;
+       }
+
+       public boolean synchronizationDesignatorEncountered() {
+               return synchronizationDesignatorEncountered;
+       }
+
+       public Object visit(KindedPointcut node, Object data) {
+               if (world == null)
+                       return super.visit(node, data); // error scenario can sometimes lead to this LazyClassGen.toLongString()
+               if (node.getKind() == Shadow.SynchronizationLock || node.getKind() == Shadow.SynchronizationUnlock)
+                       synchronizationDesignatorEncountered = true;
+               // Check it!
+               if (!world.isJoinpointSynchronizationEnabled()) {
+                       if (node.getKind() == Shadow.SynchronizationLock) {
+                               IMessage m = MessageUtil.warn(
+                                               "lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization", p
+                                                               .getSourceLocation());
+                               world.getMessageHandler().handleMessage(m);
+                       } else if (node.getKind() == Shadow.SynchronizationUnlock) {
+                               IMessage m = MessageUtil.warn(
+                                               "unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization", p
+                                                               .getSourceLocation());
+                               world.getMessageHandler().handleMessage(m);
+                       }
+               }
+               return super.visit(node, data);
+       }
+
+       public Object visit(AndPointcut node, Object data) {
+               node.getLeft().accept(this, data);
+               node.getRight().accept(this, data);
+               return node;
+       }
+
+       public Object visit(NotPointcut node, Object data) {
+               node.getNegatedPointcut().accept(this, data);
+               return node;
+       }
+
+       public Object visit(OrPointcut node, Object data) {
+               node.getLeft().accept(this, data);
+               node.getRight().accept(this, data);
+               return node;
+       }
+
+}
\ No newline at end of file
index 3b2450d1652704783972242dcdfccd0ef8d0e951..230cfeac6c96a0f2dab569f66a3598cda8fa71c7 100644 (file)
@@ -10,7 +10,6 @@
  *     PARC     initial implementation 
  * ******************************************************************/
 
-
 package org.aspectj.weaver.ast;
 
 import org.aspectj.weaver.ResolvedType;
@@ -20,9 +19,9 @@ public class Var extends Expr {
 
        public Var(ResolvedType variableType) {
                super();
-               this.variableType = variableType;               
+               this.variableType = variableType;
        }
-    
+
        public ResolvedType getType() {
                return variableType;
        }
@@ -30,8 +29,19 @@ public class Var extends Expr {
        public String toString() {
                return "(Var " + variableType + ")";
        }
-    
-    public void accept(IExprVisitor v) {
-        v.visit(this);
-    }
+
+       public void accept(IExprVisitor v) {
+               v.visit(this);
+       }
+
+       /**
+        * For an annotation this will return a variable that can access a specific field of the annotation (of the specified type) TODO
+        * what kind of behaviour happens for two annotation fields of the same type?
+        * 
+        * @param formalType
+        * @return
+        */
+       public Var getAccessorForValue(ResolvedType formalType) {
+               throw new IllegalStateException("Only makes sense for annotation variables");
+       }
 }
diff --git a/weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java b/weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java
deleted file mode 100644 (file)
index 5323c77..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- *    Andy Clement - initial API and implementation
- *******************************************************************************/
-package org.aspectj.weaver.bcel;
-
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.MessageUtil;
-import org.aspectj.weaver.Shadow;
-import org.aspectj.weaver.World;
-import org.aspectj.weaver.patterns.AbstractPatternNodeVisitor;
-import org.aspectj.weaver.patterns.AndPointcut;
-import org.aspectj.weaver.patterns.KindedPointcut;
-import org.aspectj.weaver.patterns.NotPointcut;
-import org.aspectj.weaver.patterns.OrPointcut;
-import org.aspectj.weaver.patterns.Pointcut;
-
-/**
- * Walks a pointcut and determines if the synchronization related designators have been used: lock() or unlock()
- */
-public class PoliceExtensionUse extends AbstractPatternNodeVisitor {
-
-       private boolean synchronizationDesignatorEncountered;
-       private World world;
-       private Pointcut p;
-
-       public PoliceExtensionUse(World w, Pointcut p) {
-               this.world = w;
-               this.p = p;
-               this.synchronizationDesignatorEncountered = false;
-       }
-
-       public boolean synchronizationDesignatorEncountered() {
-               return synchronizationDesignatorEncountered;
-       }
-
-       public Object visit(KindedPointcut node, Object data) {
-               if (world == null)
-                       return super.visit(node, data); // error scenario can sometimes lead to this LazyClassGen.toLongString()
-               if (node.getKind() == Shadow.SynchronizationLock || node.getKind() == Shadow.SynchronizationUnlock)
-                       synchronizationDesignatorEncountered = true;
-               // Check it!
-               if (!world.isJoinpointSynchronizationEnabled()) {
-                       if (node.getKind() == Shadow.SynchronizationLock) {
-                               IMessage m = MessageUtil.warn(
-                                               "lock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization", p
-                                                               .getSourceLocation());
-                               world.getMessageHandler().handleMessage(m);
-                       } else if (node.getKind() == Shadow.SynchronizationUnlock) {
-                               IMessage m = MessageUtil.warn(
-                                               "unlock() pointcut designator cannot be used without the option -Xjoinpoints:synchronization", p
-                                                               .getSourceLocation());
-                               world.getMessageHandler().handleMessage(m);
-                       }
-               }
-               return super.visit(node, data);
-       }
-
-       public Object visit(AndPointcut node, Object data) {
-               node.getLeft().accept(this, data);
-               node.getRight().accept(this, data);
-               return node;
-       }
-
-       public Object visit(NotPointcut node, Object data) {
-               node.getNegatedPointcut().accept(this, data);
-               return node;
-       }
-
-       public Object visit(OrPointcut node, Object data) {
-               node.getLeft().accept(this, data);
-               node.getRight().accept(this, data);
-               return node;
-       }
-
-}
\ No newline at end of file
index 028fbc776defd8276ec7c49afb6241643bf2ef95..184615b6aab7d6c9c7f0ca5073b3966e9274694c 100644 (file)
@@ -23,6 +23,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.AjcMemberMaker;
 import org.aspectj.weaver.AnnotatedElement;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.ConcreteTypeMunger;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
 import org.aspectj.weaver.Member;
@@ -39,8 +40,6 @@ import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
 import org.aspectj.weaver.ast.Var;
-import org.aspectj.weaver.bcel.AnnotationAccessVar;
-import org.aspectj.weaver.bcel.BcelTypeMunger;
 
 /**
  * (at)Annotation((at)Foo) or (at)Annotation(foo)<br>
@@ -139,7 +138,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                                        // FIXME asc should include supers with getInterTypeMungersIncludingSupers ?
                                        List mungers = rMember.getDeclaringType().resolve(shadow.getIWorld()).getInterTypeMungers();
                                        for (Iterator iter = mungers.iterator(); iter.hasNext();) {
-                                               BcelTypeMunger typeMunger = (BcelTypeMunger) iter.next();
+                                               ConcreteTypeMunger typeMunger = (ConcreteTypeMunger) iter.next();
                                                if (typeMunger.getMunger() instanceof NewFieldTypeMunger) {
                                                        ResolvedMember fakerm = typeMunger.getSignature();
                                                        if (fakerm.equals(member)) {
@@ -209,7 +208,7 @@ public class AnnotationPointcut extends NameBindingPointcut {
                        UnresolvedType annoType = btp.getAnnotationType();
                        // TODO 2 need to sort out appropriate creation of the AnnotationAccessFieldVar - what happens for
                        // reflective (ReflectionShadow) access to types?
-                       AnnotationAccessVar var = (AnnotationAccessVar) shadow.getKindedAnnotationVar(annoType);
+                       Var var = shadow.getKindedAnnotationVar(annoType);
                        if (var == null) {
                                throw new BCException("Unexpected problem locating annotation at join point '" + shadow + "'");
                        }
index 424d623f4b17e100ca7675c8948d944dc8ab26b3..784b3df17ef555e6e1c721b05a607f5499855f96 100644 (file)
@@ -25,6 +25,7 @@ import org.aspectj.weaver.BCException;
 import org.aspectj.weaver.Checker;
 import org.aspectj.weaver.ISourceContext;
 import org.aspectj.weaver.IntMap;
+import org.aspectj.weaver.PoliceExtensionUse;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
@@ -32,7 +33,6 @@ import org.aspectj.weaver.VersionedDataInputStream;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.ast.Literal;
 import org.aspectj.weaver.ast.Test;
-import org.aspectj.weaver.bcel.PoliceExtensionUse;
 
 /**
  * The lifecycle of Pointcuts is modeled by Pointcut.State.   It has three things: