Skip to content

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

@xuwei-k

Description

@xuwei-k
Contributor

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

Activity

added and removed
stat:needs triageEvery issue needs to have an "area" and "itype" label
on Sep 22, 2023
Kordyjan

Kordyjan commented on Sep 22, 2023

@Kordyjan
Contributor

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

added 2 commits that reference this issue on Nov 4, 2023
e9b364a
a55e5bc
added a commit that references this issue on Nov 5, 2023
01540b0
added
compat:java:jepIssues corresponding to a JEP (JDK Enhancement Proposal)
compat:java:jep:unstableIssues corresponding to a JEP (JDK Enhancement Proposal) which is not stable yet.
and removed on Jul 4, 2024
added
area:jdkIssues tied to artifacts published under a particular jdk
on Jul 5, 2024
xuwei-k

xuwei-k commented on May 16, 2025

@xuwei-k
ContributorAuthor

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

linked a pull request that will close this issue on May 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:jdkIssues tied to artifacts published under a particular jdkcompat:javacompat:java:jepIssues corresponding to a JEP (JDK Enhancement Proposal)compat:java:jep:unstableIssues corresponding to a JEP (JDK Enhancement Proposal) which is not stable yet.itype:enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @xuwei-k@Kordyjan@Gedochao@hamzaremmal

    Issue actions

      JavaParsers doesn't support `JEP 445: Unnamed Classes and Instance Main Methods` · Issue #18584 · scala/scala3