summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java2
-rw-r--r--tests/java5/annotations/thisOrtarget/NotRuntimeRetention.aj41
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml7
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java11
4 files changed, 29 insertions, 32 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
index 826e585f2..2b9c61fbe 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
@@ -280,7 +280,7 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName {
if (!isAnnotation()) {
return false;
} else {
- return (binding.getAnnotationTagBits() & TagBits.AnnotationRuntimeRetention)!=0;
+ return (binding.getAnnotationTagBits() & TagBits.AnnotationRetentionMASK) == TagBits.AnnotationRuntimeRetention;
}
}
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>
diff --git a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
index 3d8ad311f..d32f9184b 100644
--- a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
@@ -50,22 +50,13 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp
world.getMessageHandler().handleMessage(m);
resolved = false;
}
- if (!annotationType.hasAnnotation(TypeX.AT_RETENTION)) {
+ if (!annotationType.isAnnotationWithRuntimeRetention(world)) { // default is class visibility
// default is class visibility
IMessage m = MessageUtil.error(
WeaverMessages.format(WeaverMessages.BINDING_NON_RUNTIME_RETENTION_ANNOTATION,annotationType.getName()),
getSourceLocation());
world.getMessageHandler().handleMessage(m);
resolved = false;
- } else {
- // Get the retention policy annotation, and check the value is RetentionPolicy.RUNTIME;
- // FIXME asc invention required, implement this !
-// if (!annotationType.hasRuntimeRetention()) {
-// ResolvedTypeX[] allAs = annotationType.getAnnotationTypes();
-// for (int i = 0; i < allAs.length; i++) {
-// ResolvedTypeX ann = allAs[i];
-// if ()
-// }
}
}