Bug in JNI RegisterNatives?

Juerg Lehni juerg@scratchdisk.com
Sun Oct 1 19:06:00 GMT 2006


I am wondering wether this patch will eventally be included

I've submitted it more than 3 months ago, and nothing seems to have  
happened since.

Is there anything I need to do to get it accepted?

Jürg

Am 19.06.2006 um 23:10 schrieb Juerg Lehni:

> Bryce,
>
>> 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?
>
> The patch does help. Another possibility would be to make that  
> field public...
>
> I was wondering if the function should be called  
> _Jv_GetClassNameUtf8Const, to go well together with  
> getNameUtf8Const in jfieldID.
>
> I changed my patch now, but could not test it as my build process  
> is currently broken, due to experiments with Java2D. I'm pretty  
> sure it will work though, as the only lines changed are the calls  
> to _Jv_GetClassNameUtf8...
>
>> Also, was there a reason to change _Jv_AllocBytes() calls to  
>> _Jv_Malloc()?
>
> Nothing I can remember now. What's the difference between the two  
> really? I changed it back in the above patch now.
>
>> 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.
>
> I don't plan to write more patches, so it should be fine for now.
>
> Jürg
>
> <jni.patch>
>
>> 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;
>> +}
>



More information about the Java mailing list