diff options
author | Jeff Sturm <jsturm@one-point.com> | 2002-02-24 06:45:19 +0000 |
---|---|---|
committer | Jeff Sturm <jsturm@gcc.gnu.org> | 2002-02-24 06:45:19 +0000 |
commit | 0d06a7332d00e49a5c9d127691208190711408aa (patch) | |
tree | c9792f2ab6e98916c13cb3715fc257dd52a058aa /libjava | |
parent | e776237d577583e7c2d9ca8dab7b3e56471b4c31 (diff) | |
download | gcc-0d06a7332d00e49a5c9d127691208190711408aa.tar.gz |
InvokeReturn.java: New file.
* libjava.lang/InvokeReturn.java: New file.
* libjava.lang/InvokeReturn.out: New file.
From-SVN: r50001
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/InvokeReturn.java | 76 | ||||
-rw-r--r-- | libjava/testsuite/libjava.lang/InvokeReturn.out | 8 |
3 files changed, 89 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index 7c41d8027d0..efc944afe69 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-02-23 Jeff Sturm <jsturm@one-point.com> + + * libjava.lang/InvokeReturn.java: New file. + * libjava.lang/InvokeReturn.out: New file. + 2002-02-20 Bryce McKinlay <bryce@waitaki.otago.ac.nz> * lib/libjava.exp: Add "xfail-byte-output" and "xfail-source-output". diff --git a/libjava/testsuite/libjava.lang/InvokeReturn.java b/libjava/testsuite/libjava.lang/InvokeReturn.java new file mode 100644 index 00000000000..10128b593c1 --- /dev/null +++ b/libjava/testsuite/libjava.lang/InvokeReturn.java @@ -0,0 +1,76 @@ +import java.lang.reflect.Method; + +// Test return values of Method.invoke. +public class InvokeReturn { + public boolean bTrue() { + return true; + } + + public boolean bFalse() { + return false; + } + + public char cc() { + return 'c'; + } + + public short s5() { + return (short)5; + } + + public int i6() { + return 6; + } + + public long l7() { + return (long)7; + } + + public float f8() { + return (float)8.0; + } + + public double d9() { + return 9.0; + } + + public static void main(String[] args) { + try { + Object o = new InvokeReturn(); + Method m; + + // test boolean result + m = o.getClass().getDeclaredMethod("bTrue", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + m = o.getClass().getDeclaredMethod("bFalse", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test char result + m = o.getClass().getDeclaredMethod("cc", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test short result + m = o.getClass().getDeclaredMethod("s5", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test int result + m = o.getClass().getDeclaredMethod("i6", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test long result + m = o.getClass().getDeclaredMethod("l7", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test float result + m = o.getClass().getDeclaredMethod("f8", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + + // test double result + m = o.getClass().getDeclaredMethod("d9", new Class[0]); + System.out.println(m.invoke(o, new Object[0])); + } catch (Throwable t) { + t.printStackTrace(); + } + } +} diff --git a/libjava/testsuite/libjava.lang/InvokeReturn.out b/libjava/testsuite/libjava.lang/InvokeReturn.out new file mode 100644 index 00000000000..01f8643645f --- /dev/null +++ b/libjava/testsuite/libjava.lang/InvokeReturn.out @@ -0,0 +1,8 @@ +true +false +c +5 +6 +7 +8.0 +9.0 |