Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SI-6026 REPL checks for javap before tools.jar

If javap is already available, don't go hunting for tools.jar

This avoids the getResource bug in AbstractFileClassLoader.
  • Loading branch information...
commit 2bfe0e797c2b9c57277475c9296e36cbf868b7db 1 parent 371bad2
@som-snytt som-snytt authored
Showing with 16 additions and 12 deletions.
  1. +16 −12 src/compiler/scala/tools/nsc/interpreter/ILoop.scala
View
28 src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -394,20 +394,24 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
(install map (_.parent) flatMap jarAt) orElse
(jdkDir flatMap deeply)
}
- private def addToolsJarToLoader() = {
- val cl = platformTools match {
- case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader)
- case _ => intp.classLoader
- }
- if (Javap.isAvailable(cl)) {
- repldbg(":javap available.")
- cl
- }
- else {
- repldbg(":javap unavailable: no tools.jar at " + jdkHome)
+ private def addToolsJarToLoader() = (
+ if (Javap isAvailable intp.classLoader) {
+ repldbg(":javap available on interpreter class path.")
intp.classLoader
+ } else {
+ val cl = platformTools match {
+ case Some(tools) => ScalaClassLoader.fromURLs(Seq(tools.toURL), intp.classLoader)
+ case _ => intp.classLoader
+ }
+ if (Javap isAvailable cl) {
+ repldbg(":javap available on extended class path.")
+ cl
+ } else {
+ repldbg(s":javap unavailable: no tools.jar at $jdkHome")
+ intp.classLoader
+ }
}
- }
+ )
protected def newJavap() = new JavapClass(addToolsJarToLoader(), new IMain.ReplStrippingWriter(intp)) {
override def tryClass(path: String): Array[Byte] = {
Please sign in to comment.
Something went wrong with that request. Please try again.