diff options
-rw-r--r-- | tests/design/soft/DeclareSoft.aj | 29 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/design/DesignTests.java | 4 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/design/designtest.xml | 7 |
3 files changed, 40 insertions, 0 deletions
diff --git a/tests/design/soft/DeclareSoft.aj b/tests/design/soft/DeclareSoft.aj new file mode 100644 index 000000000..37da96725 --- /dev/null +++ b/tests/design/soft/DeclareSoft.aj @@ -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 diff --git a/tests/src/org/aspectj/systemtest/design/DesignTests.java b/tests/src/org/aspectj/systemtest/design/DesignTests.java index 8a3248189..ed6cd37cd 100644 --- a/tests/src/org/aspectj/systemtest/design/DesignTests.java +++ b/tests/src/org/aspectj/systemtest/design/DesignTests.java @@ -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"); +// } } diff --git a/tests/src/org/aspectj/systemtest/design/designtest.xml b/tests/src/org/aspectj/systemtest/design/designtest.xml index 112d9b6c1..27670ada9 100644 --- a/tests/src/org/aspectj/systemtest/design/designtest.xml +++ b/tests/src/org/aspectj/systemtest/design/designtest.xml @@ -92,3 +92,10 @@ <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> +--> |