]> source.dussan.org Git - aspectj.git/commitdiff
234934: bug fix - npe
authoraclement <aclement>
Sun, 1 Jun 2008 20:47:17 +0000 (20:47 +0000)
committeraclement <aclement>
Sun, 1 Jun 2008 20:47:17 +0000 (20:47 +0000)
tests/features161/optimizedAnnotationBinding/CaseThirteen.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc161/OptimizedAnnotationFieldBinding.java
tests/src/org/aspectj/systemtest/ajc161/annotationFieldBinding.xml

diff --git a/tests/features161/optimizedAnnotationBinding/CaseThirteen.java b/tests/features161/optimizedAnnotationBinding/CaseThirteen.java
new file mode 100644 (file)
index 0000000..e540a12
--- /dev/null
@@ -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);
+  }
+}
+
index 72cba14e2f7ddb6eabdb526caff96518ce5228df..6f8ec319f97ed96314a3b396601a3e9a4e7780b8 100644 (file)
@@ -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() {
index 1d6e1d354c83b32ded36103fbb31db764063ca43..f84e08f08990acd547a53af7d630d14e12f6ba0c 100644 (file)
      </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