Integrated: 8274397: [macOS] Stop setting env. var JAVA_MAIN_CLASS_<pid> in launcher code

Phil Race prr at openjdk.java.net
Tue Oct 5 17:34:24 UTC 2021


On Mon, 27 Sep 2021 20:56:28 GMT, Phil Race <prr at openjdk.org> wrote:

> macOS launcher code sets JAVA_MAIN_CLASS_<pid> which is read by AWT to set the name of the application in the system menu bar.
> 
> Because this set shortly after the VM is running, it causes a thread safety issue described in https://bugs.openjdk.java.net/browse/JDK-8270549
> 
> Since the AWT already looks for the system property "apple.awt.application.name" for this same purpose,
> we can set that instead of the env. var and avoid the threading issue.
> 
> This trades the JAVA_MAIN_CLASS_<pid> pollution of the environment for setting a system property which is visible to apps as well but it seems a reasonable trade-off since we already (implicitly) support this variable anyway in preference to the env. var.

This pull request has now been integrated.

Changeset: 37890650
Author:    Phil Race <prr at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/37890650a7c97d484b6b520d909f677dac4e46e1
Stats:     205 lines in 5 files changed: 159 ins; 26 del; 20 mod

8274397: [macOS] Stop setting env. var JAVA_MAIN_CLASS_<pid> in launcher code

Reviewed-by: rriggs, serb

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

PR: https://git.openjdk.java.net/jdk/pull/5724



More information about the client-libs-dev mailing list