|
Last change
on this file since 3103 was 2, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
732 bytes
|
| Line | |
|---|
| 1 | // Test a `throw' across a libffi call.
|
|---|
| 2 |
|
|---|
| 3 | import java.lang.reflect.*;
|
|---|
| 4 |
|
|---|
| 5 | public class invokethrow
|
|---|
| 6 | {
|
|---|
| 7 | public static void doit () throws Throwable
|
|---|
| 8 | {
|
|---|
| 9 | throw new Throwable ("hi!");
|
|---|
| 10 | }
|
|---|
| 11 |
|
|---|
| 12 | public static void main (String[] args)
|
|---|
| 13 | {
|
|---|
| 14 | Class k = invokethrow.class;
|
|---|
| 15 | try
|
|---|
| 16 | {
|
|---|
| 17 | Class[] noargs = new Class[0];
|
|---|
| 18 | Method m = k.getMethod ("doit", noargs);
|
|---|
| 19 | m.invoke (null, null);
|
|---|
| 20 | }
|
|---|
| 21 | catch (InvocationTargetException x1)
|
|---|
| 22 | {
|
|---|
| 23 | System.out.println (x1.getTargetException ().getMessage ());
|
|---|
| 24 | }
|
|---|
| 25 | catch (UnsupportedOperationException _)
|
|---|
| 26 | {
|
|---|
| 27 | // Some systems don't support invocation, in which case we
|
|---|
| 28 | // will fake a passing result.
|
|---|
| 29 | System.out.println ("hi!");
|
|---|
| 30 | }
|
|---|
| 31 | catch (Throwable _)
|
|---|
| 32 | {
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.