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 #12878

Open
xuwei-k opened this issue Sep 22, 2023 · 0 comments
Open

Comments

@xuwei-k
Copy link

xuwei-k commented Sep 22, 2023

Reproduction steps

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 := "2.13.12"

project/build.properties

sbt.version=1.9.6

Problem

sbt -J--enable-preview compile

https://github.com/scala/scala/blob/e67d287447c09720468f8bebcb0302bd92d75f43/src/compiler/scala/tools/nsc/javac/JavaParsers.scala#L1074

[error] /home/runner/work/Scala-JEP-445/Scala-JEP-445/A.java:1:6: illegal start of type declaration
[error] void main() {
[error]      ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
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

3 participants