diff options
author | aclement <aclement> | 2005-05-12 13:00:07 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-05-12 13:00:07 +0000 |
commit | f9eebd48f6070a8254b38630d6d76da8c0aee80e (patch) | |
tree | 8dafe680191932a3da890df8aebf9156c2fec4e9 /tests | |
parent | 9be6f2d8567da5ee7628049a452f989b1410402c (diff) | |
download | aspectj-f9eebd48f6070a8254b38630d6d76da8c0aee80e.tar.gz aspectj-f9eebd48f6070a8254b38630d6d76da8c0aee80e.zip |
Fix and tests for pr84312: runtime retention checking. From Andrew Huff.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj | 41 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 7 |
2 files changed, 27 insertions, 21 deletions
diff --git a/tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj b/tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj index 03728c599..bbd986f8a 100644 --- a/tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj +++ b/tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj @@ -1,18 +1,23 @@ -public aspect NotRuntimeRetention { - - pointcut doSomethingExecution() : execution(* doSomething()); - pointcut doSomethingCall() : call(* doSomething()); - - // CE L7 - before() : doSomethingExecution() && @this(MyClassRetentionAnnotation) { - // should be compile-time error! - System.out.println("How did I get here?"); - } - - // CE L13 - after() returning : doSomethingCall() && @target(MyClassRetentionAnnotation) { - // should be compile-time error! - System.out.println("How did I get here?"); - } - -}
\ No newline at end of file +//"must have runtime retention" + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@interface MyRuntimeAnnotation {} + +@Retention(RetentionPolicy.SOURCE) +@interface MySourceAnnotation {} + +@Retention(RetentionPolicy.CLASS) +@interface MyClassAnnotation {} + +@interface MyAnnotation {} + +aspect X { + @MyRuntimeAnnotation @MySourceAnnotation @MyClassAnnotation @MyAnnotation + void a(){} + before(MyRuntimeAnnotation a): execution(* *(..)) && @annotation(a) {} // no error + before(MySourceAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected + before(MyClassAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected + before(MyAnnotation a): execution(* *(..)) && @annotation(a) {} // error expected +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 6a5222ae6..2bb4efb95 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -391,9 +391,10 @@ </ajc-test> <ajc-test dir="java5/annotations/thisOrtarget" vm="1.5" title="must have runtime retention"> - <compile options="-1.5" files="TestingAnnotations.java,NotRuntimeRetention.aj"> - <message kind="error" line="7" text="Annotation type MyClassRetentionAnnotation does not have runtime retention"/> - <message kind="error" line="13" text="Annotation type MyClassRetentionAnnotation does not have runtime retention"/> + <compile options="-1.5" files="NotRuntimeRetention.aj"> + <message kind="error" line="20" text="Annotation type MySourceAnnotation does not have runtime retention"/> + <message kind="error" line="21" text="Annotation type MyClassAnnotation does not have runtime retention"/> + <message kind="error" line="22" text="Annotation type MyAnnotation does not have runtime retention"/> </compile> </ajc-test> |