Using the precompiled dotty binaries has always worked for me. Now they seem to have been compiled with Java 11. I suspect this is a mistake and they should actually be compiled with Java 8.
Starting REPL on command line with Java 8 on PATH:
Starting scala3 REPL...
Exception in thread "main" java.lang.UnsupportedClassVersionError: dotty/tools/dotc/interfaces/ReporterResult has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
➜ ~ sdk use java 11.0.7-zulu
Using java version 11.0.7-zulu in this shell.
➜ ~ ./scala3-3.0.0-M1/bin/scala
Starting scala3 REPL...
scala> 42
val res0: Int = 42
scala>
➜ ~ sdk use java 15-open
Using java version 15-open in this shell.
➜ ~ ./scala3-3.0.0-M1/bin/scala
Starting scala3 REPL...
Exception in thread "main" scala.MatchError: ClassInfo(ThisType(TypeRef(NoPrefix,module class lang)), class Enum, List(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class Object), TypeRef(ThisType(TypeRef(NoPrefix,module class constant)),trait Constable), AppliedType(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),trait Comparable),List(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,module class lang)),class Enum)),type E))), TypeRef(ThisType(TypeRef(NoPrefix,module class io)),trait Serializable))) (of class dotty.tools.dotc.core.Types$CachedClassInfo)
at dotty.tools.dotc.core.Definitions.JavaEnumClass(Definitions.scala:723)
at dotty.tools.dotc.core.Definitions.init(Definitions.scala:1666)
at dotty.tools.dotc.core.Contexts$ContextBase.initialize(Contexts.scala:830)
at dotty.tools.repl.ReplDriver.initialCtx(ReplDriver.scala:71)
at dotty.tools.repl.ReplDriver.resetToInitial(ReplDriver.scala:85)
at dotty.tools.repl.ReplDriver.<init>(ReplDriver.scala:99)
at dotty.tools.repl.Main$.main(Main.scala:6)
at dotty.tools.repl.Main.main(Main.scala)
➜ ~
@som-snytt the issue with java 14+ is fixed in master: https://github.com/lampepfl/dotty/pull/10135
I've recompiled and republished the binaries to GH releases with Java 8.
Most helpful comment
@som-snytt the issue with java 14+ is fixed in master: https://github.com/lampepfl/dotty/pull/10135