summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.jni/cxxtest.cc
blob: 577273bb5a2e16a1acbf3dffba66ad20fcaaff8d (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 <cxxtest.h>

jobjectArray
Java_cxxtest_fetch (JNIEnv *env, jobject _this)
{
  jclass cls;
  jfieldID fid;
  jobjectArray obj;

  cls = env->GetObjectClass (_this);
  if (! cls)
    return 0;

  fid = env->GetFieldID (cls, "F", "[Ljava/lang/Object;");
  if (! fid)
    return 0;

  obj = reinterpret_cast<jobjectArray> (env->GetObjectField (_this, fid));

  return obj;
}