Incorrect Java methods called from CNI

Bryce McKinlay mckinlay@redhat.com
Thu May 13 00:20:00 GMT 2004


Dave Menendez wrote:
>>Can you do the same for AbstractClassificationModel? Looks like C++ and 
>>GCJ disagree on how many virtual methods there are in that class.
>>>>> <>
> Sorry for the delay - I ran into some system problems and was down for
> awhile. Attached is the vtable for AbstractClassificationModel as well
> as the original Java declarations, and generated C++ header.

Hmm, this is what we call the "miranda bug". I suspect what is happening 
is this:
getClassification() is defined in an interface. That interface is 
implemented by the abstract class, but the method is not actually 
defined there. gcj allocates a vtable slot in the abstract class for 
this method, so that it can be called correctly from code using 
invokevirtual on the abstract class. The class file on the other hand 
contains no mention of this extra method, and gcjh isn't smart enough to 
look for it. So, the .h file doesn't declare it and thus the C++ 
compilers idea of the vtable layout is wrong.
Work around: declare "abstract getClassification();" in the abstract class.
Fix: will be to make gcjh aware of gcj's "miranda methods" logic. Or, 
use the bc-abi (when its finished) which won't have this problem.
Regards
Bryce


More information about the Java mailing list

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