RFR: 8318091: Remove empty initIDs functions

Alexey Ivanov aivanov at openjdk.org
Fri Oct 27 11:00:38 UTC 2023


On Thu, 26 Oct 2023 06:56:16 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

> The removed functions are empty on all platforms.
> 
> This patch also removes calls to `Toolkit.loadLibraries();` in classes that no longer have any native methods. The call was needed to ensure that the native awt library is loaded.
> 
> Client libs tests passed.

It looks good to me. The only concern I have, similar to Phil, is that peer implementations do not load the toolkit libraries. For this reason, I am for keeping the call to `Toolkit.loadLibraries()` in the static initializer of `java.awt.Button`, `java.awt.FileDialog`, `java.awt.KeyboardFocusManager` and `java.awt.TextField`.

src/java.desktop/share/classes/java/awt/Button.java line 128:

> 126:     static {
> 127:         /* ensure that the necessary native libraries are loaded */
> 128:         Toolkit.loadLibraries();

I think it is safer to preserve loading the toolkit libraries: `Button` is a peered component and I can't see any of the peers loads the libraries.

src/java.desktop/share/classes/java/awt/FileDialog.java line 146:

> 144:     static {
> 145:         /* ensure that the necessary native libraries are loaded */
> 146:         Toolkit.loadLibraries();

The same is here: I see no clear path to load the toolkit libraries from the peers, and peers do have native methods, including `initIDs`.

It looks as if peer implementations depend on the fact that the corresponding public API classes ensure the libraries are loaded.

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

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16372#pullrequestreview-1701464849
PR Review Comment: https://git.openjdk.org/jdk/pull/16372#discussion_r1374373100
PR Review Comment: https://git.openjdk.org/jdk/pull/16372#discussion_r1374384221


More information about the client-libs-dev mailing list