Bug in JNI RegisterNatives?

Juerg Lehni juerg@scratchdisk.com
Mon Jun 12 19:59:00 GMT 2006


I would like to move forward with this patch now.
Any ideas on how to address the issue with Class.h and jni.h?
Is it maybe best to just leave it as it is and use this code bellow?
 jstring class_name = klass->getName ();
 meth.class_name = (char *) _Jv_MallocUnchecked 
(JvGetStringUTFLength (class_name) + 1);
 jsize total = JvGetStringUTFRegion (class_name, 0, class_name- 
 >length(), meth.class_name);
 meth.class_name[total] = '0円';
As the method in question is only executed once per native4 method 
registration, it would not be a bit problem to do it this way...
What do you think?
Jürg
Am 31.05.2006 um 19:22 schrieb Tom Tromey:
>>>>>> "Juerg" == Juerg Lehni <juerg@scratchdisk.com> writes:
>> Juerg> But the way JNINativeMethod is defined in jni.h, I cannot 
> forward
> Juerg> declare it that way.
>> Oh yes. Sorry about that.
>> Juerg> Changing this would help, but I'm not sure we can do this, 
> as the
> Juerg> file is part of classpath. But this should work:
> Juerg> typedef struct JNINativeMethod
>> I'm away now and can't look to see if this is ok.
> The key is whether it breaks compatibility in any way.
>> Sometimes I think we should have simply made all the data members of
> Class public for use ("at your own risk") by CNI.
>> Juerg> Class.h does not foward declare JNIEnv. _Jv_JNIEnv is used at 4
> Juerg> places, but not declared. I'm a bit puzzled. It must be 
> declared in
> Juerg> one of the includes, but where?
>> There is a forward declaration in gcj/javaprims.h.
>> Tom
>


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /