summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/util/ClassFileLookup.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-05-05 23:10:03 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-05-05 23:10:03 +1000
commita46af82b025e0dde3714ab8cbe5e76afafd7ab18 (patch)
tree82ac025ce1e9d9789d0950823f625176e9b50877 /src/compiler/scala/tools/nsc/util/ClassFileLookup.scala
parent2726320779356be1829aa1715888872606aa819b (diff)
parent30d6fce50aba1d73173339b0add4808bc13b1c40 (diff)
downloadscala-a46af82b025e0dde3714ab8cbe5e76afafd7ab18.tar.gz
scala-a46af82b025e0dde3714ab8cbe5e76afafd7ab18.tar.bz2
scala-a46af82b025e0dde3714ab8cbe5e76afafd7ab18.zip
Merge pull request #5112 from lrytz/dropRecursiveClasspath
Remove legacy recursive classpath implementation
Diffstat (limited to 'src/compiler/scala/tools/nsc/util/ClassFileLookup.scala')
-rw-r--r--src/compiler/scala/tools/nsc/util/ClassFileLookup.scala78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/compiler/scala/tools/nsc/util/ClassFileLookup.scala b/src/compiler/scala/tools/nsc/util/ClassFileLookup.scala
deleted file mode 100644
index 5d8831a607..0000000000
--- a/src/compiler/scala/tools/nsc/util/ClassFileLookup.scala
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2014 Contributor. All rights reserved.
- */
-package scala.tools.nsc.util
-
-import scala.tools.nsc.Settings
-import scala.tools.nsc.classpath.{AggregateFlatClassPath, FlatClassPath, FlatClassPathFactory}
-import scala.tools.nsc.io.AbstractFile
-import java.net.URL
-
-/**
- * Simple interface that allows us to abstract over how class file lookup is performed
- * in different classpath representations.
- */
-// TODO at the end, after the possible removal of the old classpath representation, this class shouldn't be generic
-// T should be just changed to AbstractFile
-trait ClassFileLookup[T] {
- def findClassFile(name: String): Option[AbstractFile]
-
- /**
- * It returns both classes from class file and source files (as our base ClassRepresentation).
- * So note that it's not so strictly related to findClassFile.
- */
- def findClass(name: String): Option[ClassRepresentation[T]]
-
- /**
- * A sequence of URLs representing this classpath.
- */
- def asURLs: Seq[URL]
-
- /** The whole classpath in the form of one String.
- */
- def asClassPathString: String
-
- // for compatibility purposes
- @deprecated("Use asClassPathString instead of this one", "2.11.5")
- def asClasspathString: String = asClassPathString
-
- /** The whole sourcepath in the form of one String.
- */
- def asSourcePathString: String
-}
-
-object ClassFileLookup {
- def createForFile(f: AbstractFile, current: ClassFileLookup[AbstractFile], settings: Settings): ClassFileLookup[AbstractFile] = current match {
- case cp: ClassPath[_] => cp.context.newClassPath(f)
- case _: FlatClassPath => FlatClassPathFactory.newClassPath(f, settings)
- }
-
- def createAggregate(elems: Iterable[ClassFileLookup[AbstractFile]], current: ClassFileLookup[AbstractFile]): ClassFileLookup[AbstractFile] = {
- assert(elems.nonEmpty)
- if (elems.size == 1) elems.head
- else current match {
- case cp: ClassPath[_] =>
- new MergedClassPath(elems.asInstanceOf[Iterable[ClassPath[AbstractFile]]], cp.context)
-
- case _: FlatClassPath =>
- AggregateFlatClassPath.createAggregate(elems.asInstanceOf[Iterable[FlatClassPath]].toSeq : _*)
- }
- }
-}
-
-/**
- * Represents classes which can be loaded with a ClassfileLoader and/or SourcefileLoader.
- */
-// TODO at the end, after the possible removal of the old classpath implementation, this class shouldn't be generic
-// T should be just changed to AbstractFile
-trait ClassRepresentation[T] {
- def binary: Option[T]
- def source: Option[AbstractFile]
-
- def name: String
-}
-
-object ClassRepresentation {
- def unapply[T](classRep: ClassRepresentation[T]): Option[(Option[T], Option[AbstractFile])] =
- Some((classRep.binary, classRep.source))
-}