From f9eebd48f6070a8254b38630d6d76da8c0aee80e Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 12 May 2005 13:00:07 +0000 Subject: Fix and tests for pr84312: runtime retention checking. From Andrew Huff. --- .../thisOrtarget/NotRuntimeRetention.aj | 41 ++++++++++++---------- tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 7 ++-- 2 files changed, 27 insertions(+), 21 deletions(-) (limited to 'tests') 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 @@ - - - + + + + -- cgit v1.2.3