aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/features161/optimizedAnnotationBinding/CaseThirteen.java35
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java3
-rw-r--r--tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml10
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/features161/optimizedAnnotationBinding/CaseThirteen.java b/tests/features161/optimizedAnnotationBinding/CaseThirteen.java
new file mode 100644
index 000000000..e540a12c9
--- /dev/null
+++ b/tests/features161/optimizedAnnotationBinding/CaseThirteen.java
@@ -0,0 +1,35 @@
+import java.lang.annotation.*;
+
+public class CaseThirteen {
+
+ public static void main(String []argv) {
+
+ CaseThirteen o = new CaseThirteen();
+ o.a();
+ o.b();
+ o.c();
+ o.d();
+ o.e();
+ }
+
+ public void a() {}
+ @Anno(value=Level.NONE,c=Color.RED) public void b() {}
+ @Anno(value=Level.ONE) public void c() {}
+ @Anno(value=Level.TWO,c=Color.GREEN) public void d() {}
+ @Anno(value=Level.THREE,c=Color.BLUE) public void e() {}
+
+}
+
+enum Level { NONE, ONE, TWO, THREE; }
+enum Color { RED, GREEN, BLUE; }
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Anno { Level value(); Color c() default Color.GREEN; }
+
+aspect X {
+
+ before(String l): execution(@Anno !@Anno(Level.NONE) * *(..)) && @annotation(Anno(l)) && @annotation(Anno(c)) {
+ System.out.println(l+""+c);
+ }
+}
+
diff --git a/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java b/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
index 72cba14e2..6f8ec319f 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
+++ b/tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
@@ -57,6 +57,9 @@ public class OptimizedAnnotationFieldBinding extends XMLBasedAjcTestCase {
public void testCaseTwelve_BindingAnnoAndAnnoValue() {
runTest("case twelve - binding anno and anno value");
}
+ public void testCaseThirteen_bugNPE() {
+ runTest("case thirteen - bug npe");
+ }
/////////////////////////////////////////
public static Test suite() {
diff --git a/tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml b/tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml
index 1d6e1d354..f84e08f08 100644
--- a/tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml
+++ b/tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml
@@ -115,4 +115,14 @@
</run>
</ajc-test>
+
+ <ajc-test dir="features161/optimizedAnnotationBinding" title="case thirteen - bug npe">
+ <compile options="-1.5" files="CaseThirteen.java">
+ <message kind="error" line="31" text="The field within the annotation must be an Enum"/>
+ <message kind="error" line="31" text="No field of type 'java.lang.String'"/>
+ <message kind="error" line="31" text="When using @annotation"/>
+ <message kind="error" line="32" text="cannot be resolved"/>
+ </compile>
+ </ajc-test>
+
</suite> \ No newline at end of file