[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-2d-dev
Subject:    Re: RFR: 8274397: [macOS] Stop setting env. var JAVA_MAIN_CLASS_<pid> in launcher code [v3]
From:       Phil Race <prr () openjdk ! java ! net>
Date:       2021-09-29 3:50:32
Message-ID: CwYnLdq61-xkNGg4XZG7V6vnOEOIHtIhYmMoqhjylNE=.f7c0c9dc-936f-45f3-b41c-7fd9307746ac () github ! com
[Download RAW message or body]

On Wed, 29 Sep 2021 03:39:09 GMT, Phil Race <prr@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.
> 
> 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

And, oh, the env. var test code I needed to delete was checking not for a useful \
value but just that the env var was there. I wrote a simple jtreg test or the new \
code that set the system property and tested the expected value (default or set) but \
it seems jtreg makes MainWrapper the main class that is found regardless of \
main/othervm so I am currently grumbling quietly to myself about whether to add a \
test which is equivalent to the previous one which just tests the property has a \
value,  or to (I suppose) write a more sophisticated test that has to exec another VM \
where it *should* be able to properly verify it.

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

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic