From 2395fc9e8f1b0b4a5fe9c15861d5afb5d8bd9858 Mon Sep 17 00:00:00 2001 From: aclement Date: Tue, 21 Oct 2008 15:25:26 +0000 Subject: [PATCH] 246125: move dependencies on bcel out of org.aspectj.weaver.ast org.aspectj.weaver.patterns --- .../weaver/{bcel => }/PoliceExtensionUse.java | 4 +--- weaver/src/org/aspectj/weaver/ast/Var.java | 24 +++++++++++++------ .../weaver/patterns/AnnotationPointcut.java | 7 +++--- .../org/aspectj/weaver/patterns/Pointcut.java | 2 +- 4 files changed, 22 insertions(+), 15 deletions(-) rename weaver/src/org/aspectj/weaver/{bcel => }/PoliceExtensionUse.java (96%) diff --git a/weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java b/weaver/src/org/aspectj/weaver/PoliceExtensionUse.java similarity index 96% rename from weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java rename to weaver/src/org/aspectj/weaver/PoliceExtensionUse.java index 5323c77f6..e35a9b8a3 100644 --- a/weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java +++ b/weaver/src/org/aspectj/weaver/PoliceExtensionUse.java @@ -8,12 +8,10 @@ * Contributors: * Andy Clement - initial API and implementation *******************************************************************************/ -package org.aspectj.weaver.bcel; +package org.aspectj.weaver; 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; diff --git a/weaver/src/org/aspectj/weaver/ast/Var.java b/weaver/src/org/aspectj/weaver/ast/Var.java index 3b2450d16..230cfeac6 100644 --- a/weaver/src/org/aspectj/weaver/ast/Var.java +++ b/weaver/src/org/aspectj/weaver/ast/Var.java @@ -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/patterns/AnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java index 028fbc776..184615b6a 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -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)
@@ -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 + "'"); } diff --git a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java index 424d623f4..784b3df17 100644 --- a/weaver/src/org/aspectj/weaver/patterns/Pointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/Pointcut.java @@ -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: -- 2.39.5