Add a test for correct delivery of exceptions caught by methods called from <clinit>.
Change-Id: Ie770240962959b92753e4b55acc0f81f1afe2b68
diff --git a/test/084-class-init/src/Main.java b/test/084-class-init/src/Main.java
index de28ed9..4ca2dbc 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();