summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/io
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/io
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/io')
-rw-r--r--src/compiler/scala/tools/nsc/io/ClassAndJarInfo.scala44
1 files changed, 0 insertions, 44 deletions
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)
-}