diff options
| author | 2012-02-29 17:07:16 -0800 | |
|---|---|---|
| committer | 2012-02-29 17:07:16 -0800 | |
| commit | a7c2589fd2ac8a75d11974e709687e188c0d112d (patch) | |
| tree | 84d3cfba5ec1e3506adbc9e72fab23d9aebeeaf5 | |
| parent | e8648b63d569c97454cd93fc1f34a67cd7a7a193 (diff) | |
| parent | a58ff1773332ade8b2da86cf2658bd5066fb4606 (diff) | |
Merge "Add a test for correct delivery of exceptions caught by methods called from <clinit>." into dalvik-dev
| -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(); |