From 4a151e1a818651266762a6721d0affd745b51946 Mon Sep 17 00:00:00 2001 From: acolyer Date: Thu, 9 Dec 2004 17:47:44 +0000 Subject: [PATCH] completed @this and @target --- weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java | 2 +- .../patterns/ThisOrTargetAnnotationPointcut.java | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java index bddcf7a50..d32d54a6c 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java @@ -188,7 +188,7 @@ public class BcelRenderer implements ITestVisitor, IExprVisitor { // aload annotationClass int annClassIndex = fact.getConstantPool().addClass(hasAnnotation.getAnnotationType().getSignature()); il.append(new LDC_W(annClassIndex)); - Member isAnnotationPresent = Member.method(TypeX.forName("Ljava/lang/Class"),0, + Member isAnnotationPresent = Member.method(TypeX.forName("java/lang/Class"),0, "isAnnotationPresent","(Ljava/lang/Class;)Z"); il.append(Utility.createInvoke(fact,world,isAnnotationPresent)); il.append(createJumpBasedOnBooleanOnStack()); diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java index 4b8686c27..516e36681 100644 --- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java @@ -73,7 +73,16 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut { // we can attempt to match now ResolvedTypeX toMatchAgainst = (isThis ? shadow.getThisType() : shadow.getTargetType() ).resolve(shadow.getIWorld()); - return FuzzyBoolean.fromBoolean(toMatchAgainst.hasAnnotation(annotationType)); + if (toMatchAgainst.hasAnnotation(annotationType)) { + return FuzzyBoolean.YES; + } else { + ResolvedTypeX superC = toMatchAgainst; + while ((superC = superC.getSuperclass()) != null) { + if (superC.hasAnnotation(annotationType)) return FuzzyBoolean.YES; +// if (superC.getName().equals("java.lang.Object")) return FuzzyBoolean.NO; + } + return FuzzyBoolean.NO; + } } // else we can only do matching via a runtime test return FuzzyBoolean.MAYBE; -- 2.39.5