JNI Bug report / C++ issues

Johannes Deisenhofer joe at dillingen.baynet.de
Wed Oct 28 02:27:31 PST 1998


Hi,

I'm trying to use kaffe 1.0b2 as a replacement for the SUN 1.1.5 JVM 
via the JNI Interface. Looks good, so far.

However, kaffe's JNI include files do contain some errors that I've 
listed below:

 - NewXXXArray() should return jXXXArray instead of jarray
   This is a problem in C++, since these types are not simply casted to jref
 - NewGlobalRef() does return jobject in JDK 
 - DefineClass() does have an extra name argument in JDK 1.1.5
 - GetSuperClass is spelled GetSuperclass in JDK.
 - java.lang.StringBuffer.setLength has a bug:
      System.arraycopy throws exception, because copied buffer len
      exceeds allocated source buffer len.

Not a bug, but a missing feature:

SUN's JNI headers do provide a special interface for C++. Unfortunately,
they do not allow to use the C-Interface from C++.

So, when using C++, I'm forced to use the C++-Interface with the JDK, 
which on the other hand, kaffe does not provide. 

I'd like to provide the necessary patches to make kaffe more compatible.
There are a few options to do this:
 1) Just copy the missing parts from SUN JDK headers. Copyright problem?
 2) Type in something that behaves identical, but avoid copying. Since
    symbol names have to be identical, it would be very close to 1) beside 
    whitespace.
 3) Provide a hook so one can add an external C++-Wrapper. Have at least 
    an option to avoid some typedefs like jobject,JNIEnv, JavaVM.

What option do you prefer?

(Please reply by mail, I'm not on the list)
Jo

// Johannes Deisenhofer joe at dillingen.baynet.de jdeisenhofer at acm.org



More information about the kaffe mailing list