Time to repent
January 25, 2008 1 Comment
Some days ago I digged out, what turned to be a long-standing (JDK1.3 days) bug in the JNI specification
. Apparently, it still isn’t fixed. The issue in question is, should GetStringChars() return a zero-terminated string or not? The specification is silent about this, so a sane application developer MUST assume, it is not. A JVM developer is relatively free to return either a zero-terminated jchar array (like Hotspot does, but AFAICS, not always either), or not-zero-terminated jchar array (like a couple of VMs apparently do, like Jamaica, and I think gcj and jamvm too). It is a shame that this issue never has been fixed.
I posted to email@example.com about this, and started an interesting little thread. The most hilarious response so far has been:
The developers at Sun found the correct way to interpreting the specification; the other ones followed it blindfolded. It is now time to repent.
Let me also quote Mark from IRC:
I guess it is a special kind of developers who can correctly interpret specs and Sun got them all 🙂
Unfortunately, fixing this on the side of Jamaica would mean relatively drastic changes to the internal string representation OR a very inefficient GetStringChars(). Bah.