--- /dev/null
+/*******************************************************************************
+ * 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
* PARC initial implementation
* ******************************************************************/
-
package org.aspectj.weaver.ast;
import org.aspectj.weaver.ResolvedType;
public Var(ResolvedType variableType) {
super();
- this.variableType = variableType;
+ this.variableType = variableType;
}
-
+
public ResolvedType getType() {
return variableType;
}
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");
+ }
}
+++ /dev/null
-/*******************************************************************************
- * 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
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;
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>
// 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)) {
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 + "'");
}
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;
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: