scala-cli
scala-cli copied to clipboard
`repl` doesn't work for Scala version `2.12.x` > `2.12.1` and < `2.12.9`
Version(s) 0.1.14
Describe the bug
The repl crashes on Scala versions 2.12.2 - 2.12.8.
Anything 2.12.9 and above seems to run fine.
2.12.0 doesn't work either, but that seems to be a separate issue more likely to be tied to #1381, since the error is different.
Somehow, 2.12.1 works fine, as far as I have tested it.
To Reproduce
▶ scala-cli -S 2.12.5
Welcome to Scala 2.12.5 (OpenJDK 64-Bit Server VM, Java 17.0.2).
Type in expressions for evaluation. Or try :help.
scala> 1
java.io.IOError: java.lang.RuntimeException: /packages cannot be represented as URI
at java.base/jdk.internal.jrtfs.JrtPath.toUri(JrtPath.java:175)
at scala.tools.nsc.classpath.JrtClassPath.asURLs(DirectoryClassPath.scala:204)
at scala.tools.nsc.classpath.AggregateClassPath.$anonfun$asURLs$1(AggregateClassPath.scala:55)
at scala.collection.TraversableLike.$anonfun$flatMap$1(TraversableLike.scala:241)
at scala.collection.Iterator.foreach(Iterator.scala:944)
at scala.collection.Iterator.foreach$(Iterator.scala:944)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1432)
at scala.collection.IterableLike.foreach(IterableLike.scala:71)
at scala.collection.IterableLike.foreach$(IterableLike.scala:70)
at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
at scala.collection.TraversableLike.flatMap(TraversableLike.scala:241)
at scala.collection.TraversableLike.flatMap$(TraversableLike.scala:238)
at scala.collection.AbstractTraversable.flatMap(Traversable.scala:104)
at scala.tools.nsc.classpath.AggregateClassPath.asURLs(AggregateClassPath.scala:55)
at scala.tools.nsc.interpreter.IMain.compilerClasspath(IMain.scala:95)
at scala.tools.nsc.interpreter.IMain.makeClassLoader(IMain.scala:358)
at scala.tools.nsc.interpreter.IMain.ensureClassLoader(IMain.scala:281)
at scala.tools.nsc.interpreter.IMain.classLoader(IMain.scala:284)
at scala.tools.nsc.interpreter.IMain.runtimeMirror(IMain.scala:161)
at scala.tools.nsc.interpreter.IMain.$anonfun$getModuleIfDefined$1(IMain.scala:170)
at scala.tools.nsc.interpreter.IMain.getModuleIfDefined(IMain.scala:163)
at scala.tools.nsc.interpreter.IMain.readRootPath(IMain.scala:295)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.resolvePathToSymbol(IMain.scala:767)
at scala.tools.nsc.interpreter.IMain$Request.resultSymbol$lzycompute(IMain.scala:972)
at scala.tools.nsc.interpreter.IMain$Request.resultSymbol(IMain.scala:971)
at scala.tools.nsc.interpreter.IMain$Request.$anonfun$typeMap$1(IMain.scala:983)
at scala.reflect.internal.util.Collections.$anonfun$mapFrom$1(Collections.scala:195)
at scala.tools.nsc.interpreter.IMain$Request.typeOf$lzycompute(IMain.scala:983)
at scala.tools.nsc.interpreter.IMain$Request.typeOf(IMain.scala:988)
at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:951)
at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:944)
at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:602)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:591)
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:563)
at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:869)
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:737)
at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:455)
at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:476)
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:1052)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:82)
at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:85)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:96)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Caused by: java.lang.RuntimeException: /packages cannot be represented as URI
... 44 more
Abandoning crashed session.
Expected behaviour
The repl should work fine for all Scala 2.12.x versions.
Additional context May be tied to #1382