Skip to content

Commit 22f3a00

Browse files
authored
Merge pull request #1196 from smowton/smowton/fix/exception_catch
Implement exception catching
2 parents 9e10715 + 9a1289d commit 22f3a00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+706
-338
lines changed
643 Bytes
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
test.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
VERIFICATION SUCCESSFUL
7+
--
8+
^warning: ignoring
9+
--
10+
This test checks that a thrown exception is caught, and is not erroneously rethrown
11+
on function exit such that another surrounding try block can catch it again.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
public class test {
2+
public static void main () {
3+
try {
4+
f();
5+
}
6+
catch(Exception e) {
7+
assert(false); // Should be unreachable
8+
}
9+
}
10+
11+
public static void f() {
12+
try {
13+
throw new Exception();
14+
}
15+
catch(Exception e) {
16+
// Should prevent main's catch handler from being invoked
17+
}
18+
}
19+
}
20+
594 Bytes
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion at file test\.java line 7 function java::test\.main:\(\)V bytecode-index 9: FAILURE
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class test {
2+
public static void main() throws Exception {
3+
try {
4+
throw new Exception();
5+
}
6+
finally {
7+
assert(false);
8+
}
9+
}
10+
}
11+
637 Bytes
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
test.class
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
assertion at file test\.java line 8 function java::test\.main:\(\)V bytecode-index 9: FAILURE
7+
^VERIFICATION FAILED$
8+
--
9+
^warning: ignoring
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class test {
2+
public static void main() throws Exception {
3+
try {
4+
throw new Exception();
5+
}
6+
catch(Exception e) { }
7+
finally {
8+
assert(false);
9+
}
10+
}
11+
}
12+
727 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)