It seems that finalize() in X11InputMethodBase.java isn't useful. It calls dispose(), which in all actual implementations has just one native resource to release, which is a native struct of type X11InputMethodData (this is a JDK-defined struct, not one from Xim), and one of the fields is a JNI GlobalRef pointing to the XInputMethod instance which implements the dispose() method. So finalize cannot be called unless dispose() is called first. But if dispose() has been called then there's no need for finalize() since all it does is call dispose()
Many more details in JBS. ------------- Commit messages: - 8365291 Changes: https://git.openjdk.org/jdk/pull/26751/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26751&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8365291 Stats: 7 lines in 1 file changed: 0 ins; 7 del; 0 mod Patch: https://git.openjdk.org/jdk/pull/26751.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/26751/head:pull/26751 PR: https://git.openjdk.org/jdk/pull/26751