harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [vmi] JNI spec interpretation?
Date Wed, 05 Apr 2006 15:52:15 GMT
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

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

I expect we need ICU4JNI to fix that themselves.



Tim Ellison (t.p.ellison@gmail.com)
IBM Java technology centre, UK.

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message