Skip to content
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

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

Open
xuwei-k opened this issue Sep 22, 2023 · 1 comment

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants