This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/18278] JNI functions cannot return a weak reference
- From: "tromey at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Dec 2004 21:40:59 -0000
- Subject: [Bug java/18278] JNI functions cannot return a weak reference
- References: <20041102185341.18278.laurent@bearteam.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tromey at gcc dot gnu dot org 2004-12-01 21:40 -------
How curious. Apparently the JDK unwraps the return result of
a JNI method that returns a JNI weak reference.
I think it is too late to implement this for GCC 4.0 (unless the
commit rules change again). Here is how it could be fixed:
* Write a new _Jv_UnwrapJNIWeakReference function in jni.cc that is
extern "C". (This can be copied from the existing 'unwrap'
template function.)
* Make a built-in declaration for this in gcj
* Change expr.c:build_jni_stub to call this function when the return
type is not a primitive type. (there is already a comment explaining
where some unwrapping could be done)
* Also modify jni.cc:_Jv_JNIMethod::call() to do this transformation
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18278