RFR: JDK-8306112 Implementation of JEP 445: Unnamed Classes and Instance Main Methods (Preview) [v17]

Naoki Kishida duke at openjdk.org
Wed May 24 08:04:12 UTC 2023


On Tue, 23 May 2023 20:04:45 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

>> Add flexible main methods and anonymous main classes to the Java language.
>
> Jim Laskey has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 33 commits:
> 
>  - Fix missing constructor error messages and handle inner class launching
>  - Merge branch 'master' into 8306112
>  - Issue warning if traditional main not used.
>  - Give subclass priority
>  - Merge branch 'master' into 8306112
>  - Requested Changes #2
>  - Update VirtualParser.java
>  - Merge branch 'master' into 8306112
>  - Refactor source code launcher
>  - Typo
>  - ... and 23 more: https://git.openjdk.org/jdk/compare/bddf4838...b55f82f8

Can we use enum?


public class Main{
  enum Foo {A, B}
  void main() {
    System.out.println(Foo.A);
  }
}

↑ OK


enum Foo {A, B}
void main() {
  System.out.println(Foo.A);
}

↑error(enumtest.java is the filename)

enumtest.java:1: Error : package enumtest does not exist
  enum Foo {A, B}
  ^

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

PR Comment: https://git.openjdk.org/jdk/pull/13689#issuecomment-1560631740



More information about the build-dev mailing list