RFR: 8261785: Calling "main" method in anonymous nested class crashes the JVM

David Holmes david.holmes at oracle.com
Mon Mar 15 00:17:18 UTC 2021


Hi Henry,

On 15/03/2021 9:40 am, Henry Jen wrote:
> This patch ensure launcher won't crash JVM for the new static Methods from local/anonymous class on MacOS.
> 
> As @dholmes-ora pointed out in the analysis, this is a MacOS specific bug when the launcher trying to grab class name to be displayed as the Application name on the menu.
> 
> The fix is to not setting name, test shows that GUI java application shows 'bin' as the application name. It's possible for us to set the name to something more friendly, for example, "Java", but I am not sure that should be launcher's responsibility to choose such a default name. It seems to me the consumer of the JAVA_MAIN_CLASS_%d environment variable should be responsible to pick such name in case the environment variable is not set.

Maybe the AWT folk should decide what name should be displayed in this 
case. The canonical name was chosen when all main classes had to have a 
canonical name. So perhaps a simple name will suffice in the case where 
there is no canonical name?

Cheers,
David

> -------------
> 
> Commit messages:
>   - 8261785: Calling "main" method in anonymous nested class crashes the JVM
> 
> Changes: https://git.openjdk.java.net/jdk/pull/2999/files
>   Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2999&range=00
>    Issue: https://bugs.openjdk.java.net/browse/JDK-8261785
>    Stats: 111 lines in 3 files changed: 110 ins; 0 del; 1 mod
>    Patch: https://git.openjdk.java.net/jdk/pull/2999.diff
>    Fetch: git fetch https://git.openjdk.java.net/jdk pull/2999/head:pull/2999
> 
> PR: https://git.openjdk.java.net/jdk/pull/2999
> 


More information about the hotspot-runtime-dev mailing list