RFR: 8261785: Calling "main" method in anonymous nested class crashes the JVM
Henry Jen
henryjen at openjdk.java.net
Tue Mar 16 17:52:08 UTC 2021
On Tue, 16 Mar 2021 15:33:37 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> Using an anonymous class for the main class looks strange and hard to believe anyone is relying on this. I wonder if we should do more checking LauncherHelper.validateMainClass to reject cases like this.
I raised that same question, and people tends to agree launcher could reject anonymous/local classes. But pointed out that should require a CSR review. Therefore I chose to fix crash first, and we can file another ticket to address main class requirements.
> This is not the last attempt to set the name, the JAVA_MAIN_CLASS_ variable is used in the middle of the name selection, there are some others. And the "bin" is selected by some of the next step, I agree it is not a friendly name that could be improved.
I tried to do a quick search on JAVA_MAIN_CLASS_%pid variable, didn't find other code to set this. I had a version that would set the variable to "Java", I can extend that to cover exception case as well.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2999
More information about the hotspot-runtime-dev
mailing list