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

Exception when trying to use Ammonite REPL #15

Closed
jchayat opened this issue Feb 14, 2015 · 12 comments
Closed

Exception when trying to use Ammonite REPL #15

jchayat opened this issue Feb 14, 2015 · 12 comments

Comments

@jchayat
Copy link

jchayat commented Feb 14, 2015

// build.sbt

name := "test-repl"

version := "1.0"

scalaVersion := "2.11.5"

libraryDependencies += "com.lihaoyi" %% "ammonite" % "0.1.6"

libraryDependencies += "com.lihaoyi" %% "ammonite-repl" % "0.1.6"

initialCommands in console := "ammonite.repl.Repl.main(null)"
#Command Line

jon$ sbt console
[info] Loading project definition from /Users/jon/code/test-repl/project
[info] Set current project to test-repl (in build file:/Users/jon/code/test-repl/)
[info] Starting scala interpreter...
[info] 
java.lang.AbstractMethodError
  at scala.tools.nsc.backend.JavaPlatform$class.$init$(JavaPlatform.scala:22)
  at ammonite.repl.interp.Compiler$$anon$1$$anon$6.<init>(Compiler.scala:70)
  at ammonite.repl.interp.Compiler$$anon$1.platform$lzycompute(Compiler.scala:70)
  at ammonite.repl.interp.Compiler$$anon$1.platform(Compiler.scala:70)
  at scala.tools.nsc.interactive.Global$$anon$8.<init>(Global.scala:401)
  at scala.tools.nsc.interactive.Global.loaders$lzycompute(Global.scala:399)
  at scala.tools.nsc.interactive.Global.loaders(Global.scala:399)
  at scala.tools.nsc.Global$GlobalMirror.rootLoader(Global.scala:65)
  at scala.reflect.internal.Mirrors$Roots$RootClass.<init>(Mirrors.scala:307)
  at scala.reflect.internal.Mirrors$Roots.RootClass$lzycompute(Mirrors.scala:321)
  at scala.reflect.internal.Mirrors$Roots.RootClass(Mirrors.scala:321)
  at scala.reflect.internal.Mirrors$Roots$EmptyPackageClass.<init>(Mirrors.scala:330)
  at scala.reflect.internal.Mirrors$Roots.EmptyPackageClass$lzycompute(Mirrors.scala:336)
  at scala.reflect.internal.Mirrors$Roots.EmptyPackageClass(Mirrors.scala:336)
  at scala.reflect.internal.Mirrors$Roots.EmptyPackageClass(Mirrors.scala:276)
  at scala.reflect.internal.Mirrors$RootsBase.init(Mirrors.scala:250)
  at scala.tools.nsc.Global.rootMirror$lzycompute(Global.scala:74)
  at scala.tools.nsc.Global.rootMirror(Global.scala:72)
  at scala.tools.nsc.Global.rootMirror(Global.scala:40)
  at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass$lzycompute(Definitions.scala:257)
  at scala.reflect.internal.Definitions$DefinitionsClass.ObjectClass(Definitions.scala:257)
  at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1391)
  at scala.tools.nsc.Global$Run.<init>(Global.scala:1216)
  at scala.tools.nsc.interactive.Global$TyperRun.<init>(Global.scala:1208)
  at scala.tools.nsc.interactive.Global.newTyperRun(Global.scala:1231)
  at scala.tools.nsc.interactive.Global.<init>(Global.scala:297)
  at ammonite.repl.interp.Compiler$$anon$1.<init>(Compiler.scala:68)
  at ammonite.repl.interp.Compiler.<init>(Compiler.scala:68)
  at ammonite.repl.interp.Interpreter.init(Interpreter.scala:23)
  at ammonite.repl.interp.Interpreter.<init>(Interpreter.scala:55)
  at ammonite.repl.Repl.<init>(Repl.scala:11)
  at ammonite.repl.Repl$.main(Repl.scala:73)
  ... 39 elided
Welcome to Scala version 2.11.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> 
@lihaoyi
Copy link
Member

lihaoyi commented Feb 14, 2015

Hmm try scala 2.11.4 or Java 8? Those are the things that come to mind

@jchayat
Copy link
Author

jchayat commented Feb 14, 2015

Yes, It works on 2.11.4

Does it work on 2.10.4? I had a resolution problem.

@lihaoyi
Copy link
Member

lihaoyi commented Feb 14, 2015

Doesn't work with 2.10.4

@lihaoyi
Copy link
Member

lihaoyi commented Feb 14, 2015

Maybe at some point I'll cross publish; for now 2.11.4 it is ^_^

@lihaoyi lihaoyi closed this as completed Feb 14, 2015
@jarandaf
Copy link

jarandaf commented Mar 9, 2015

I also experience this issue, scala version is 2.11.4 and java version is 1.8.0_25.

@lihaoyi
Copy link
Member

lihaoyi commented Mar 9, 2015

@jchayat @jarandaf The latest version is cross-published, the older ones don't. Have you tried that?

@lihaoyi lihaoyi reopened this Mar 9, 2015
@alexarchambault
Copy link
Collaborator

@jarandaf @lihaoyi Binary incompatibilities in the scala-compiler JAR are quite common, I ran into one between 2.10.4/2.10.5 (macro related methods that changed), there are also some in 2.11 (2.11.2 vs 2.11.4 or 5 for sure, ran into it with the spark repl jar). Using the exact same version as ammonite should be recommended.

@lihaoyi
Copy link
Member

lihaoyi commented Mar 10, 2015

@alexarchambault should we cross-publish Ammonite against different minor versions of Scala? How does one even do that? Presumably it's possible

@alexarchambault
Copy link
Collaborator

@lihaoyi shapeless is doing it with scala 2.10 (see https://github.com/milessabin/shapeless#shapeless-210), but it's cumbersome for its users. I'm really shared about this (I'll let you decide anyway!) You could just recommend to use the latest scala version.

@alexarchambault
Copy link
Collaborator

To go the cross publishing route, it should just be a matter of adding

crossVersion := CrossVersion.full

crossScalaVersions := (0 to 5).filterNot(3.==).map("2.11." + _) ++ ...

in build.sbt, and for the users, use

"com.lihaoyi" %% "ammonite-..." % "..." cross CrossVersion.full

as a dependency instead of just

"com.lihaoyi" %% "ammonite-..." % "..."

(after-thought: not that cumbersome)

@jarandaf
Copy link

Using same scala version as Ammonite seems to solve the problem (or at least, the REPL starts). I am facing another problem now (see #35), probably not directly related.

@lihaoyi
Copy link
Member

lihaoyi commented Apr 19, 2015

Fixed in 0.2.8

@lihaoyi lihaoyi closed this as completed Apr 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants