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
Backport tools.jar robustness for REPL, fail loud #7652
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7652?orig=1 |
Robin Green (greenrd) said:
|
Robin Green (greenrd) said:
However, it doesn't look like I can use this workaround from sbt. |
@som-snytt said: IOW, this works in 2.10, and "affects versions" is only 2.9. |
Robin Green (greenrd) said: |
@som-snytt said: There was an enhancement for 2.11: On Ubuntu it's easy to get JAVA_HOME, java and javac at cross-purposes. In my case, after installing jdk7, it left java at java6. I've forgotten the details except that it was a confusing mode of failure; perhaps it's more confusing on 2.10. apm@mara:~/tmp/q$ JAVA_HOME=$JAVA6_HOME sbt12
[info] Set current project to default-7bbd7f (in build file:/home/apm/tmp/q/)
> ++ 2.10.2
Setting version to 2.10.2
[info] Set current project to default-7bbd7f (in build file:/home/apm/tmp/q/)
> console
[info] Updating {file:/home/apm/tmp/q/}default-7bbd7f...
[info] Resolving org.scala-lang#scala-library;2.10.2 ...
[info] Done updating.
[info] 'compiler-interface' not yet compiled for Scala 2.10.2. Compiling...
[info] Compilation completed in 12.899 s
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :javap
:javap [-lcsvp] [path1 path2 ...]
scala> :javap -public scala.Option
Compiled from "Option.scala" I see there's an about command: > about
[info] This is sbt 0.12.3
[info] The current project is {file:/home/apm/tmp/q/}default-7bbd7f
[info] The current project is built against Scala 2.10.2
[info]
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
> There's a debug flag that might help. But what does this mean? $ sbt12 -Dscala.repl.debug=true
Welcome to Scala version 2.10.2 (OpenJDK 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.
[info] started at Thu Aug 29 11:21:32 PDT 2013
scala> :javap
:javap unavailable: no tools.jar at /usr/lib/jvm/java-7-openjdk-amd64
:javap not yet working with java 1.7 Not finding tools.jar should be a spurious report. Running that again with JDK 6 works as expected: Welcome to Scala version 2.10.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
[info] started at Thu Aug 29 11:28:58 PDT 2013
scala> :javap
:javap available.
:javap [-lcsvp] [path1 path2 ...]
scala> :javap java.lang.Object
Compiled from "Object.java" Also, under debug, > about
[info] This is sbt 0.12.3
[info] The current project is {file:/home/apm/tmp/q/}default-7bbd7f
[info] The current project is built against Scala 2.9.2
[info]
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
> console
[info] Starting scala interpreter...
[info]
[error] (run-main) java.lang.NullPointerException
java.lang.NullPointerException
at scala.tools.nsc.interpreter.ILoop.<init>(ILoop.scala:68)
at scala.tools.nsc.InterpreterLoop.<init>(InterpreterLoop.scala:9)
at scala.tools.nsc.InterpreterLoop.<init>(InterpreterLoop.scala:11)
at xsbt.ConsoleInterface$$anon$1.<init>(ConsoleInterface.scala:27)
at xsbt.ConsoleInterface.run(ConsoleInterface.scala:27) |
@som-snytt said: I was able to test this way, without munging my environment, thankfully. This is java at v6 and JAVA_HOME at v7; reflective invocation of javap finds the wrong tools.jar. apm@mara:~/tmp/q$ JAVACMD=$JAVA6_HOME/bin/java JAVA_HOME=$JAVA7_HOME sbt12
Launching with /home/apm/bin/sbt-0.12.3/bin/sbt-launch.jar
[info] Set current project to default-7bbd7f (in build file:/home/apm/tmp/q/)
>
> ++ 2.10.2
Setting version to 2.10.2
[info] Set current project to default-7bbd7f (in build file:/home/apm/tmp/q/)
>
> about
[info] This is sbt 0.12.3
[info] The current project is {file:/home/apm/tmp/q/}default-7bbd7f
[info] The current project is built against Scala 2.10.2
[info]
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.10.2 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala> :javap
:javap [-lcsvp] [path1 path2 ...]
scala> :javap java.lang.Object
scala> It does indeed fail silently. Boy, that's confusing. |
@som-snytt said: |
After launching the REPL from sbt, the :javap command does not work for class names:
scala> :javap iControl.services.CommonIPPortDefinition
scala> :javap iControl.services.CommonIPPortDefinition
scala> :javap java.lang.Object
The text was updated successfully, but these errors were encountered: