]> source.dussan.org Git - aspectj.git/commitdiff
tests for enh 42743 (commented out) should we decide to do it.
authoracolyer <acolyer>
Wed, 18 Aug 2004 08:28:26 +0000 (08:28 +0000)
committeracolyer <acolyer>
Wed, 18 Aug 2004 08:28:26 +0000 (08:28 +0000)
tests/design/soft/DeclareSoft.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/design/DesignTests.java
tests/src/org/aspectj/systemtest/design/designtest.xml

diff --git a/tests/design/soft/DeclareSoft.aj b/tests/design/soft/DeclareSoft.aj
new file mode 100644 (file)
index 0000000..37da967
--- /dev/null
@@ -0,0 +1,29 @@
+public class DeclareSoft {
+    
+    public void throwException() throws Exception {
+        throw new Exception("This should be softened");
+    }
+    
+    public void throwRuntimeException() {
+        throw new RuntimeException("Under enh 42743 this should not be softened");
+    }
+    
+    public static void main(String[] args) throws Exception {
+        DeclareSoft ds = new DeclareSoft();
+        try {
+            ds.throwException();
+        } catch (org.aspectj.lang.SoftException se) {}
+        try {
+            ds.throwRuntimeException();
+        } catch(org.aspectj.lang.SoftException se) {
+            throw new RuntimeException("Runtime exception was innappropriately softened");
+        } catch (RuntimeException ex) {}
+    }
+    
+}
+
+aspect Softener {
+    
+    declare soft: Exception : execution(* DeclareSoft.throw*(..));
+    
+}
\ No newline at end of file
index 8a324818905bcd14c7b8ab2a4022429f7f55ebb8..ed6cd37cd88f60fa8cdd9c2453a8989e2d4c86d9 100644 (file)
@@ -76,5 +76,9 @@ public class DesignTests extends org.aspectj.testing.XMLBasedAjcTestCase {
     runTest("scope issues with introduction (needs more work)");
   }
 
+// uncomment this test if we implement 42743
+//  public void test014_DeclareSoft(){
+//      runTest("declare soft limitation");
+//    }
 }
 
index 112d9b6c19a96a1ffed93532595b6bfb847641e9..27670ada9c418d58aa9ab210c2d10303d323e484 100644 (file)
         <run class="p1.ScopeIssues"/>
     </ajc-test>
 
+<!-- uncomment this test if we decide to implement 42743 
+       <ajc-test dir="design/soft" pr="42743"
+               title="declare soft limitation">
+               <compile files="DeclareSoft.aj"/>
+               <run class="DeclareSoft"/>
+       </ajc-test>
+-->