------- 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