This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Bug in JNI RegisterNatives?
- From: Bryce McKinlay <mckinlay at redhat dot com>
- To: Juerg Lehni <juerg at scratchdisk dot com>
- Cc: tromey at redhat dot com, java at gcc dot gnu dot org
- Date: Fri, 16 Jun 2006 12:03:51 -0400
- Subject: Re: Bug in JNI RegisterNatives?
- References: <B3B02B14-9CE5-4CDF-B58E-2EDBC65586CB@scratchdisk.com> <m3slms355m.fsf@localhost.localdomain> <31CEC514-52BA-4958-84C0-7A8E91AFD9C6@scratchdisk.com> <447BA9E4.4050108@redhat.com> <29F77D12-B91D-4107-AEDB-9612AE7595E2@scratchdisk.com> <17533.35342.396152.717594@localhost.localdomain> <48BCE7D8-448B-4833-A5B0-02B1A20EDF69@scratchdisk.com> <m3r72acdny.fsf@localhost.localdomain> <3BB47CA3-604D-4B6A-981D-619908ECF37E@scratchdisk.com> <502662BF-FB14-476A-ACDC-F9F59805D6A1@scratchdisk.com>
Juerg,
Thanks for the reminder. Ideally we should find a way to refer to
klass->name directly rather than reading it as a String and converting
it back to Utf8. Yes, doing it in this one instance doesn't hurt much,
but it would simplify the patch a lot, and fixing it might come in
useful elsewhere. Would the patch below help?
Also, was there a reason to change _Jv_AllocBytes() calls to _Jv_Malloc()?
For large changes we need a GCC copyright assignment on file with the
FSF. See: http://gcc.gnu.org/contribute.html - I think we can accept
this under the "small changes" rule, however. But, if you plan to
contribute more changes in the future, it might be a good idea to start
the paperwork process now.
Bryce
Juerg Lehni wrote:
Tom,
Please let me know what I should do to get this patch finalized and
commited. I would like to make sure it's getting there soon.
Jürg
2006-06-16 Bryce McKinlay <mckinlay@redhat.com>
* java/lang/Class.h (_Jv_GetClassNameUtf8): New declaration.
* java/lang/natClass.cc (_Jv_GetClassNameUtf8): Define.
Index: Class.h
===================================================================
--- Class.h (revision 114642)
+++ Class.h (working copy)
@@ -231,6 +231,7 @@
jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
jint JvNumMethods (jclass);
jmethodID JvGetFirstMethod (jclass);
+_Jv_Utf8Const* _Jv_GetClassNameUtf8 (jclass);
#ifdef INTERPRETER
// Finds a desired interpreter method in the given class or NULL if not found
@@ -472,6 +473,7 @@
friend jmethodID (::_Jv_FromReflectedConstructor) (java::lang::reflect::Constructor *);
friend jint (::JvNumMethods) (jclass);
friend jmethodID (::JvGetFirstMethod) (jclass);
+ friend _Jv_Utf8Const * ::_Jv_GetClassNameUtf8 (jclass);
#ifdef INTERPRETER
friend _Jv_InterpMethod* (::_Jv_FindInterpreterMethod) (jclass klass,
jmethodID desired_method);
Index: natClass.cc
===================================================================
--- natClass.cc (revision 114642)
+++ natClass.cc (working copy)
@@ -1264,3 +1264,11 @@
return NULL;
}
#endif
+
+// Return Utf8 name of a class. This function is here for code that can't access
+// klass->name directly.
+_Jv_Utf8Const*
+_Jv_GetClassNameUtf8 (jclass klass)
+{
+ return klass->name;
+}