From dc5919eb430b2348aacff4bab031902459a9a376 Mon Sep 17 00:00:00 2001 From: TCs Date: Mon, 12 Oct 2026 17:06:10 +0300 Subject: [PATCH 1/3] Drop the unused className parameter of SWT_AWT.initFrame None of the natives reads it: each one always creates the platform's default embedded frame class (XEmbeddedFrame, CViewEmbeddedFrame, WEmbeddedFrame), and the GTK native did not declare it at all. SWT_AWT.embeddedFrameClass, whose value was passed as className, is deprecated for removal accordingly. Its Class.forName check is kept, so nothing changes for code that still sets it. Fixes https://github.com/eclipse-platform/eclipse.platform.swt/issues/3665 Signed-off-by: TCs --- .../Eclipse SWT AWT/cocoa/library/swt_awt.c | 2 +- .../cocoa/org/eclipse/swt/awt/SWT_AWT.java | 15 +++++++++------ .../gtk/org/eclipse/swt/awt/SWT_AWT.java | 13 +++++++++---- .../Eclipse SWT AWT/win32/library/swt_awt.c | 3 +-- .../win32/org/eclipse/swt/awt/SWT_AWT.java | 13 +++++++++---- 5 files changed, 29 insertions(+), 17 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c index 7a020520217..84940e0b7fd 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/library/swt_awt.c @@ -20,7 +20,7 @@ #ifndef NO_initFrame JNIEXPORT jobject JNICALL Java_org_eclipse_swt_awt_SWT_1AWT_initFrame - (JNIEnv *env, jclass that, jlong handle, const char *className) + (JNIEnv *env, jclass that, jlong handle) { jobject object; jmethodID constructor; diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java index a145efbc315..c76f07fbd6c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java @@ -47,7 +47,13 @@ public class SWT_AWT { /** * The name of the embedded Frame class. The default class name * for the platform will be used if null. + * + * @noreference This field is not intended to be referenced by clients. + * @deprecated The class named here is never instantiated: the platform's + * default embedded Frame class is always used. This field will + * be removed in a future release. */ + @Deprecated(forRemoval = true, since = "2026-12") public static String embeddedFrameClass; /** @@ -61,11 +67,9 @@ public class SWT_AWT { */ static final String RUN_AWT_INVOKE_LATER_KEY = "org.eclipse.swt.internal.runAWTInvokeLater"; //$NON-NLS-1$ - static final String JDK17_FRAME = "sun.lwawt.macosx.CViewEmbeddedFrame"; - static boolean loaded, swingInitialized; - static native final Object initFrame (long handle, String className); + static native final Object initFrame (long handle); static native final void validateWithBounds (Frame frame, int x, int y, int w, int h); static native final void synthesizeWindowActivation (Frame frame, boolean doActivate); @@ -135,10 +139,9 @@ public static Frame new_Frame(final Composite parent) { SWT.error(SWT.ERROR_INVALID_ARGUMENT); } final long handle = parent.view.id; - final String className = embeddedFrameClass != null ? embeddedFrameClass : JDK17_FRAME; try { if (embeddedFrameClass != null) { - Class.forName(className); + Class.forName(embeddedFrameClass); } loadLibrary(); } catch (ClassNotFoundException cne) { @@ -158,7 +161,7 @@ public static Frame new_Frame(final Composite parent) { public void run() { if (run) return; run = true; - Object obj = initFrame(handle, className); + Object obj = initFrame(handle); if (obj == null || !(obj instanceof Frame)) { exception [0] = new Throwable("[Error while creating AWT embedded frame]"); SWT.error (SWT.ERROR_UNSPECIFIED, exception[0]); diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java index dc52885fc42..150ac310ec3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java @@ -46,7 +46,13 @@ public class SWT_AWT { /** * The name of the embedded Frame class. The default class name * for the platform will be used if null. + * + * @noreference This field is not intended to be referenced by clients. + * @deprecated The class named here is never instantiated: the platform's + * default embedded Frame class is always used. This field will + * be removed in a future release. */ + @Deprecated(forRemoval = true, since = "2026-12") public static String embeddedFrameClass; /** @@ -59,7 +65,7 @@ public class SWT_AWT { static native final long getAWTHandle (Object canvas); static native final void setDebug (Frame canvas, boolean debug); -static native final Object initFrame (long handle, String className); +static native final Object initFrame (long handle); static native final void validateWithBounds (Frame frame, int x, int y, int w, int h); static native final void synthesizeWindowActivation (Frame frame, boolean doActivate); static native final void registerListeners (Frame frame); @@ -155,10 +161,9 @@ public static Frame new_Frame (final Composite parent) { * and other JREs take a long. To handle this binary incompatibility, use * reflection to create the embedded frame. */ - String className = embeddedFrameClass != null ? embeddedFrameClass : "sun.awt.X11.XEmbeddedFrame"; try { if (embeddedFrameClass != null) { - Class.forName(className); + Class.forName(embeddedFrameClass); } loadLibrary(); } catch (ClassNotFoundException cne) { @@ -168,7 +173,7 @@ public static Frame new_Frame (final Composite parent) { } initializeSwing (); final Frame [] frame = new Frame [1]; - Object object = initFrame(handle, className); + Object object = initFrame(handle); if (object == null || !(object instanceof Frame)) { SWT.error (SWT.ERROR_UNSPECIFIED , new Throwable(), " [Error while starting AWT]"); } diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/library/swt_awt.c b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/library/swt_awt.c index 1dfae1691b5..d22a027bd2e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/library/swt_awt.c +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/library/swt_awt.c @@ -59,10 +59,9 @@ JNIEXPORT jlong JNICALL SWT_AWT_NATIVE(getAWTHandle) #ifndef NO_initFrame JNIEXPORT jobject JNICALL SWT_AWT_NATIVE(initFrame) - (JNIEnv *env, jclass that, jlong handle, jstring className) + (JNIEnv *env, jclass that, jlong handle) { /* Suppress warnings about unreferenced parameters */ - (void)className; (void)that; jobject object; diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java index 796d1724e58..26259aa865b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java @@ -42,7 +42,13 @@ public class SWT_AWT { /** * The name of the embedded Frame class. The default class name * for the platform will be used if null. + * + * @noreference This field is not intended to be referenced by clients. + * @deprecated The class named here is never instantiated: the platform's + * default embedded Frame class is always used. This field will + * be removed in a future release. */ + @Deprecated(forRemoval = true, since = "2026-12") public static String embeddedFrameClass; /** @@ -54,7 +60,7 @@ public class SWT_AWT { static boolean loaded, swingInitialized; static native final long getAWTHandle (Canvas canvas); -static native final Object initFrame (long handle, String className); +static native final Object initFrame (long handle); static native final void synthesizeWindowActivation (Frame frame, boolean doActivate); static synchronized void loadLibrary () { @@ -141,10 +147,9 @@ public static Frame new_Frame (final Composite parent) { * and other JREs take a long. To handle this binary incompatibility, use * reflection to create the embedded frame. */ - String className = embeddedFrameClass != null ? embeddedFrameClass : "sun.awt.windows.WEmbeddedFrame"; try { if (embeddedFrameClass != null) { - Class.forName(className); + Class.forName(embeddedFrameClass); } loadLibrary(); } catch (ClassNotFoundException cne) { @@ -154,7 +159,7 @@ public static Frame new_Frame (final Composite parent) { return; } initializeSwing (); - Object value = initFrame(handle, className); + Object value = initFrame(handle); if (value == null || !(value instanceof Frame)) { exception [0] = new Throwable("[Error while creating AWT embedded frame]"); SWT.error (SWT.ERROR_UNSPECIFIED, exception[0]); From 7014e6335049c7694af57ee412b81718b771edbe Mon Sep 17 00:00:00 2001 From: TCs Date: Mon, 12 Oct 2026 23:46:31 +0300 Subject: [PATCH 2/3] Keep embeddedFrameClass an API until its removal API tools reports adding @noreference to an existing public field as an API break ("no longer an API", asking for a major version increment), so drop the tag and keep the @Deprecated(forRemoval = true, since = "2026-12") deprecation alone. Signed-off-by: TCs --- .../Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java | 1 - .../Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java | 1 - .../Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java | 1 - 3 files changed, 3 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java index c76f07fbd6c..bf59a1a925b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java @@ -48,7 +48,6 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * - * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release. diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java index 150ac310ec3..8bd56385f45 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java @@ -47,7 +47,6 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * - * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release. diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java index 26259aa865b..27ce30fb7e0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java @@ -43,7 +43,6 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * - * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release. From f6c9d17125b08b685b278f964d98fbf9d6fec566 Mon Sep 17 00:00:00 2001 From: TCs Date: Tue, 13 Oct 2026 09:12:51 +0300 Subject: [PATCH 3/3] Mark embeddedFrameClass @noreference with API filters Restore @noreference on SWT_AWT.embeddedFrameClass, as requested in review, and filter the resulting "field is no longer an API" problem (id 338940029) in each binary fragment's .api_filters. Signed-off-by: TCs Co-Authored-By: Claude Opus 5.5 --- .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../.settings/.api_filters | 8 ++++++++ .../cocoa/org/eclipse/swt/awt/SWT_AWT.java | 1 + .../Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java | 1 + .../win32/org/eclipse/swt/awt/SWT_AWT.java | 1 + 12 files changed, 75 insertions(+) diff --git a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters index 26140701a05..8e36bfa1a20 100644 --- a/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.cocoa.macosx.aarch64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters index 10e610b0d1e..1bd4ec099fc 100644 --- a/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.cocoa.macosx.x86_64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters index af63f67d3e5..8c90971b9c6 100644 --- a/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.gtk.linux.aarch64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters index 902cb214dd0..d1d863d92d2 100644 --- a/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.gtk.linux.loongarch64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters index 63de024cfda..5fc0f0192b5 100644 --- a/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters +++ b/binaries/org.eclipse.swt.gtk.linux.ppc64le/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters index 4e308700c96..e663d401747 100644 --- a/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.gtk.linux.riscv64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters index f80dfb5553d..34c43585299 100644 --- a/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.gtk.linux.x86_64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters b/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters index 453427c7a5f..5d317551f90 100644 --- a/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.win32.win32.aarch64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters b/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters index c29e6dd3417..da485fb2ea1 100644 --- a/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters +++ b/binaries/org.eclipse.swt.win32.win32.x86_64/.settings/.api_filters @@ -1,5 +1,13 @@ + + + + + + + + diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java index bf59a1a925b..c76f07fbd6c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/cocoa/org/eclipse/swt/awt/SWT_AWT.java @@ -48,6 +48,7 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * + * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release. diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java index 8bd56385f45..150ac310ec3 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/gtk/org/eclipse/swt/awt/SWT_AWT.java @@ -47,6 +47,7 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * + * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release. diff --git a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java index 27ce30fb7e0..26259aa865b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java +++ b/bundles/org.eclipse.swt/Eclipse SWT AWT/win32/org/eclipse/swt/awt/SWT_AWT.java @@ -43,6 +43,7 @@ public class SWT_AWT { * The name of the embedded Frame class. The default class name * for the platform will be used if null. * + * @noreference This field is not intended to be referenced by clients. * @deprecated The class named here is never instantiated: the platform's * default embedded Frame class is always used. This field will * be removed in a future release.