diff options
author | Tom Tromey <tromey@redhat.com> | 2001-03-23 05:57:00 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2001-03-23 05:57:00 +0000 |
commit | ae8a67c4c027244f570ea099d365ae93ab49c59f (patch) | |
tree | 63a16ebf9292540afc403879c07c371bb05da9f4 | |
parent | e4c34f6a4306b4cad5f91fd98b53f3dd5290779c (diff) | |
download | gcc-ae8a67c4c027244f570ea099d365ae93ab49c59f.zip gcc-ae8a67c4c027244f570ea099d365ae93ab49c59f.tar.gz gcc-ae8a67c4c027244f570ea099d365ae93ab49c59f.tar.bz2 |
field.out: New file.
* libjava.jni/field.out: New file.
* libjava.jni/field.c: New file.
* libjava.jni/field.java: New file.
From-SVN: r40776
-rw-r--r-- | libjava/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/field.c | 24 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/field.java | 25 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/field.out | 1 |
4 files changed, 56 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index cc4281f..77459e6 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2001-03-22 Tom Tromey <tromey@redhat.com> + + * libjava.jni/field.out: New file. + * libjava.jni/field.c: New file. + * libjava.jni/field.java: New file. + 2001-03-20 Tom Tromey <tromey@redhat.com> * libjava.compile/uesc.java: New file. diff --git a/libjava/testsuite/libjava.jni/field.c b/libjava/testsuite/libjava.jni/field.c new file mode 100644 index 0000000..358c293 --- /dev/null +++ b/libjava/testsuite/libjava.jni/field.c @@ -0,0 +1,24 @@ +#include <jni.h> +#include <field.h> + +jobjectArray +Java_field_fetch (JNIEnv *env, jobject this) +{ + jclass cls; + jfieldID fid; + jobjectArray obj; + + cls = (*env)->GetObjectClass (env, this); + if (! cls) + return 0; + + fid = (*env)->GetFieldID (env, cls, "F", "[Ljava/lang/Object;"); + if (! fid) + return 0; + + obj = (*env)->GetObjectField (env, this, fid); + + return obj; +} + + diff --git a/libjava/testsuite/libjava.jni/field.java b/libjava/testsuite/libjava.jni/field.java new file mode 100644 index 0000000..bd0f749 --- /dev/null +++ b/libjava/testsuite/libjava.jni/field.java @@ -0,0 +1,25 @@ +// Test for array field lookup. + +public class field +{ + // A field for us to look up. + public Object[] F = new Object[7]; + + public native Object[] fetch (); + + public void doit () + { + System.out.println (F == fetch ()); + } + + public static void main (String[] args) + { + field q = new field (); + q.doit (); + } + + static + { + System.loadLibrary ("field"); + } +} diff --git a/libjava/testsuite/libjava.jni/field.out b/libjava/testsuite/libjava.jni/field.out new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/libjava/testsuite/libjava.jni/field.out @@ -0,0 +1 @@ +true |