diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-06 17:38:52 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-04-06 17:38:52 +0000 |
commit | ea93fd44fb23452c56c24d412a802cede98a20f6 (patch) | |
tree | 6bbdd0f12fad77699643f7bfd8b5ea26671da489 /libjava/jni.cc | |
parent | e64be6942675474608b0813b6f9734678c533ac7 (diff) | |
download | gcc-ea93fd44fb23452c56c24d412a802cede98a20f6.tar.gz |
* jni.cc (wrap_value<jobject>, wrap_value<jclass>): Removed.
(wrap_value<T*>): New specialization.
(_Jv_JNI_PopLocalFrame): Update env->locals.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41157 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jni.cc')
-rw-r--r-- | libjava/jni.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/libjava/jni.cc b/libjava/jni.cc index d41dd01e7bd..6190f4f8d74 100644 --- a/libjava/jni.cc +++ b/libjava/jni.cc @@ -335,6 +335,9 @@ _Jv_JNI_PopLocalFrame (JNIEnv *env, jobject result, int stop) rf = n; } + // Update the local frame information. + env->locals = rf; + return result == NULL ? NULL : _Jv_JNI_NewLocalRef (env, result); } @@ -369,20 +372,15 @@ wrap_value (JNIEnv *, T value) return value; } -template<> -static jobject -wrap_value (JNIEnv *env, jobject value) -{ - return value == NULL ? value : _Jv_JNI_NewLocalRef (env, value); -} - -template<> -static jclass -wrap_value (JNIEnv *env, jclass value) +// This specialization is used for jobject, jclass, jstring, jarray, +// etc. +template<typename T> +static T * +wrap_value (JNIEnv *env, T *value) { return (value == NULL ? value - : (jclass) _Jv_JNI_NewLocalRef (env, (jobject) value)); + : (T *) _Jv_JNI_NewLocalRef (env, (jobject) value)); } |