SCALA REPL在发布时抛出错误

时间:2015-07-31 14:46:04

标签: scala

当我尝试运行SCALA REPL时出现以下错误。请注意,我已经在讨论降级java版本的这篇文章。

sg@IN0D196716 C:\Users\sg
$ java -version
java version "1.7.0_80"
Java(TM) SE Runtime Environment (build 1.7.0_80-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.80-b11, mixed mode)

sg@IN0D196716 C:\Users\sg
$ scala
Exception in thread "main" java.lang.NoSuchMethodError: scala.util.matching.Regex.unapplySeq(Ljava/lang/CharSequence;)Lscala/Option;
        at scala.tools.nsc.settings.ScalaVersion$.apply(ScalaVersion.scala:104)
        at scala.tools.nsc.settings.ScalaVersion$.apply(ScalaVersion.scala:114)
        at scala.tools.nsc.settings.ScalaVersion$.<init>(ScalaVersion.scala:119)
        at scala.tools.nsc.settings.ScalaVersion$.<clinit>(ScalaVersion.scala)
        at scala.tools.nsc.settings.ScalaSettings$class.$init$(ScalaSettings.scala:138)
        at scala.tools.nsc.settings.MutableSettings.<init>(MutableSettings.scala:20)
        at scala.tools.nsc.Settings.<init>(Settings.scala:12)
        at scala.tools.nsc.GenericRunnerSettings.<init>(GenericRunnerSettings.scala:11)
        at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:18)
        at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:41)
        at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
        at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

1 个答案:

答案 0 :(得分:1)

Sorry, dude, that's my fault.

A few years ago, someone said you should only be able to use a regex to extract from strings (char sequences).

That was such a reasonable request. "Tell me if I try to match a regex to something that isn't even a string!"

Unfortunately, because JVM and maven and ivy, you never know what backwards compatibility issues you'll discover.

As you have discovered.

Scala requires that you build and run with the same "major" version.

Here is a similar issue where "user experience" diverges:

https://issues.scala-lang.org/browse/SI-9380

Additional apologies if you don't prefer the gendered "dude", if it is gendered.