55**
66*/
77
8- // $Id$
9-
108package scala .tools .scalap
119
12- import scala .tools .scalap .scalax . rules . scalasig ._
13- import scala . tools . nsc . util . ScalaClassLoader
14- import scala .tools . nsc .util .ScalaClassLoader . appLoader
10+ import scala .tools .scalap .scalasig ._
11+
12+ import scala .reflect . internal .util .ScalaClassLoader
1513import scala .reflect .internal .pickling .ByteCodecs
1614
1715import ClassFileParser .{ ConstValueIndex , Annotation }
18- import Main .{ SCALA_SIG , SCALA_SIG_ANNOTATION , BYTES_VALUE }
1916
2017/** Temporary decoder. This would be better off in the scala.tools.nsc
2118 * but right now the compiler won't acknowledge scala.tools.scalap
@@ -31,25 +28,24 @@ object Decode {
3128 /** Return the classfile bytes representing the scala sig classfile attribute.
3229 * This has been obsoleted by the switch to annotations.
3330 */
34- def scalaSigBytes (name : String ): Option [Array [Byte ]] = scalaSigBytes(name, appLoader)
31+ def scalaSigBytes (name : String ): Option [Array [Byte ]] = scalaSigBytes(name, ScalaClassLoader . appLoader)
3532 def scalaSigBytes (name : String , classLoader : ScalaClassLoader ): Option [Array [Byte ]] = {
3633 val bytes = classLoader.classBytes(name)
3734 val reader = new ByteArrayReader (bytes)
3835 val cf = new Classfile (reader)
3936 cf.scalaSigAttribute map (_.data)
4037 }
4138
42- /** Return the bytes representing the annotation
43- */
44- def scalaSigAnnotationBytes (name : String ): Option [Array [Byte ]] = scalaSigAnnotationBytes(name, appLoader)
39+ /** Return the bytes representing the annotation. */
40+ def scalaSigAnnotationBytes (name : String ): Option [Array [Byte ]] = scalaSigAnnotationBytes(name, ScalaClassLoader .appLoader)
4541 def scalaSigAnnotationBytes (name : String , classLoader : ScalaClassLoader ): Option [Array [Byte ]] = {
4642 val bytes = classLoader.classBytes(name)
4743 val byteCode = ByteCode (bytes)
4844 val classFile = ClassFileParser .parse(byteCode)
4945 import classFile ._
5046
51- classFile annotation SCALA_SIG_ANNOTATION map { case Annotation (_, els) =>
52- val bytesElem = els find (x => constant(x.elementNameIndex) == BYTES_VALUE ) getOrElse null
47+ classFile annotation Main . SCALA_SIG_ANNOTATION map { case Annotation (_, els) =>
48+ val bytesElem = els find (x => constant(x.elementNameIndex) == Main . BYTES_VALUE ) getOrElse null
5349 val _bytes = bytesElem.elementValue match { case ConstValueIndex (x) => constantWrapped(x) }
5450 val bytes = _bytes.asInstanceOf [StringBytesPair ].bytes
5551 val length = ByteCodecs .decode(bytes)
@@ -58,16 +54,15 @@ object Decode {
5854 }
5955 }
6056
61- /** private[scala] so nobody gets the idea this is a supported interface.
62- */
57+ /** private[scala] so nobody gets the idea this is a supported interface. */
6358 private [scala] def caseParamNames (path : String ): Option [List [String ]] = {
6459 val (outer, inner) = (path indexOf '$' ) match {
6560 case - 1 => (path, " " )
6661 case x => (path take x, path drop (x + 1 ))
6762 }
6863
6964 for {
70- clazz <- appLoader.tryToLoadClass[AnyRef ](outer)
65+ clazz <- ScalaClassLoader . appLoader.tryToLoadClass[AnyRef ](outer)
7166 ssig <- ScalaSigParser .parse(clazz)
7267 }
7368 yield {
@@ -85,11 +80,10 @@ object Decode {
8580 }
8681 }
8782
88- /** Returns a map of Alias -> Type for the given package.
89- */
83+ /** Returns a map of Alias -> Type for the given package. */
9084 private [scala] def typeAliases (pkg : String ) = {
9185 for {
92- clazz <- appLoader.tryToLoadClass[AnyRef ](pkg + " .package" )
86+ clazz <- ScalaClassLoader . appLoader.tryToLoadClass[AnyRef ](pkg + " .package" )
9387 ssig <- ScalaSigParser .parse(clazz)
9488 }
9589 yield {
0 commit comments