On Wed, 20 May 2020 11:47:29 GMT, Jose Pereda <[email protected]> wrote:
> Trying to paste on a JavaFX app statically built on Mac OS throws:
>
> Exception in thread "JavaFX Application Thread" java.lang.ClassCastException
> at at
> com.sun.glass.ui.mac.MacPasteboard._getUTFs(MacPasteboard.java)
>
>
> Checking the native method signature a `String[][]` type is expected. However
> the native method implementation uses:
> jobjectArray utfs = (*env)->NewObjectArray(env, size, (*env)->FindClass(env,
> "java/lang/Object"), NULL);
> for (items) {
> jobjectArray array = (*env)->NewObjectArray(env, size,
> (*env)->FindClass(env, "java/lang/String"), NULL);
> }
>
> This PR fixes the issue by applying the correct array type signature
> according to [JNI
> specs](https://docs.oracle.com/en/java/javase/11/docs/specs/jni/functions.html#findclass).
> It has been tested on Mac OS, both with and without static build.
So this is a case where native image exposed a latent bug in FX. Would this
have been caught by `-Xcheck:jni`? (I hope
it would have). We aren't in the habit of regularly running tests with that
option, but maybe we should do it more
often.
-------------
PR: https://git.openjdk.java.net/jfx/pull/228