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

scala.tools.nsc.javac.JavaParsers can't parse JDK17 "Sealed Classes" #12159

Closed
xuwei-k opened this issue Sep 22, 2020 · 5 comments · Fixed by scala/scala#10105 or scala/scala#10348
Closed

Comments

@xuwei-k
Copy link

xuwei-k commented Sep 22, 2020

reproduction steps

https://openjdk.java.net/jeps/360
https://github.com/scala/scala/blob/v2.13.3/src/compiler/scala/tools/nsc/javac/JavaParsers.scala#L1002

$ java --version
openjdk 15 2020-09-15
OpenJDK Runtime Environment (build 15+36-1562)
OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

build.sbt

javacOptions ++= Seq("--enable-preview", "--release", "15")

scalaVersion := "2.13.3"

A.java

sealed class A{}

final class B extends A{}

C.scala

class C

sbt version: 1.3.13

problem

run sbt compile

A.java:1:8: illegal start of type declaration
[error] sealed class A{}
[error]        ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
[error] Total time: 0 s, completed 2020/09/22 10:18:53

workaround

// build.sbt
compileOrder := CompileOrder.JavaThenScala

note

similar issue #11908

@mkurz
Copy link

mkurz commented Sep 22, 2020

Not really sure if this is somehow related, but ASM 9.0, which brings support for Java 15 and even Java 16 already just got released:

@SethTisue SethTisue added this to the Backlog milestone Oct 1, 2020
@SethTisue
Copy link
Member

SethTisue commented Oct 1, 2020

@mkurz this ticket is about mixed compilation of Scala and Java sources. ASM involves JVM bytecode only, not Java source code.

(regardless, thanks for calling the ASM upgrade to our attention, we'll evaluate that soon, plus I'll be embarking on scala/community-build#1225 soon.)

@SethTisue
Copy link
Member

it would make sense to tackle this and #12171 together

@mkurz
Copy link

mkurz commented Jan 29, 2021

@SethTisue Please also don't forget #11908 😉

@SethTisue SethTisue modified the milestones: 2.13.5, 2.13.6 Feb 9, 2021
@dwijnand dwijnand modified the milestones: 2.13.6, 2.13.7 May 10, 2021
@SethTisue SethTisue modified the milestones: Backlog, 2.13.9 Aug 10, 2022
@SethTisue SethTisue changed the title scala.tools.nsc.javac.JavaParsers can't parse JDK15 "Sealed Classes" scala.tools.nsc.javac.JavaParsers can't parse JDK17 "Sealed Classes" Aug 10, 2022
@SethTisue SethTisue modified the milestones: 2.13.9, 2.13.10 Sep 1, 2022
@SethTisue SethTisue modified the milestones: 2.13.10, 2.13.11 Sep 29, 2022
@SethTisue SethTisue reopened this Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment