summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.jni/field.c
blob: bce0cc896e62bbe87185a68e95ccbb9a0c900dba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <jni.h>
#include <field.h>

JNIEXPORT jobjectArray JNICALL
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;
}