RFR: JDK-8318854: [macos14] Running any AWT app prints Secure coding warning [v2]

Sergey Bylokhov serb at openjdk.org
Fri Nov 10 21:28:57 UTC 2023


On Fri, 10 Nov 2023 14:07:23 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m line 844:
>> 
>>> 842:     }
>>> 843: 
>>> 844:     if (menuBar == nil && [ApplicationDelegate sharedDelegate] != nil) {
>> 
>> Can you please provide details on how the delegate can be null here and there if it should be set at the startup of any awt application?
>
> It can be null if the NSApplication was created by code outside of AWT. Specifically, in the case of an FX or SWT toolkit, but in theory a native application using JAWT could do this.
> 
> In practice, since we haven't even seen a crash as a result of this, I doubt that this code is ever called if AWT isn't running the event loop and hasn't installed their delegate.

To access any native code in AWT the app should initially init the LWCToolkit which sets that application delegate if it is not set already. Do we know how the FX can bypass that initialization?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16569#discussion_r1389938434


More information about the client-libs-dev mailing list