No, it’s still the lwjgl lib’s fault!
At least that’s what I found out after running into a similar problem, namely the test
if (Mouse.isButtonDown(i) == buttons[i])
Sometimes (only on the win32 build of lwjgl) the Mouse.isButtonDown(i) and buttons[i] would both be true when I printed them, but the test actually failed!
To understand why, you have to look at the code that polls the mouse under win32:
jbooleanArray buttonsArray = (jbooleanArray) env->GetStaticObjectField(clazz, fid_button);
BYTE * buttons = (BYTE *) env->GetPrimitiveArrayCritical(buttonsArray, NULL);
memcpy(buttons, diMouseState.rgbButtons, 4);
env->ReleasePrimitiveArrayCritical(buttonsArray, buttons, 0);
Other than the fact that I think SetBooleanArrayRegion() should be used instead of GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical, there’s a problem with that code. diMouseState.rgbButtons contains the mouse button states as returned by DirectInput in an array of BYTEs, which corresponds to the jboolean datatype the java button array buttons contains. The problem is that directinput does not always return JNI_TRUE or JNI_FALSE, the only two values allowed to be in a jboolean data type! This is what makes the assumptions made by the VMs invalid (an == test between two jbooleans could fail in this case).
I fixed this in lwjgl CVS by setting the button array entries to JNI_TRUE if DirectInput returned something != 0, and JNI_FALSE otherwise. This makes the test first mentioned always do the right thing.