-
Notifications
You must be signed in to change notification settings - Fork 21
JavaParsers doesn't support JEP 445: Unnamed Classes and Instance Main Methods
#12878
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
Comments
https://openjdk.org/jeps/512 finalize in JDK 25 |
It kind of makes you not want to support Java. |
Support for simpler main methods seems to just work with Scala bytecode $ cat T.scala
class T {
def main(): Unit = println("hi")
}
$ sc T.scala
> scala compile --server=false -S 2.13 -d . -release 8 T.scala
$ java -version
openjdk version "25-ea" 2025-09-16
$ sr T
> scala run -S 2.13 -cp . -M T
hi |
Took a quick look. Spec diff (via https://docs.oracle.com/javase/specs/). Quirks
This defines classes Compact compilation units have an implicit
With the version I tested (25-ea+22-2667), a compact compilation unit cannot referenced in joint compilation (as expected by the JEP). But the resulting Perhaps the best way to support this JEP is to set |
Reproduction steps
A.java
B.scala
build.sbt
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
The text was updated successfully, but these errors were encountered: