Archie Cobbs wrote:
> Robert Lougher wrote:
>> It's all very well bombing out with an assertion failure, but to the
>> average end-user it's still the VMs fault, especially if it works with
>> other runtimes (i.e. Suns).
>
> Sure.. sometimes theory gets trumped by practice. Then you have to decide
> which is less work: convincing 3rd parties to fix their code or
> implementing
> a hack/workaround.
>
> If there is lots of JNI code out there doing this, then you're certainly
> right that the workaround (which costs essentially nothing) would be
> easier.
The IBM VME comes with a check utility that complains about bad
practices detected in JNI code:
Usage: -Xcheck:jni:[option[,option[,...]]]
all check application and system classes
verbose trace certain JNI functions and activities
trace trace all JNI functions
nobounds don't perform bounds checking on strings
and arrays
nonfatal don't exit when errors are detected
nowarn don't display warnings
noadvice don't display advice
novalist don't check for va_list reuse
pedantic perform more thorough, but slower checks
help print this screen
Don't run it on the Harmony class libraries unless you have a strong
stomach ;-)
Actually, there is lots of repetition in the warnings/errors so we
should go ahead and fix those that we can (an easy contribution
opportunity!), for example:
JNI warning in NewObject/NewObjectV: Argument #2 is a weak reference. A
weak reference may become NULL at any time. The reference should be
promoted using NewLocalRef or NewGlobalRef and then compared to NULL
before calling NewObject/NewObjectV
Warning detected in
java/util/zip/ZipFile.getEntryImpl(JLjava/lang/String;)Ljava/util/zip/ZipEntry;
Here's an example from code in one of our dependencies:
JNI error in GetStringChars: This function cannot be called inside of a
critical section
Error detected in
com/ibm/icu4jni/converters/NativeConverter.openConverter([JLjava/lang/String;)I
I expect we need ICU4JNI to fix that themselves.
Regards,
Tim
--
Tim Ellison ([EMAIL PROTECTED])
IBM Java technology centre, UK.
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]