Comment by elric
1 day ago
To elaborate on the other comment about the Foreign Function & Memory API: JNI is effectively dead/deprecated, and has been replaced by the aforementioned API. It is orders of magnitude more developer friendly to use. It handles memory much more cleanly. It's way easier to create bindings to talk to foreign functions (e.g. Vulkan).
Probably the most underappreciated great feature in recent Java releases.
It will be a while before JNI itself is dead, because far too much stuff still relies on it. The unsafe helpers in the Java standard library will die first because they are fundamentally incompatible with Valhalla, but it's likely the simple cases will last a while as there are vast swaths of glue code that needs to be rewritten.
IIRC Minecraft is still using entirely JNI and no FFM yet. That will probably start to change in the near future, though. Some modders have already been replacing their own natives with FFM versions.