diff options
author | jhugunin <jhugunin> | 2002-12-24 00:34:05 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2002-12-24 00:34:05 +0000 |
commit | d3156f737f3bb24e3ad695205da5977bef519275 (patch) | |
tree | aa658fcfaa346c00ed97c732f106ab348f337646 | |
parent | 7e28c28f4b09bacd1e0c0f7e7326fe68f5e6c7f6 (diff) | |
download | aspectj-d3156f737f3bb24e3ad695205da5977bef519275.tar.gz aspectj-d3156f737f3bb24e3ad695205da5977bef519275.zip |
added coverage for exceptions thrown from intro methods
these tests were inspired by failures compiling observer example
-rw-r--r-- | tests/ajcTests.xml | 41 | ||||
-rw-r--r-- | tests/design/intro/ExceptionsCF.java | 24 | ||||
-rw-r--r-- | tests/design/intro/ExceptionsCP.java | 25 | ||||
-rw-r--r-- | tests/new/runtime/AllRuntime.java | 2 |
4 files changed, 64 insertions, 28 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 70fe32041..a4ec74a67 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -2458,33 +2458,6 @@ </compile> </ajc-test> - - - - - - - - - - - - - - - - - - - - - - - - - - - <ajc-test dir="design/intro" title="initial tests for new introduction style" keywords="from-design"> <compile files="Simple.java"/> @@ -2533,6 +2506,20 @@ </compile> </ajc-test> + <ajc-test dir="design/intro" + title="declared exceptions are checked correctly on intros (errors)"> + <compile files="ExceptionsCF.java"> + <message kind="error" line="8"/> + <message kind="error" line="23"/> + </compile> + </ajc-test> + + <ajc-test dir="design/intro" + title="declared exceptions are checked correctly on intros"> + <compile files="ExceptionsCP.java"/> + <run class="ExceptionsCP"/> + </ajc-test> + <ajc-test dir="design/reflect" title="Joinpoint is not created for foo(String) when before() advice is present." keywords="from-design"> diff --git a/tests/design/intro/ExceptionsCF.java b/tests/design/intro/ExceptionsCF.java new file mode 100644 index 000000000..4bf8dc661 --- /dev/null +++ b/tests/design/intro/ExceptionsCF.java @@ -0,0 +1,24 @@ +import org.aspectj.testing.Tester; + +import java.io.IOException; + +public class ExceptionsCF { + public static void main(String[] args) { + C c = new C(); + c.foo(); // ERR: can't throw IOException here + } +} +class Root { + public void bar() {} +} + +class C extends Root { + +} + + +aspect A { + public void C.foo() throws IOException { } + + public void C.bar() throws IOException {} // ERR: can't throw more than super +} diff --git a/tests/design/intro/ExceptionsCP.java b/tests/design/intro/ExceptionsCP.java new file mode 100644 index 000000000..92d0b9b27 --- /dev/null +++ b/tests/design/intro/ExceptionsCP.java @@ -0,0 +1,25 @@ +import org.aspectj.testing.Tester; + +import java.io.IOException; + +public class ExceptionsCP { + public static void main(String[] args) { + C c = new C(); + try { + c.foo(); + } catch (IOException io) {} + c.bar(); + } +} +class Root { + public void bar() {} +} + +class C extends Root { + +} + + +aspect A { + public void C.foo() throws IOException { } +} diff --git a/tests/new/runtime/AllRuntime.java b/tests/new/runtime/AllRuntime.java index cc7face15..47356aa1f 100644 --- a/tests/new/runtime/AllRuntime.java +++ b/tests/new/runtime/AllRuntime.java @@ -214,7 +214,7 @@ aspect A { /** unused - enable to throw exception from run() */ public boolean TargetClass.throwException; - public void TargetClass.run() throws Exception { + public void TargetClass.run() { if (throwException) throwsException(); } |