From 922aeaa57dcb071c5a3007827c2268d707e557f2 Mon Sep 17 00:00:00 2001
From: acolyer <acolyer>
Date: Thu, 10 Mar 2005 13:00:42 +0000
Subject: fixes for annotation type pattern bugs uncovered in 150 tests

---
 tests/java5/annotations/ajdkExamples/RuntimeTypeMatching.aj |  9 ++++-----
 tests/java5/pertypewithin/ajdk/AJDKExamples.aj              |  3 ++-
 tests/src/org/aspectj/systemtest/ajc150/ajc150.xml          | 10 ++++++----
 3 files changed, 12 insertions(+), 10 deletions(-)

(limited to 'tests')

diff --git a/tests/java5/annotations/ajdkExamples/RuntimeTypeMatching.aj b/tests/java5/annotations/ajdkExamples/RuntimeTypeMatching.aj
index 16d85affc..086bea247 100644
--- a/tests/java5/annotations/ajdkExamples/RuntimeTypeMatching.aj
+++ b/tests/java5/annotations/ajdkExamples/RuntimeTypeMatching.aj
@@ -89,11 +89,10 @@ public aspect RuntimeTypeMatching {
   	before() : insideCriticalMethod(Critical) {
   		Signature sig = thisEnclosingJoinPointStaticPart.getSignature();
   	  	AnnotatedElement declaringTypeAnnotationInfo = sig.getDeclaringType();
-  	  	if (sig instanceof MemberSignature) {
-  	  	  // this must be an initialization, pre-initialization, call, execution, get, or
-  	  	  // set join point.
-  	  	  AnnotatedElement memberAnnotationInfo = ((MemberSignature)sig).getAccessibleObject();
-  	  	  Critical c = memberAnnotationInfo.getAnnotation(Critical.class);
+  	  	if (sig instanceof MethodSignature) {
+  	  	  // this must be a call or execution join point.
+  	  	  Method method = ((MethodSignature)sig).getMethod();
+  	  	  Critical c = method.getAnnotation(Critical.class);
   	  	  System.out.println("Entering critical join point with reflectively obtained priority " + c.priority());
   	  	}
   	}
diff --git a/tests/java5/pertypewithin/ajdk/AJDKExamples.aj b/tests/java5/pertypewithin/ajdk/AJDKExamples.aj
index 433270cf4..a03c72643 100644
--- a/tests/java5/pertypewithin/ajdk/AJDKExamples.aj
+++ b/tests/java5/pertypewithin/ajdk/AJDKExamples.aj
@@ -1,5 +1,6 @@
+package org.xyz.foo;
 import java.util.*;
-public aspect AJDKExamples pertypewithin(org.xyz..*) {
+public aspect AJDKExamples pertypewithin(org.xyz..* && !AJDKExamples) {
 		     
    // use WeakHashMap for auto-garbage collection of keys  	 
    private Map<Object,Boolean> instances = new WeakHashMap<Object,Boolean>();
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index 4ef1703da..7329d2996 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -1111,14 +1111,16 @@
 
     <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: runtime annotations">
         <compile files="RuntimeTypeMatching.aj" options="-1.5">
+            <message kind="warning" line="121" text="@within(Foo)"/>
             <message kind="warning" line="122" text="@within(Foo)"/>
-            <message kind="warning" line="123" text="@within(Foo)"/>
         </compile>
         <run class="RuntimeTypeMatching">
             <stdout>
               <line text="This information is TOP-SECRET"/>
               <line text="@target(Classified) at call(void A.a())"/>
               <line text="@this(Foo) at execution(void B.b())"/>
+              <line text="Classified data being passed at call(void B.callA(A))"/>
+              <line text="Classified data being passed at execution(void B.callA(A))"/>
               <line text="This information is TOP-SECRET"/>
               <line text="@target(Classified) at call(Class java.lang.Object.getClass())"/>
               <line text="1 @Foo()"/>
@@ -1234,12 +1236,12 @@
 
     <ajc-test dir="java5/pertypewithin/ajdk" title="ajdk: ptw">
         <compile files="AJDKExamples.aj" options="-1.5"/>
-        <run class="AJDKExamples">
+        <run class="org.xyz.foo.AJDKExamples">
             <stdout>
                 <line text="true"/>
                 <line text="true"/>
-                <line text="There are 3 As"/>
-                <line text="There are 2 Bs"/>
+                <line text="There are 2 As"/>
+                <line text="There are 3 Bs"/>
             </stdout>
         </run>
     </ajc-test>
-- 
cgit v1.2.3