]> source.dussan.org Git - aspectj.git/commitdiff
more tests from bugzilla
authorjhugunin <jhugunin>
Tue, 7 Jan 2003 23:19:58 +0000 (23:19 +0000)
committerjhugunin <jhugunin>
Tue, 7 Jan 2003 23:19:58 +0000 (23:19 +0000)
tests/ajcTests.xml
tests/bugs/DeclareSoftCf.java [new file with mode: 0644]
tests/bugs/ExceptionsOnInters.java [new file with mode: 0644]
tests/bugs/InterFieldArrays.java [new file with mode: 0644]
tests/jimTests.xml

index b5d9a0362fb72244c07f362b0acb9b13a139ca23..46d3e03a6fa4f1b3f191344a33b3344be80a1b5a 100644 (file)
         <run class="ConstructorArgTracing"/>
     </ajc-test>
     
+    <ajc-test dir="bugs" pr="29106" title="declared exceptions in inter-type decls">
+        <compile files="ExceptionsOnInters.java"/>
+        <run class="ExceptionsOnInters"/>
+    </ajc-test>
+    
+    <ajc-test dir="bugs" pr="28921"
+      title="Verify error on non-Throwable in declare soft">
+        <compile files="DeclareSoftCf.java" options="-Xlint:warning">
+                 <message kind="warning" line="28"/>
+                 <message kind="error" line="29"/>
+        </compile>
+    </ajc-test>
+    
+    <ajc-test dir="bugs" pr="29113" title="inter-type fields with array types">
+        <compile files="InterFieldArrays.java"/>
+        <run class="InterFieldArrays"/>
+    </ajc-test>
 </suite>
diff --git a/tests/bugs/DeclareSoftCf.java b/tests/bugs/DeclareSoftCf.java
new file mode 100644 (file)
index 0000000..2c9e558
--- /dev/null
@@ -0,0 +1,31 @@
+// from Bug 28921 
+import org.aspectj.lang.*;
+
+public class DeclareSoftCf {
+
+    public static void a(){
+        b();
+    }
+    /**
+     * Method b.
+     */
+    private static void b() {
+        throw new RuntimeException("Orig");
+    }
+    
+    public static void main(String[] args) {
+        try {
+            a();
+        } catch (SoftException e) {
+            System.out.println(e.getWrappedThrowable());
+        }
+    }
+    
+    public static interface Checked{
+    }
+    
+    static aspect Softner{
+        declare parents : Exception+ && !RuntimeException implements Checked;
+        declare soft : Checked : within(DeclareSoftCf);  // ERR: Checked not a Throwable
+    }
+}
\ No newline at end of file
diff --git a/tests/bugs/ExceptionsOnInters.java b/tests/bugs/ExceptionsOnInters.java
new file mode 100644 (file)
index 0000000..58bb5ef
--- /dev/null
@@ -0,0 +1,23 @@
+// from Bug 29106 
+
+public class ExceptionsOnInters {
+  public static void main(String args[]) {
+    try {
+      ExceptionsOnInters.bomb();
+    } catch (BombException e) {
+      System.err.println(e);
+    }
+  }
+}
+
+aspect Bomb {
+  public static void ExceptionsOnInters.bomb() throws BombException {
+    throw new BombException("KABOOM");
+  }
+}
+
+class BombException extends Exception {
+  public BombException(String message) {
+    super(message);
+  }
+}
diff --git a/tests/bugs/InterFieldArrays.java b/tests/bugs/InterFieldArrays.java
new file mode 100644 (file)
index 0000000..e44e9f5
--- /dev/null
@@ -0,0 +1,27 @@
+import org.aspectj.testing.Tester;
+
+public class InterFieldArrays {
+       public static void main(String[] args) {
+               Foo foo = new Foo();
+               Tester.checkEqual(foo.bar.length, 3);
+               Tester.checkEqual(foo.bar1.length, 3);
+               
+               foo.bar2 = new int[] { 21, 22, 23};
+               Tester.checkEqual(foo.bar2.length, 3);
+               
+               Tester.checkEqual(foo.bar[2], 3);
+               Tester.checkEqual(foo.bar1[2], 13);
+               Tester.checkEqual(foo.bar2[2], 23);
+               
+               int[] a = foo.getInts();
+       }
+}
+
+class Foo { }
+aspect Bar {
+  int[] Foo.bar = { 1, 2, 3 };
+  int[] Foo.bar1 = new int[] { 11, 12, 13};
+  int[] Foo.bar2 = null;
+  
+  int[] Foo.getInts() { return new int[] { 1, 2, 3}; }
+}
\ No newline at end of file
index 57e827b8c13e3586cfae69b2c6a215738ffe235a..6c6ed6b7a5821a8ae525ea888968958cc1a8f8da 100644 (file)
@@ -1,7 +1,11 @@
 <!DOCTYPE suite SYSTEM "../tests/ajcTestSuite.dtd">
 <suite>
+    <ajc-test dir="new" title="various declared exception permutations"
+      keywords="from-resolved_10x">
+        <compile files="DeclaredExcs.java"/>
+        <run class="DeclaredExcs"/>
+    </ajc-test>
 
-    
        <!--
     <ajc-test dir="base/test129"
       title="DEPRECATED: introduce of abstract methods works"