field.c 401 B

12345678910111213141516171819202122232425
  1. #include <jni.h>
  2. #include <field.h>
  3. JNIEXPORT jobjectArray JNICALL
  4. Java_field_fetch (JNIEnv *env, jobject this)
  5. {
  6. jclass cls;
  7. jfieldID fid;
  8. jobjectArray obj;
  9. cls = (*env)->GetObjectClass (env, this);
  10. if (! cls)
  11. return 0;
  12. fid = (*env)->GetFieldID (env, cls, "F", "[Ljava/lang/Object;");
  13. if (! fid)
  14. return 0;
  15. obj = (*env)->GetObjectField (env, this, fid);
  16. return obj;
  17. }