From ae8a67c4c027244f570ea099d365ae93ab49c59f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 23 Mar 2001 05:57:00 +0000 Subject: [PATCH] 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 --- libjava/testsuite/ChangeLog | 6 ++++++ libjava/testsuite/libjava.jni/field.c | 24 +++++++++++++++++++++++ libjava/testsuite/libjava.jni/field.java | 25 ++++++++++++++++++++++++ libjava/testsuite/libjava.jni/field.out | 1 + 4 files changed, 56 insertions(+) create mode 100644 libjava/testsuite/libjava.jni/field.c create mode 100644 libjava/testsuite/libjava.jni/field.java create mode 100644 libjava/testsuite/libjava.jni/field.out diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index cc4281fe070..77459e6b92d 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2001-03-22 Tom Tromey + + * libjava.jni/field.out: New file. + * libjava.jni/field.c: New file. + * libjava.jni/field.java: New file. + 2001-03-20 Tom Tromey * 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 00000000000..358c293e7c5 --- /dev/null +++ b/libjava/testsuite/libjava.jni/field.c @@ -0,0 +1,24 @@ +#include +#include + +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 00000000000..bd0f7492e9f --- /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 00000000000..27ba77ddaf6 --- /dev/null +++ b/libjava/testsuite/libjava.jni/field.out @@ -0,0 +1 @@ +true