-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Scala 3.3.2: class file ... is broken, reading aborted with class java.util.NoSuchElementException contextual$ #12418
Description
Asking @SethTisue @lrytz @som-snytt @sjrd @smarter for advice.
Just yesterday I made Play build with with 3.3.2:
Now I run into a problem which IMHO is caused by
- scala/scala3@a10a271
- (which is cherry-picked from Fix overcompilation due to unstable context bound desugaring scala/scala3#18280)
How to reproduce:
- Checkout Play locally with current
main(3ace273) - Build Play locally:
sbt +publishLocal - Clone the play-samples repo: https://github.com/playframework/play-samples/
git clone [email protected]:playframework/play-samples.git # Make sure you are on the 3.0.x branch (default anyway) - Within the samples repo:
cd play-java-chatroom-example - Make sure to apply the local Play snapshot:
--- a/play-java-chatroom-example/project/plugins.sbt +++ b/play-java-chatroom-example/project/plugins.sbt @@ -1,2 +1,2 @@ // The Play plugin -addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.1") +addSbtPlugin("org.playframework" % "sbt-plugin" % "3.1.0-SNAPSHOT")
- Currently, the sample project is using Scala 3.3.1 (but Play is now build with 3.3.2). Now try to compile the project:
$ sbt ++3.x compile [info] welcome to sbt 1.9.8 (Eclipse Adoptium Java 11.0.22) ... [info] Version 3.1.0-SNAPSHOT running Java 11.0.22 ... [info] Setting Scala version to 3.3.1 on 1 projects. ... [info] compiling 5 Scala sources and 3 Java sources to ./play-samples/play-java-chatroom-example/target/scala-3.3.1/classes ... [error] error while loading PathBindableMacros, [error] class file play/api/mvc/PathBindableMacros.class is broken, reading aborted with class java.util.NoSuchElementException [error] contextual$ [error] one error found [error] (Compile / compileIncremental) Compilation failed [error] Total time: 2 s, completed Feb 27, 2024, 4:10:59 PM - Changing the Scala version of the project to
3.3.2makes compiliation work however (inbuild.sbt:crossScalaVersions := Seq("2.13.12", "3.3.2"),)
So this is the file which this problem is about: https://github.com/playframework/playframework/blob/main/core/play/src/main/scala-3/play/api/mvc/PathBindableMacros.scala
If I build Play with Scala 3.3.1 by reverting yesterdays commit (git revert -m 1 552f5a0ae1876804b06114a94b619712a22c46c4), I can run the samples project again with Scala 3.3.1 set in the project.
Now what I found out is that the tasty files generated by Play with Scala 3.3.1 vs Scala 3.3.2 differ:
- The file
./core/play/target/scala-3.3.1/classes/play/api/mvc/PathBindableMacros.tastycontainsevidence$ - The file
./core/play/target/scala-3.3.2/classes/play/api/mvc/PathBindableMacros.tastyreplacedevidence$withcontextual$
I also inspected the class files
./core/play/target/scala-3.3.1/classes/play/api/mvc/PathBindableMacros.class./core/play/target/scala-3.3.2/classes/play/api/mvc/PathBindableMacros.class
with javap -v and it looks like they are identical (except some bytes in the tasty part):
--- /tmp/3.3.1_javap 2024-02-27 16:43:43.766644833 +0100
+++ /tmp/3.3.2_javap 2024-02-27 16:43:47.259650233 +0100
@@ -1,5 +1,5 @@
-Classfile ./core/play/target/scala-3.3.1/classes/play/api/mvc/PathBindableMacros.class
+Classfile ./core/play/target/scala-3.3.2/classes/play/api/mvc/PathBindableMacros.class
Last modified Feb 27, 2024; size 175 bytes
- MD5 checksum 604088e2d12cc976c4f58b7d109da0e7
+ MD5 checksum 144a574029f956604ac0ae298c323c5f
Compiled from "PathBindableMacros.scala"
public interface play.api.mvc.PathBindableMacros
@@ -23,5 +23,5 @@
SourceFile: "PathBindableMacros.scala"
TASTY: length = 0x10 (unknown attribute)
- 00 98 FE E0 E7 74 F5 C5 00 66 D7 56 61 0B CB 19
+ 00 B6 6E 0F BB C2 58 C5 00 66 D7 56 61 0B CB 19
Scala: length = 0x0 (unknown attribute)