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

Phil Race prr at openjdk.java.net
Fri Oct 1 21:10:27 UTC 2021


> 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.

Phil Race has updated the pull request incrementally with one additional commit since the last revision:

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

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/5724/files
  - new: https://git.openjdk.java.net/jdk/pull/5724/files/96a5590c..4c8fb9af

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=5724&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=5724&range=02-03

  Stats: 112 lines in 2 files changed: 112 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5724.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5724/head:pull/5724

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


More information about the core-libs-dev mailing list