Skip to content

JavaParsers doesn't support JEP 445: Unnamed Classes and Instance Main Methods #18584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xuwei-k opened this issue Sep 22, 2023 · 2 comments · May be fixed by #23247
Open

JavaParsers doesn't support JEP 445: Unnamed Classes and Instance Main Methods #18584

xuwei-k opened this issue Sep 22, 2023 · 2 comments · May be fixed by #23247
Assignees
Labels
area:jdk Issues tied to artifacts published under a particular jdk compat:java:jep:unstable Issues corresponding to a JEP (JDK Enhancement Proposal) which is not stable yet. compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) compat:java itype:enhancement

Comments

@xuwei-k
Copy link
Contributor

xuwei-k commented Sep 22, 2023

Compiler version

  • 3.3.1
  • 3.4.0-RC1-bin-20230921-3d539e6-NIGHTLY

Minimized code

Install JDK 21

A.java

void main() {
  System.out.println("hello");
}

B.scala

class B

build.sbt

javacOptions ++= Seq(
  "-Xlint:preview",
  "--enable-preview",
  "--release",
  scala.util.Properties.javaSpecVersion
)

scalaVersion := "3.3.1"

project/build.properties

sbt.version=1.9.6

sbt -J--enable-preview compile

Output

[error] 1 |void main() {
[error]   |     ^^^^
[error]   |     illegal start of type declaration
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Expectation

success compile

Note

@xuwei-k xuwei-k added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 22, 2023
@Kordyjan Kordyjan added compat:java and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 22, 2023
@Kordyjan
Copy link
Contributor

3.3.2 will add support to JDK 21.
We will probably need to take care of handling the new main methods.

povder added a commit to povder/dotty that referenced this issue Nov 4, 2023
povder added a commit to povder/dotty that referenced this issue Nov 5, 2023
povder added a commit to povder/dotty that referenced this issue Nov 5, 2023
@Gedochao Gedochao added compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) compat:java:jep:unstable Issues corresponding to a JEP (JDK Enhancement Proposal) which is not stable yet. and removed prio:high labels Jul 4, 2024
@Gedochao Gedochao added the area:jdk Issues tied to artifacts published under a particular jdk label Jul 5, 2024
@xuwei-k
Copy link
Contributor Author

xuwei-k commented May 16, 2025

https://openjdk.org/jeps/512 finalize in JDK 25

@lrytz lrytz linked a pull request May 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:jdk Issues tied to artifacts published under a particular jdk compat:java:jep:unstable Issues corresponding to a JEP (JDK Enhancement Proposal) which is not stable yet. compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) compat:java itype:enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants