diff options
Diffstat (limited to 'test/084-class-init/src/Main.java')
-rw-r--r-- | test/084-class-init/src/Main.java | 19 |
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(); |