Comment by aeonik
I thought JNI was being deprecated in favor of the new FFM interface.
I thought JNI was being deprecated in favor of the new FFM interface.
That doesn't mean you should happily go out and build a new cathedral of technical debt.
I know that's the goal, but I was doing deeper reading and didn't understand the nuances here. It felt deprecated, and I remember reading that you should prefer FFM.
That's one of the reasons I posted it. A lot of knowledgeable people here can chime in more details. And a sibling comment did!
FFM is the recommended alternative, but JNI is not being deprecated. There are some things that JNI can do that FFM can't, in particular - initiating calls from native code to arbitrary Java methods. FFM only supports upcalls to Java in the form of Java callbacks that are passed to the native code. However, this is enough for the vast majority of Java-native interactions, so FFM should be preferred in new code (it's much easier to use than JNI).