summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2012-02-29 16:33:23 -0800
committer Elliott Hughes <enh@google.com> 2012-02-29 17:07:00 -0800
commita58ff1773332ade8b2da86cf2658bd5066fb4606 (patch)
tree4c03b50b6a68dd92b11f44bcfabeea28b7f50d21
parent88894ee835411de72025cd8a5d8d111a6f2a004a (diff)
Add a test for correct delivery of exceptions caught by methods called from <clinit>.
Change-Id: Ie770240962959b92753e4b55acc0f81f1afe2b68
-rw-r--r--test/084-class-init/src/Main.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/084-class-init/src/Main.java b/test/084-class-init/src/Main.java
index de28ed9418..4ca2dbcba8 100644
--- a/test/084-class-init/src/Main.java
+++ b/test/084-class-init/src/Main.java
@@ -15,6 +15,25 @@
*/
public class Main {
+ static {
+ staticMethod();
+ }
+
+ private static void staticMethod() {
+ // Test that DeliverException works when the handler -- this method -- is currently a
+ // resolution stub because it's running on behalf of <clinit>.
+ try {
+ throwDuringClinit();
+ System.err.println("didn't throw!");
+ } catch (NullPointerException ex) {
+ System.out.println("caught exception thrown during clinit");
+ }
+ }
+
+ private static void throwDuringClinit() {
+ throw new NullPointerException();
+ }
+
public static void main(String[] args) {
checkExceptions();
checkTiming();