1 // Test a `throw' across a libffi call. 2 3 import java.lang.reflect.*; 4 5 public class invokethrow 6 { doit()7 public static void doit () throws Throwable 8 { 9 throw new Throwable ("hi!"); 10 } 11 main(String[] args)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 } 36