]> source.dussan.org Git - aspectj.git/commitdiff
completed @this and @target
authoracolyer <acolyer>
Thu, 9 Dec 2004 17:47:44 +0000 (17:47 +0000)
committeracolyer <acolyer>
Thu, 9 Dec 2004 17:47:44 +0000 (17:47 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelRenderer.java
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java

index bddcf7a5067f53155428f44881a85f55036aa7fa..d32d54a6c185c3e204b586eef52e47a779dc75af 100644 (file)
@@ -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());
index 4b8686c27147c44939b1f2833236f31ee701ba56..516e3668120569774490c1a19527a8642da6dfa0 100644 (file)
@@ -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;