On Fri, 30 Oct 2026 11:46:14 GMT, Matthias Baesken <[email protected]> wrote:

> In X11GD_CreateDisplayMode we check for NULL after GetMethodID and FindClass 
> which is probably a good thing.
> https://github.com/openjdk/jdk/blob/8e8e30d71cc8f77d81170205a4627191e5201568/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c#L1638
> 
> https://github.com/openjdk/jdk/blob/8e8e30d71cc8f77d81170205a4627191e5201568/src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c#L1646
> 
> But we do it twice (!) which is most likely not needed.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Marked as reviewed by prr (Reviewer).

src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1650:

> 1648: 
> 1649:     cid = (*env)->GetMethodID(env, displayModeClass, "<init>", 
> "(IIII)V");
> 1650:     CHECK_NULL_RETURN(cid, NULL);

I did a bit of digging and it looks to me like this was unnecessarily added in
https://hg.openjdk.org/jdk9/jdk9/jdk/rev/0336df7ba915
    8031001: [Parfait] warnings from b121 for jdk/src/solaris/native/sun/awt: 
JNI-related warnings

so it is fine to remove it.

src/java.desktop/unix/native/libawt_xawt/awt/awt_GraphicsEnv.c line 1684:

> 1682:         mid = (*env)->GetMethodID(env, arrayListClass, "add",
> 1683:                                   "(Ljava/lang/Object;)Z");
> 1684:         CHECK_NULL(mid);

This was added at the same time, although the return at 1688 was added later.

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

PR Review: https://git.openjdk.org/jdk/pull/33647#pullrequestreview-5716018416
PR Review Comment: https://git.openjdk.org/jdk/pull/33647#discussion_r4426453209
PR Review Comment: https://git.openjdk.org/jdk/pull/33647#discussion_r4426468437

Reply via email to