]> source.dussan.org Git - aspectj.git/commitdiff
remove accidental 1.5 dependency in tests module
authoracolyer <acolyer>
Wed, 9 Mar 2005 15:03:50 +0000 (15:03 +0000)
committeracolyer <acolyer>
Wed, 9 Mar 2005 15:03:50 +0000 (15:03 +0000)
tests/java5/annotations/aspectMembers/a/AnnotatedAspect05.aj
tests/src/org/aspectj/systemtest/ajc150/Annotations.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index f54f15e8d71ef329ee711fc845303273bd087fca..9739187f05b9e95ca13f86d628a23339eacfcca1 100644 (file)
@@ -1,6 +1,7 @@
 package a;
 
 import org.aspectj.lang.annotation.SuppressAjWarnings;
+import java.lang.annotation.Annotation;
 
 @TypeAnnotation
 public aspect AnnotatedAspect05 {
@@ -21,7 +22,18 @@ public aspect AnnotatedAspect05 {
        
        @MethodAnnotation
        @SuppressAjWarnings
-       void around() : call(new(..)) { proceed(); }
+       Object around() : call(new(..)) { return proceed(); }
        
+       public static void main(String[] args) {
+               java.lang.reflect.Method[] methods = AnnotatedAspect05.class.getDeclaredMethods();
+               for (int i = 0; i < methods.length; i++) {
+                       if (methods[i].getName().startsWith("ajc$afterThrowing")) {
+                               Annotation annotation = methods[i].getAnnotation(AnyAnnotation.class);
+                               if (annotation == null) {
+                                       throw new RuntimeException("advice should be annotated");
+                               }
+                       }
+               }
+       }
 }
 
index 4e0a16d459c219816ab81ba885d6bc63e83206cc..4cf7d0a7b42233034cc98658703f3a9c7c03c068 100644 (file)
@@ -11,9 +11,6 @@
 package org.aspectj.systemtest.ajc150;
 
 import java.io.File;
-import java.lang.annotation.Annotation;
-import java.net.URL;
-import java.net.URLClassLoader;
 
 import junit.framework.Test;
 
@@ -88,21 +85,6 @@ public class Annotations extends XMLBasedAjcTestCase {
   
   public void testAnnotatedAdvice() {
        runTest("annotated advice");
-       try {
-               File classFile = new File(ajc.getSandboxDirectory(),"a/AnnotatedAspect05.class");       
-               ClassLoader cl = new URLClassLoader(new URL[] {ajc.getSandboxDirectory().toURI().toURL()});
-               Class c = cl.loadClass("a.AnnotatedAspect05");
-               Class ann = cl.loadClass("a.AnyAnnotation");
-               java.lang.reflect.Method[] methods = c.getDeclaredMethods();
-               for (int i = 0; i < methods.length; i++) {
-                       if (methods[i].getName().startsWith("ajc$afterThrowing")) {
-                               Annotation annotation = methods[i].getAnnotation(ann);
-                               assertNotNull("Should have @AnyAnnotation",annotation);
-                       }
-               }
-       } catch (Exception ex) {
-               fail(ex.getMessage());
-       }
   }
   
   public void testAnnotatedAdviceWithWrongAnnotationType() {
index 258145e5ca561dd8456d4bfd12a076a006031de3..094ddf8586b072524f014a029de1de36a765d043 100644 (file)
 
     <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice">
         <compile files="a/Annotations.java,a/AnnotatedAspect05.aj" options="-1.5">
-            <message kind="warning" line="16"/>
+            <message kind="warning" line="17"/>
         </compile>
+        <run class="a.AnnotatedAspect05"/>
     </ajc-test>
 
     <ajc-test dir="java5/annotations/aspectMembers" title="annotated advice with bad target">