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

Alan Bateman alanb at openjdk.java.net
Wed Mar 17 08:59:09 UTC 2021


On Tue, 16 Mar 2021 17:49:42 GMT, Henry Jen <henryjen 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.

The requirement for a CSR and release note should not be a concern here. I don't object to the fix but I think it would be very useful to document the main class and whether local or anonymous classes can be used, its accessibility, and the accessibility of the main method. We had to do something similar recently with the premain method (java.lang.instrument).

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

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


More information about the hotspot-runtime-dev mailing list