Integrated: 8365291: Remove finalize() method from sun/awt/X11InputMethodBase.java

Phil Race prr at openjdk.org
Mon Aug 25 19:34:45 UTC 2025


On Tue, 12 Aug 2025 18:56:56 GMT, Phil Race <prr at openjdk.org> wrote:

> 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.

This pull request has now been integrated.

Changeset: 63faa504
Author:    Phil Race <prr at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/63faa50428cef70d6e031189b0f95bd18d06d2e3
Stats:     7 lines in 1 file changed: 0 ins; 7 del; 0 mod

8365291: Remove finalize() method from sun/awt/X11InputMethodBase.java

Reviewed-by: tr, azvegint

-------------

PR: https://git.openjdk.org/jdk/pull/26751


More information about the client-libs-dev mailing list