This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

JNI and class references



In jni.cc, I see there's a template for jobject wrap_value, but not
one for jclass.  My experience with JNI is that a jclass returned
from a call like GetObjectClass is also a local reference.

Is it not appropriate to also have a wrap_value for jclass returns?
Specifically, like this:

template<>
static jclass
wrap_value (JNIEnv *env, jclass value)
{
  return value == NULL ? value : (jclass) _Jv_JNI_NewLocalRef (env, (jobject) value);
}

(The motivation being that code that expects that jclasses will be local
refs will be calling DeleteLocalRef in some circumstances, which will
crash the runtime if there isn't one.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]