summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-05-15 14:27:43 -0700
committerPaul Phillips <paulp@improving.org>2012-05-15 16:42:33 -0700
commit3e038d801cd3177ed1230eb7729e11f8743db23a (patch)
treea2905dab0bc63bad5408f5a69a5d065d0c1c0696 /src/compiler/scala/tools/nsc
parentf865e3b9a0f053c09669ca70c77d88456ed2b8ba (diff)
downloadscala-3e038d801cd3177ed1230eb7729e11f8743db23a.tar.gz
scala-3e038d801cd3177ed1230eb7729e11f8743db23a.tar.bz2
scala-3e038d801cd3177ed1230eb7729e11f8743db23a.zip
Removing more unneeded code.
Diffstat (limited to 'src/compiler/scala/tools/nsc')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala12
-rw-r--r--src/compiler/scala/tools/nsc/InterpreterLoop.scala12
-rw-r--r--src/compiler/scala/tools/nsc/MainInterpreter.scala13
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala27
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala23
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Completion.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala59
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Eval.scala33
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/FileCompletion.scala56
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ILoop.scala129
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala3
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala1
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala26
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/JLineReader.scala3
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/KeyBinding.scala39
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ProductCompletion.scala44
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala9
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/Runner.scala11
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala1
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/XMLCompletion.scala44
-rw-r--r--src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala44
-rw-r--r--src/compiler/scala/tools/nsc/package.scala5
-rw-r--r--src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala6
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassPath.scala83
-rw-r--r--src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala23
26 files changed, 16 insertions, 696 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
deleted file mode 100644
index 434f19f21b..0000000000
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package scala.tools.nsc
-
-import interpreter._
-import java.io._
-
-/** A compatibility stub.
- */
-@deprecated("Use a class in the scala.tools.nsc.interpreter package.", "2.9.0")
-class Interpreter(settings: Settings, out: PrintWriter) extends IMain(settings, out) {
- def this(settings: Settings) = this(settings, new NewLinePrintWriter(new ConsoleWriter, true))
- def this() = this(new Settings())
-} \ No newline at end of file
diff --git a/src/compiler/scala/tools/nsc/InterpreterLoop.scala b/src/compiler/scala/tools/nsc/InterpreterLoop.scala
deleted file mode 100644
index a0be3f4fdb..0000000000
--- a/src/compiler/scala/tools/nsc/InterpreterLoop.scala
+++ /dev/null
@@ -1,12 +0,0 @@
-package scala.tools.nsc
-
-import interpreter._
-import java.io._
-
-/** A compatibility stub.
- */
-@deprecated("Use a class in the scala.tools.nsc.interpreter package.", "2.9.0")
-class InterpreterLoop(in0: Option[BufferedReader], out: PrintWriter) extends ILoop(in0, out) {
- def this(in0: BufferedReader, out: PrintWriter) = this(Some(in0), out)
- def this() = this(None, new PrintWriter(scala.Console.out))
-}
diff --git a/src/compiler/scala/tools/nsc/MainInterpreter.scala b/src/compiler/scala/tools/nsc/MainInterpreter.scala
deleted file mode 100644
index 5d190bbe14..0000000000
--- a/src/compiler/scala/tools/nsc/MainInterpreter.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Lex Spoon
- */
-
-package scala.tools.nsc
-
-import interpreter._
-
-@deprecated("Use a class in the scala.tools.nsc.interpreter package.", "2.9.0")
-object MainInterpreter {
- def main(args: Array[String]): Unit = new ILoop main args
-}
diff --git a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
index 3a605975f4..605ecee6c7 100644
--- a/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/AbstractFileClassLoader.scala
@@ -19,11 +19,6 @@ class AbstractFileClassLoader(root: AbstractFile, parent: ClassLoader)
extends ClassLoader(parent)
with ScalaClassLoader
{
- // private val defined = mutable.Map[String, Class[_]]()
-
- override protected def trace =
- sys.props contains "scala.debug.classloader"
-
protected def classNameToPath(name: String): String =
if (name endsWith ".class") name
else name.replace('.', '/') + ".class"
@@ -68,29 +63,13 @@ class AbstractFileClassLoader(root: AbstractFile, parent: ClassLoader)
case null => super.classBytes(name)
case file => file.toByteArray
}
- override def loadClass(name: String, resolve: Boolean) = {
- classLoaderLog("load " + name + ".")
- super.loadClass(name, resolve)
- }
override def findClass(name: String): JClass = {
val bytes = classBytes(name)
- classLoaderLog("find %s: %s".format(name,
- if (bytes.isEmpty) "failed."
- else bytes.size + " bytes."
- ))
- if (bytes.isEmpty)
+ if (bytes.length == 0)
throw new ClassNotFoundException(name)
- else {
- val clazz = defineClass(name, bytes, 0, bytes.length)
- // defined(name) = clazz
- clazz
- }
+ else
+ defineClass(name, bytes, 0, bytes.length)
}
- // Don't know how to construct an URL for something which exists only in memory
- // override def getResource(name: String): URL = findAbstractFile(name) match {
- // case null => super.getResource(name)
- // case file => new URL(...)
- // }
private val packages = mutable.Map[String, Package]()
diff --git a/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala b/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala
index 453b106808..fc68998225 100644
--- a/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/CodeHandlers.scala
@@ -17,29 +17,9 @@ import scala.util.control.ControlThrowable
trait CodeHandlers[T] {
self =>
-/*
- // A declaration introduces names and assigns them types.
- // It can form part of a class definition (§5.1) or of a refinement in a compound type (§3.2.7).
- // (Ed: aka abstract members.)
- //
- // ‘val’ ValDcl | ‘var’ VarDcl | ‘def’ FunDcl | ‘type’ {nl} TypeDcl
- def decl(code: String): T
-
- // A definition introduces names that denote terms or types.
- // It can form part of an object or class definition or it can be local to a block.
- // (Ed: aka concrete members.)
- //
- // ‘val’ PatDef | ‘var’ VarDef | ‘def’ FunDef | ‘type’ {nl} TypeDef |
- // [‘case’] ‘class’ ClassDef | [‘case’] ‘object’ ObjectDef | ‘trait’ TraitDef
- def defn(code: String): T
-*/
-
// Expressions are composed of operators and operands.
def expr(code: String): T
- // An import clause has the form import p.I where p is a stable identifier (§3.1) and I is an import expression.
- def impt(code: String): T
-
// Statements occur as parts of blocks and templates.
// A statement can be an import, a definition or an expression, or it can be empty.
// Statements used in the template of a class definition can also be declarations.
@@ -54,10 +34,7 @@ trait CodeHandlers[T] {
case _: NoSuccess => Nil
}
- // def decl(code: String) = try Some(self.decl(code)) catch handler
- // def defn(code: String) = try Some(self.defn(code)) catch handler
def expr(code: String) = try Some(self.expr(code)) catch handler
- def impt(code: String) = try Some(self.impt(code)) catch handler
def stmt(code: String) = try Some(self.stmt(code)) catch handler
def stmts(code: String) = try (self.stmts(code) map (x => Some(x))) catch handlerSeq
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/Completion.scala b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
index 86f48b9d69..7a3e1913b6 100644
--- a/src/compiler/scala/tools/nsc/interpreter/Completion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/Completion.scala
@@ -14,13 +14,11 @@ import Completion._
trait Completion {
type ExecResult
def resetVerbosity(): Unit
- def execute(line: String): Option[ExecResult]
def completer(): ScalaCompleter
}
object NoCompletion extends Completion {
type ExecResult = Nothing
def resetVerbosity() = ()
- def execute(line: String) = None
def completer() = NullCompleter
}
@@ -44,8 +42,6 @@ object Completion {
&& !(code startsWith "./")
&& !(code startsWith "..")
)
- private val pathStarts = """/ \ ./ ../ ~/""" split ' ' toSet
- def looksLikePath(code: String) = (code != null) && (pathStarts exists (code startsWith _))
object Forwarder {
def apply(forwardTo: () => Option[CompletionAware]): CompletionAware = new CompletionAware {
def completions(verbosity: Int) = forwardTo() map (_ completions verbosity) getOrElse Nil
diff --git a/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala b/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala
index c33675a83a..b3bbeb3169 100644
--- a/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/CompletionAware.scala
@@ -12,40 +12,15 @@ import scala.reflect.NameTransformer
* will supply their own candidates and resolve their own paths.
*/
trait CompletionAware {
- /** The delimiters which are meaningful when this CompletionAware
- * object is in control.
- */
- // TODO
- // def delimiters(): List[Char] = List('.')
-
/** The complete list of unqualified Strings to which this
* object will complete.
*/
def completions(verbosity: Int): List[String]
- /** Default filter to apply to completions.
- */
- def filterNotFunction(s: String): Boolean = false
-
- /** Default sort.
- */
- def sortFunction(s1: String, s2: String): Boolean = s1 < s2
-
- /** Default map.
- */
- def mapFunction(s: String) = NameTransformer decode s
-
/** The next completor in the chain.
*/
def follow(id: String): Option[CompletionAware] = None
- /** What to return if this completion is given as a command. It
- * returns None by default, which means to allow the repl to interpret
- * the line normally. Returning Some(_) means the line will never
- * reach the scala interpreter.
- */
- def execute(id: String): Option[Any] = None
-
/** A list of useful information regarding a specific uniquely
* identified completion. This is specifically written for the
* following situation, but should be useful elsewhere too:
@@ -75,45 +50,13 @@ trait CompletionAware {
else comps
else follow(parsed.bufferHead) map (_ completionsFor parsed.bufferTail) getOrElse Nil
- results filterNot filterNotFunction map mapFunction sortWith (sortFunction _)
- }
-
- /** TODO - unify this and completionsFor under a common traverser.
- */
- def executionFor(parsed: Parsed): Option[Any] = {
- import parsed._
-
- if (isUnqualified && !isLastDelimiter && (completions(verbosity) contains buffer)) execute(buffer)
- else if (!isQualified) None
- else follow(bufferHead) flatMap (_ executionFor bufferTail)
+ results.sorted
}
}
object CompletionAware {
val Empty = new CompletionAware { def completions(verbosity: Int) = Nil }
- /** Artificial object demonstrating completion */
- // lazy val replVars = CompletionAware(
- // Map[String, CompletionAware](
- // "ids" -> CompletionAware(() => unqualifiedIds, completionAware _),
- // "synthVars" -> CompletionAware(() => allBoundNames filter isSynthVarName map (_.toString)),
- // "types" -> CompletionAware(() => allSeenTypes map (_.toString)),
- // "implicits" -> CompletionAware(() => allImplicits map (_.toString))
- // )
- // )
-
- // class Forwarder(underlying: CompletionAware) extends CompletionAware {
- // override def completions() = underlying.completions()
- // override def filterNotFunction(s: String) = underlying.filterNotFunction(s)
- // override def sortFunction(s1: String, s2: String) = underlying.sortFunction(s1, s2)
- // override def mapFunction(s: String) = underlying.mapFunction(s)
- // override def follow(id: String) = underlying.follow(id)
- // override def execute(id: String) = underlying.execute(id)
- // override def completionsFor(parsed: Parsed) = underlying.completionsFor(parsed)
- // override def executionFor(parsed: Parsed) = underlying.executionFor(parsed)
- // }
- //
-
def unapply(that: Any): Option[CompletionAware] = that match {
case x: CompletionAware => Some((x))
case _ => None
diff --git a/src/compiler/scala/tools/nsc/interpreter/Eval.scala b/src/compiler/scala/tools/nsc/interpreter/Eval.scala
deleted file mode 100644
index 6a59cbb6bf..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/Eval.scala
+++ /dev/null
@@ -1,33 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-trait Eval {
- /** Executes code looking for an implicit conversion from the type
- * of the given identifier to CompletionAware.
- */
- // def completionAwareImplicit[T](id: String) = {
- // val f1string = "%s => %s".format(typeForIdent(id).get, classOf[CompletionAware].getName)
- // val code = """{
- // | def f(implicit x: (%s) = null): %s = x
- // | val f1 = f
- // | if (f1 == null) None else Some(f1(%s))
- // |}""".stripMargin.format(f1string, f1string, id)
- //
- // evalExpr[Option[CompletionAware]](code)
- // }
-
- // Coming soon
- // implicit def string2liftedcode(s: String): LiftedCode = new LiftedCode(s)
- // case class LiftedCode(code: String) {
- // val lifted: String = {
- // beQuietDuring { interpret(code) }
- // eval2[String]("({ " + code + " }).toString")
- // }
- // def >> : String = lifted
- // }
-} \ No newline at end of file
diff --git a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
index 4a36a4b6f3..79b429e26a 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ExprTyper.scala
@@ -32,8 +32,6 @@ trait ExprTyper {
def defns(code: String) = stmts(code) collect { case x: DefTree => x }
def expr(code: String) = applyRule(code, _.expr())
- def impt(code: String) = applyRule(code, _.importExpr())
- def impts(code: String) = applyRule(code, _.importClause())
def stmts(code: String) = applyRule(code, _.templateStats())
def stmt(code: String) = stmts(code).last // guaranteed nonempty
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/FileCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/FileCompletion.scala
deleted file mode 100644
index e1eb938b3c..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/FileCompletion.scala
+++ /dev/null
@@ -1,56 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-/** TODO
- * Spaces, dots, and other things in filenames are not correctly handled.
- * space-escaping, knowing when we're inside quotes, etc. would be nice.
- */
-
-import io.{ Directory, Path }
-
-/** This isn't 100% clean right now, but it works and is simple. Rather
- * than delegate to new objects on each '/' in the path, we treat the
- * buffer like a path and process it directly.
- */
-object FileCompletion {
- def executionFor(buffer: String): Option[Path] = {
- Some(Directory.Home match {
- case Some(d) if buffer startsWith "~" => d / buffer.tail
- case _ => Path(buffer)
- }) filter (_.exists)
- }
-
- private def fileCompletionForwarder(buffer: String, where: Directory): List[String] = {
- completionsFor(where.path + buffer) map (_ stripPrefix where.path) toList
- }
-
- private def homeCompletions(buffer: String): List[String] = {
- require(buffer startsWith "~/")
- val home = Directory.Home getOrElse (return Nil)
- fileCompletionForwarder(buffer.tail, home) map ("~" + _)
- }
- private def cwdCompletions(buffer: String): List[String] = {
- require(buffer startsWith "./")
- val cwd = Directory.Current getOrElse (return Nil)
- fileCompletionForwarder(buffer.tail, cwd) map ("." + _)
- }
-
- def completionsFor(buffer: String): List[String] =
- if (buffer startsWith "~/") homeCompletions(buffer)
- else if (buffer startsWith "./") cwdCompletions(buffer)
- else {
- val p = Path(buffer)
- val (dir, stub) =
- // don't want /foo/. expanding "."
- if (p.name == ".") (p.parent, ".")
- else if (p.isDirectory) (p.toDirectory, "")
- else (p.parent, p.name)
-
- dir.list filter (_.name startsWith stub) map (_.path) toList
- }
-} \ No newline at end of file
diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
index 4badb90968..f236ee8031 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ILoop.scala
@@ -103,16 +103,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
def isAsync = !settings.Yreplsync.value
lazy val power = new Power(intp, new StdReplVals(this))
-
- // TODO
- // object opt extends AestheticSettings
- //
- @deprecated("Use `intp` instead.", "2.9.0")
- def interpreter = intp
-
- @deprecated("Use `intp` instead.", "2.9.0")
- def interpreter_= (i: Interpreter): Unit = intp = i
-
def history = in.history
/** The context class loader at the time this object was created */
@@ -264,14 +254,12 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
cmd("imports", "[name name ...]", "show import history, identifying sources of names", importsCommand),
cmd("implicits", "[-v]", "show the implicits in scope", implicitsCommand),
cmd("javap", "<path|class>", "disassemble a file or class name", javapCommand),
- nullary("keybindings", "show how ctrl-[A-Z] and other keys are bound", keybindingsCommand),
cmd("load", "<path>", "load and interpret a Scala file", loadCommand),
nullary("paste", "enter paste mode: all input up to ctrl-D compiled together", pasteCommand),
nullary("power", "enable power user mode", powerCmd),
nullary("quit", "exit the interpreter", () => Result(false, None)),
nullary("replay", "reset execution and replay all previous commands", replay),
nullary("reset", "reset the repl to its initial state, forgetting all session entries", resetCommand),
- // nullary("reset", "reset the interpreter, forgetting session values but retaining session types", replay),
shCommand,
nullary("silent", "disable/enable automatic printing of results", verbosity),
cmd("type", "[-v] <expr>", "display the type of an expression without evaluating it", typeCommand),
@@ -280,31 +268,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
/** Power user commands */
lazy val powerCommands: List[LoopCommand] = List(
- nullary("dump", "displays a view of the interpreter's internal state", dumpCommand),
- nullary("vals", "gives information about the power mode repl vals", valsCommand),
- cmd("phase", "<phase>", "set the implicit phase for power commands", phaseCommand),
- cmd("wrap", "<method>", "name of method to wrap around each repl line", wrapCommand) withLongHelp ("""
- |:wrap
- |:wrap clear
- |:wrap <method>
- |
- |Installs a wrapper around each line entered into the repl.
- |Currently it must be the simple name of an existing method
- |with the specific signature shown in the following example.
- |
- |def timed[T](body: => T): T = {
- | val start = System.nanoTime
- | try body
- | finally println((System.nanoTime - start) + " nanos elapsed.")
- |}
- |:wrap timed
- |
- |If given no argument, :wrap names the wrapper installed.
- |An argument of clear will remove the wrapper if any is active.
- |Note that wrappers do not compose (a new one replaces the old
- |one) and also that the :phase command uses the same machinery,
- |so setting :wrap will clear any :phase setting.
- """.stripMargin.trim)
+ cmd("phase", "<phase>", "set the implicit phase for power commands", phaseCommand)
)
private def dumpCommand(): Result = {
@@ -485,14 +449,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
else res.show()
}
}
- private def keybindingsCommand(): Result = {
- if (in.keyBindings.isEmpty) "Key bindings unavailable."
- else {
- echo("Reading jline properties for default key bindings.")
- echo("Accuracy not guaranteed: treat this as a guideline only.\n")
- in.keyBindings foreach (x => echo ("" + x))
- }
- }
+
private def wrapCommand(line: String): Result = {
def failMsg = "Argument to :wrap must be the name of a method with signature [T](=> T): T"
onIntp { intp =>
@@ -516,10 +473,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
intp setExecutionWrapper intp.pathToTerm(wrapper)
"Set wrapper to '" + wrapper + "'"
case tp =>
- failMsg + (
- if (tp == NoType) "\nFound: <unknown>"
- else "\nFound: <unknown>"
- )
+ failMsg + "\nFound: <unknown>"
}
case _ => failMsg
}
@@ -528,18 +482,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
private def pathToPhaseWrapper = intp.pathToTerm("$r") + ".phased.atCurrent"
private def phaseCommand(name: String): Result = {
- // This line crashes us in TreeGen:
- //
- // if (intp.power.phased set name) "..."
- //
- // Exception in thread "main" java.lang.AssertionError: assertion failed: ._7.type
- // at scala.Predef$.assert(Predef.scala:99)
- // at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:69)
- // at scala.tools.nsc.ast.TreeGen.mkAttributedQualifier(TreeGen.scala:44)
- // at scala.tools.nsc.ast.TreeGen.mkAttributedRef(TreeGen.scala:101)
- // at scala.tools.nsc.ast.TreeGen.mkAttributedStableRef(TreeGen.scala:143)
- //
- // But it works like so, type annotated.
val phased: Phased = power.phased
import phased.NoPhaseName
@@ -815,10 +757,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
})
}
- def runCompletion =
- try in.completion execute code map (intp bindSyntheticValue _)
- catch { case ex: Exception => None }
-
/** Here we place ourselves between the user and the interpreter and examine
* the input they are ostensibly submitting. We intervene in several cases:
*
@@ -840,25 +778,8 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
// line comment, do nothing
None
}
- /** Due to my accidentally letting file completion execution sneak ahead
- * of actual parsing this now operates in such a way that the scala
- * interpretation always wins. However to avoid losing useful file
- * completion I let it fail and then check the others. So if you
- * type /tmp it will echo a failure and then give you a Directory object.
- * It's not pretty: maybe I'll implement the silence bits I need to avoid
- * echoing the failure.
- */
- else if (intp isParseable code) {
- val (code, result) = reallyInterpret
- if (power != null && code == IR.Error)
- runCompletion
-
- result
- }
- else runCompletion match {
- case Some(_) => None // completion hit: avoid the latent error
- case _ => reallyInterpret._2 // trigger the latent error
- }
+ else
+ reallyInterpret._2
}
// runs :load `file` on any files passed via -i
@@ -937,7 +858,7 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
/** process command-line arguments and do as they request */
def process(args: Array[String]): Boolean = {
- val command = new CommandLine(args.toList, msg => echo("scala: " + msg))
+ val command = new CommandLine(args.toList, echo)
def neededHelp(): String =
(if (command.settings.help.value) command.usageMsg + "\n" else "") +
(if (command.settings.Xhelp.value) command.xusageMsg + "\n" else "")
@@ -948,16 +869,6 @@ class ILoop(in0: Option[BufferedReader], protected val out: JPrintWriter)
case help => echoNoNL(help) ; true
}
}
-
- @deprecated("Use `process` instead", "2.9.0")
- def main(args: Array[String]): Unit = {
- if (isReplDebug)
- System.out.println(new java.util.Date)
-
- process(args)
- }
- @deprecated("Use `process` instead", "2.9.0")
- def main(settings: Settings): Unit = process(settings)
}
object ILoop {
@@ -1019,32 +930,4 @@ object ILoop {
}
}
def run(lines: List[String]): String = run(lines map (_ + "\n") mkString)
-
- // provide the enclosing type T
- // in order to set up the interpreter's classpath and parent class loader properly
- def breakIf[T: ClassTag](assertion: => Boolean, args: NamedParam*): Unit =
- if (assertion) break[T](args.toList)
-
- // start a repl, binding supplied args
- def break[T: ClassTag](args: List[NamedParam]): Unit = savingContextLoader {
- val msg = if (args.isEmpty) "" else " Binding " + args.size + " value%s.".format(
- if (args.size == 1) "" else "s"
- )
- echo("Debug repl starting." + msg)
- val repl = new ILoop {
- override def prompt = "\ndebug> "
- }
- repl.settings = new Settings(echo)
- repl.settings.embeddedDefaults[T]
- repl.createInterpreter()
- repl.in = new JLineReader(new JLineCompletion(repl))
-
- // rebind exit so people don't accidentally call sys.exit by way of predef
- repl.quietRun("""def exit = println("Type :quit to resume program execution.")""")
- args foreach (p => repl.bind(p.name, p.tpe, p.value))
- repl.loop()
-
- echo("\nDebug repl exiting.")
- repl.closeInterpreter()
- }
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index c74da69ee9..956e282b26 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -308,9 +308,6 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends
_classLoader
}
private class TranslatingClassLoader(parent: ClassLoader) extends AbstractFileClassLoader(virtualDirectory, parent) {
- private[IMain] var traceClassLoading = isReplTrace
- override protected def trace = super.trace || traceClassLoading
-
/** Overridden here to try translating a simple name to the generated
* class name if the original attempt fails. This method is used by
* getResourceAsStream as well as findClass.
diff --git a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
index 55706f4fd2..241ba5fa4a 100644
--- a/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/InteractiveReader.scala
@@ -22,7 +22,6 @@ trait InteractiveReader {
def history: History
def completion: Completion
- def keyBindings: List[KeyBinding]
def eraseLine(): Unit
def redrawLine(): Unit
def currentLine: String
diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala
index 795b2e3678..b1e6a9d7d9 100644
--- a/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/JLineCompletion.scala
@@ -279,24 +279,6 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput
if (parsed.isEmpty) xs map ("." + _) else xs
}
- // chasing down results which won't parse
- // This used to work fine, now it reports a type error before any
- // exception gets to us. See SI-5657. Don't have time to deal with
- // it, so disabling everything.
- def execute(line: String): Option[ExecResult] = {
- return None // disabled
-
- val parsed = Parsed(line)
- def noDotOrSlash = line forall (ch => ch != '.' && ch != '/')
-
- if (noDotOrSlash) None // we defer all unqualified ids to the repl.
- else {
- (ids executionFor parsed) orElse
- (rootClass executionFor parsed) orElse
- (FileCompletion executionFor line)
- }
- }
-
// generic interface for querying (e.g. interpreter loop, testing)
def completions(buf: String): List[String] =
topLevelFor(Parsed.dotted(buf + ".", buf.length + 1))
@@ -360,15 +342,9 @@ class JLineCompletion(val intp: IMain) extends Completion with CompletionOutput
if (!looksLikeInvocation(buf)) None
else tryCompletion(Parsed.dotted(buf drop 1, cursor), lastResultFor)
- def regularCompletion = tryCompletion(mkDotted, topLevelFor)
- def fileCompletion =
- if (!looksLikePath(buf)) None
- else tryCompletion(mkUndelimited, FileCompletion completionsFor _.buffer)
-
def tryAll = (
lastResultCompletion
- orElse regularCompletion
- orElse fileCompletion
+ orElse tryCompletion(mkDotted, topLevelFor)
getOrElse Candidates(cursor, Nil)
)
diff --git a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
index 99f6b627eb..758f6e2abc 100644
--- a/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/JLineReader.scala
@@ -22,9 +22,6 @@ class JLineReader(_completion: => Completion) extends InteractiveReader {
lazy val completion = _completion
lazy val history: JLineHistory = JLineHistory()
- lazy val keyBindings =
- try KeyBinding parse slurp(term.getDefaultBindings)
- catch { case _: Exception => Nil }
private def term = consoleReader.getTerminal()
def reset() = term.reset()
diff --git a/src/compiler/scala/tools/nsc/interpreter/KeyBinding.scala b/src/compiler/scala/tools/nsc/interpreter/KeyBinding.scala
deleted file mode 100644
index a7ca3a77f3..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/KeyBinding.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-case class KeyBinding(name: String, code: Int, aliases: List[String], description: String) {
- def nameString = if (aliases.nonEmpty) aliases mkString ", " else name
- override def toString = "%3d %s: %s".format(code, nameString, description)
-}
-
-object KeyBinding {
- def parse(bindings: String): List[KeyBinding] = {
- def loop(xs: List[String]): List[KeyBinding] = {
- val (comment, lines) = xs span (_ startsWith "#")
- val description = comment map (_ drop 1 trim) mkString " "
- val (aliases, desc) = description span (_ != ':') match {
- case (x, y) => (
- x split ',' map (_.trim) toList,
- if (y == "") "" else y.tail.trim
- )
- }
- lines match {
- case Nil => Nil
- case hd :: tl =>
- val kb = (hd indexOf '=') match {
- case -1 => KeyBinding(hd, -1, aliases, desc)
- case idx => KeyBinding(hd drop idx + 1, hd take idx toInt, aliases, desc)
- }
- kb :: loop(tl)
- }
- }
- // This is verrrrrrrry specific to the current contents
- // of the keybindings.properties in jline.
- loop(bindings split "\\n" map (_.trim) dropWhile (_ != "") filterNot (_ == "") toList) sortBy (_.code)
- }
-}
diff --git a/src/compiler/scala/tools/nsc/interpreter/ProductCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/ProductCompletion.scala
deleted file mode 100644
index dc4582eb17..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/ProductCompletion.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-class SeqCompletion[T](elems: Seq[T]) extends CompletionAware {
- lazy val completions = elems.indices.toList map ("(%d)" format _)
- def completions(verbosity: Int) = completions
- private def elemAt(name: String) =
- if (completions contains name) Some(elems(name drop 1 dropRight 1 toInt)) else None
-
- override def execute(name: String) = elemAt(name)
- override def follow(name: String) = elemAt(name) map (x => ProductCompletion(x))
-}
-
-/** TODO - deal with non-case products by giving them _1 _2 etc. */
-class ProductCompletion(root: Product) extends CompletionAware {
- lazy val caseFields: List[Any] = root.productIterator.toList
- lazy val caseNames: List[String] = ByteCode caseParamNamesForPath root.getClass.getName getOrElse Nil
- private def isValid = caseFields.length == caseNames.length
-
- private def fieldForName(s: String) = (completions indexOf s) match {
- case idx if idx > -1 && isValid => Some(caseFields(idx))
- case _ => None
- }
-
- lazy val completions = caseNames
- def completions(verbosity: Int) = completions
- override def execute(name: String) = fieldForName(name)
- override def follow(name: String) = fieldForName(name) map (x => ProductCompletion(x))
-}
-
-object ProductCompletion {
- /** TODO: other traversables. */
- def apply(elem: Any): CompletionAware = elem match {
- case x: Seq[_] => new SeqCompletion[Any](x)
- case x: Product => new ProductCompletion(x)
- // case x: Map[_, _] =>
- case _ => CompletionAware.Empty
- }
-}
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala b/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala
index 175f6263ad..0c9f4fcd47 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReplStrings.scala
@@ -11,15 +11,6 @@ import scala.PartialFunction.cond
import scala.reflect.internal.Chars
trait ReplStrings {
- // Longest common prefix
- def longestCommonPrefix(xs: List[String]): String = {
- if (xs.isEmpty || xs.contains("")) ""
- else xs.head.head match {
- case ch =>
- if (xs.tail forall (_.head == ch)) "" + ch + longestCommonPrefix(xs map (_.tail))
- else ""
- }
- }
/** Convert a string into code that can recreate the string.
* This requires replacing all special characters by escape
* codes. It does not add the surrounding " marks. */
diff --git a/src/compiler/scala/tools/nsc/interpreter/Runner.scala b/src/compiler/scala/tools/nsc/interpreter/Runner.scala
deleted file mode 100644
index f9f75da3c6..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/Runner.scala
+++ /dev/null
@@ -1,11 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-object Runner {
- def main(args: Array[String]): Unit = new ILoop process args
-}
diff --git a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
index 992bef8056..a57b047bc0 100644
--- a/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/SimpleReader.scala
@@ -18,7 +18,6 @@ extends InteractiveReader
{
val history = NoHistory
val completion = NoCompletion
- val keyBindings: List[KeyBinding] = Nil
def init() = ()
def reset() = ()
diff --git a/src/compiler/scala/tools/nsc/interpreter/XMLCompletion.scala b/src/compiler/scala/tools/nsc/interpreter/XMLCompletion.scala
deleted file mode 100644
index 9979814afb..0000000000
--- a/src/compiler/scala/tools/nsc/interpreter/XMLCompletion.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package interpreter
-
-import xml.{ XML, Group, Node, NodeSeq }
-import XMLCompletion._
-import scala.collection.{ mutable, immutable }
-
-class XMLCompletion(root: Node) extends CompletionAware {
- private val nodeCache = new mutable.HashMap[String, Node]
- private def getNode(s: String): Option[Node] = {
- completions // make sure cache is populated
- nodeCache get s
- }
-
- lazy val completions: List[String] = {
- def children = root.child.toList
- def uniqueTags = children groupBy (_.label) filter (_._2.size == 1) map (_._1)
- val uniqs = uniqueTags.toList
-
- children.foldLeft(List[String]())((res, node) => {
- val name = node.label
- def count = res filter (_ startsWith (name + "[")) size // ]
- val suffix = if (uniqs contains name) "" else "[%d]" format (count + 1)
- val s = name + suffix
-
- nodeCache(s) = node
-
- s :: res
- }).sorted
- }
- def completions(verbosity: Int) = completions
-
- override def execute(id: String) = getNode(id)
- override def follow(id: String) = getNode(id) map (x => new XMLCompletion(x))
-}
-
-object XMLCompletion {
- def apply(x: Node) = new XMLCompletion(x)
-}
diff --git a/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala b/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
deleted file mode 100644
index c9ed535841..0000000000
--- a/src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala
+++ /dev/null
@@ -1,44 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2011 LAMP/EPFL
- * @author Paul Phillips
- */
-
-package scala.tools.nsc
-package io
-
-import java.net.{ URL, URLClassLoader }
-import java.io.IOException
-import collection.JavaConverters._
-
-/** A convenience class for finding the jar with the bytecode for
- * a given Class object and similar common tasks.
- */
-class ClassAndJarInfo[T: ClassTag] {
- val tag = classTag[T]
- def clazz = tag.erasure
- def internalName = clazz.getName.replace('.', '/')
-
- def resourceURL = new URLClassLoader(Array[URL]()) getResource internalName + ".class"
-
- def baseOfPath(path: String) = path indexOf '!' match {
- case -1 => path stripSuffix internalName + ".class"
- case idx => path take idx
- }
-
- def simpleClassName = clazz.getName split """[$.]""" last
- def classUrl = clazz getResource simpleClassName + ".class"
- def codeSource = protectionDomain.getCodeSource()
- def jarManifest = (
- try new JManifest(jarManifestUrl.openStream())
- catch { case _: IOException => new JManifest() }
- )
- def jarManifestMainAttrs = jarManifest.getMainAttributes().asScala
- def jarManifestUrl = new URL(baseOfPath("" + classUrl) + "!/META-INF/MANIFEST.MF")
- def locationFile = File(locationUrl.toURI.getPath())
- def locationUrl = if (codeSource == null) new URL("file:///") else codeSource.getLocation()
- def protectionDomain = clazz.getProtectionDomain()
- def rootClasspath = rootPossibles find (_.exists)
- def rootFromLocation = Path(locationUrl.toURI.getPath())
- def rootFromResource = Path(baseOfPath(classUrl.getPath) stripPrefix "file:")
- def rootPossibles = Iterator(rootFromResource, rootFromLocation)
-}
diff --git a/src/compiler/scala/tools/nsc/package.scala b/src/compiler/scala/tools/nsc/package.scala
index a908062b2f..88d600c113 100644
--- a/src/compiler/scala/tools/nsc/package.scala
+++ b/src/compiler/scala/tools/nsc/package.scala
@@ -6,11 +6,6 @@
package scala.tools
package object nsc {
- @deprecated("Use a class in the scala.tools.nsc.interpreter package.", "2.9.0")
- type InterpreterSettings = interpreter.ISettings
- @deprecated("Use a class in the scala.tools.nsc.interpreter package.", "2.9.0")
- val InterpreterResults = interpreter.Results
-
type Phase = scala.reflect.internal.Phase
val NoPhase = scala.reflect.internal.NoPhase
diff --git a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
index 8daad8a2ac..9cffb6a1e1 100644
--- a/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
+++ b/src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala
@@ -149,7 +149,7 @@ abstract class ExplicitOuter extends InfoTransform
if (sym.owner.isTrait && ((sym hasFlag (ACCESSOR | SUPERACCESSOR)) || sym.isModule)) { // 5
sym.makeNotPrivate(sym.owner)
}
- if (sym.owner.isTrait) sym setNotFlag PROTECTED // 6
+ if (sym.owner.isTrait && sym.isProtected) sym setFlag notPROTECTED // 6
if (sym.isClassConstructor && isInner(sym.owner)) { // 1
val p = sym.newValueParameter(innerClassConstructorParamName, sym.pos)
.setInfo(sym.owner.outerClass.thisType)
@@ -448,8 +448,8 @@ abstract class ExplicitOuter extends InfoTransform
override def transform(tree: Tree): Tree = {
val sym = tree.symbol
if (sym != null && sym.isType) { //(9)
- sym setNotFlag PRIVATE
- sym setNotFlag PROTECTED
+ if (sym.isPrivate) sym setFlag notPRIVATE
+ if (sym.isProtected) sym setFlag notPROTECTED
}
tree match {
case Template(parents, self, decls) =>
diff --git a/src/compiler/scala/tools/nsc/util/ClassPath.scala b/src/compiler/scala/tools/nsc/util/ClassPath.scala
index 48ec941b50..404490bd49 100644
--- a/src/compiler/scala/tools/nsc/util/ClassPath.scala
+++ b/src/compiler/scala/tools/nsc/util/ClassPath.scala
@@ -9,7 +9,7 @@ package util
import java.net.URL
import scala.collection.{ mutable, immutable }
-import io.{ File, Directory, Path, Jar, AbstractFile, ClassAndJarInfo }
+import io.{ File, Directory, Path, Jar, AbstractFile }
import scala.tools.util.StringOps.splitWhere
import Jar.isJarOrZip
import File.pathSeparator
@@ -23,16 +23,6 @@ import java.net.MalformedURLException
* @author Stepan Koltsov
*/
object ClassPath {
- def scalaLibrary = locate[Option[_]]
- def scalaCompiler = locate[Global]
-
- def infoFor[T](value: T) = info(value.getClass)
- def info[T](clazz: Class[T]) = new ClassAndJarInfo()(ClassTag[T](clazz))
- def info[T: ClassTag] = new ClassAndJarInfo[T]
- def locate[T: ClassTag] = info[T].rootClasspath
- def locateJar[T: ClassTag] = info[T].rootPossibles find (x => isJarOrZip(x)) map (x => File(x))
- def locateDir[T: ClassTag] = info[T].rootPossibles find (_.isDirectory) map (_.toDirectory)
-
/** Expand single path entry */
private def expandS(pattern: String): List[String] = {
val wildSuffix = File.separator + "*"
@@ -54,26 +44,6 @@ object ClassPath {
else List(pattern)
}
- /** Return duplicated classpath entries as
- * (name, list of origins)
- * in the order they occur on the path.
- */
- // def findDuplicates(cp: ClassPath[_]) = {
- // def toFullName(x: (String, _, cp.AnyClassRep)) = x._1 + "." + x._3.name
- // def toOriginString(x: ClassPath[_]) = x.origin getOrElse x.name
- //
- // /** Flatten everything into tuples, recombine grouped by name, filter down to 2+ entries. */
- // val flattened = (
- // for ((pkgName, pkg) <- cp.allPackagesWithNames ; clazz <- pkg.classes) yield
- // (pkgName, pkg, clazz)
- // )
- // val multipleAppearingEntries = flattened groupBy toFullName filter (_._2.size > 1)
- //
- // /** Extract results. */
- // for (name <- flattened map toFullName distinct ; dups <- multipleAppearingEntries get name) yield
- // (name, dups map { case (_, cp, _) => toOriginString(cp) })
- // }
-
/** Split classpath using platform-dependent path separator */
def split(path: String): List[String] = (path split pathSeparator).toList filterNot (_ == "") distinct
@@ -240,26 +210,6 @@ abstract class ClassPath[T] {
def packages: IndexedSeq[ClassPath[T]]
def sourcepaths: IndexedSeq[AbstractFile]
- /** Information which entails walking the tree. This is probably only
- * necessary for tracking down problems - it's normally not used.
- */
- // def allPackages: List[ClassPath[T]] = packages ::: (packages flatMap (_.allPackages))
- // def allPackageNames: List[String] = {
- // def subpackages(prefix: String, cp: ClassPath[T]): List[String] = (
- // (cp.packages map (prefix + _.name)) :::
- // (cp.packages flatMap (x => subpackages(prefix + x.name + ".", x)))
- // )
- // subpackages("", this)
- // }
- // def allPackagesWithNames: List[(String, ClassPath[T])] = {
- // val root = packages map (p => p.name -> p)
- // val subs =
- // for ((prefix, p) <- root ; (k, v) <- p.allPackagesWithNames) yield
- // (prefix + "." + k, v)
- //
- // root ::: subs
- // }
-
/**
* Represents classes which can be loaded with a ClassfileLoader/MsilFileLoader
* and / or a SourcefileLoader.
@@ -431,41 +381,10 @@ extends ClassPath[T] {
}
new MergedClassPath[T](newEntries, context)
}
- //
- // override def allPackages: List[ClassPath[T]] = entries flatMap (_.allPackages)
- // override def allPackageNames = entries flatMap (_.allPackageNames)
- // override def allPackagesWithNames = entries flatMap (_.allPackagesWithNames)
- //
- // def duplicatedClasses = {
- // def toFullName(x: (String, _, AnyClassRep)) = x._1 + "." + x._3.name
- //
- // /** Flatten everything into tuples, recombine grouped by name, filter down to 2+ entries. */
- // val flattened = (
- // for ((pkgName, pkg) <- allPackagesWithNames ; clazz <- pkg.classes) yield
- // (pkgName, pkg, clazz)
- // )
- // val multipleAppearingEntries = flattened groupBy toFullName filter (_._2.size > 1)
- //
- // /** Using original name list as reference point, return duplicated entries as
- // * (name, list of origins)
- // * in the order they occur on the path.
- // */
- // for (name <- flattened map toFullName distinct ; dups <- multipleAppearingEntries get name) yield
- // (name, dups map {
- // case (_, cp, _) if cp.origin.isDefined => cp.origin.get
- // case (_, cp, _) => cp.asURLs.mkString
- // })
- // }
- //
def show() {
println("ClassPath %s has %d entries and results in:\n".format(name, entries.size))
asClasspathString split ':' foreach (x => println(" " + x))
}
- // def showDuplicates() =
- // ClassPath findDuplicates this foreach {
- // case (name, xs) => println(xs.mkString(name + ":\n ", "\n ", "\n"))
- // }
- //
override def toString() = "merged classpath "+ entries.mkString("(", "\n", ")")
}
diff --git a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
index 47f759830e..4c7920d6b3 100644
--- a/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
+++ b/src/compiler/scala/tools/nsc/util/ScalaClassLoader.scala
@@ -24,14 +24,6 @@ trait HasClassPath {
* of java reflection.
*/
trait ScalaClassLoader extends JClassLoader {
- /** Override to see classloader activity traced */
- protected def trace: Boolean = false
- protected lazy val classLoaderUniqueId = "Cl#" + System.identityHashCode(this)
- protected def classLoaderLog(msg: => String) {
- if (trace)
- Console.err.println("[" + classLoaderUniqueId + "] " + msg)
- }
-
/** Executing an action with this classloader as context classloader */
def asContext[T](action: => T): T = {
val saved = contextLoader
@@ -53,18 +45,6 @@ trait ScalaClassLoader extends JClassLoader {
def create(path: String): AnyRef =
tryToInitializeClass[AnyRef](path) map (_.newInstance()) orNull
- override def findClass(name: String) = {
- val result = super.findClass(name)
- classLoaderLog("findClass(%s) = %s".format(name, result))
- result
- }
-
- override def loadClass(name: String, resolve: Boolean) = {
- val result = super.loadClass(name, resolve)
- classLoaderLog("loadClass(%s, %s) = %s".format(name, resolve, result))
- result
- }
-
def constructorsOf[T <: AnyRef : ClassTag]: List[Constructor[T]] =
classTag[T].erasure.getConstructors.toList map (_.asInstanceOf[Constructor[T]])
@@ -98,7 +78,6 @@ trait ScalaClassLoader extends JClassLoader {
case null => Nil
case p => p.loaderChain
})
- override def toString = classLoaderUniqueId
}
/** Methods for obtaining various classloaders.
@@ -171,7 +150,7 @@ object ScalaClassLoader {
classloaderURLs :+= url
super.addURL(url)
}
- def toLongString = urls.mkString("URLClassLoader(id=" + classLoaderUniqueId + "\n ", "\n ", "\n)\n")
+ def toLongString = urls.mkString("URLClassLoader(\n ", "\n ", "\n)\n")
}
def fromURLs(urls: Seq[URL], parent: ClassLoader = null): URLClassLoader =