Skip to content

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

@xuwei-k

Description

@xuwei-k

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

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:stableIssues corresponding to a JEP which got already delivered as a stable feature in a JDK releaseitype:enhancementitype:spikeWe need to spend time and investigate something, before we decide what to do next.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions