~ubuntu-branches/debian/sid/scala/sid

« back to all changes in this revision

Viewing changes to src/scalap/scala/tools/scalap/Main.scala

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg, Mehdi Dogguy, Lucas Satabin, Frank S. Thomas, Emmanuel Bourg
  • Date: 2015-06-05 23:52:59 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150605235259-wk00vgk83dh8o19g
Tags: 2.10.5-1
* Team upload.

[ Mehdi Dogguy ]
* New upstream release (Closes: #744278).

[ Lucas Satabin ]
* Update patches
* Update the clean target
* Update paths of elements to install
* Update watch file

[ Frank S. Thomas ]
* Remove myself from Uploaders.

[ Emmanuel Bourg ]
* The package has been adopted by the Java Team (Closes: #754935)
* Patched the build to avoid downloading libraries from the Internet
* Replaced the minified JavaScript files with unobfuscated ones
* No longer build scala-partest.jar until diffutils is packaged or replaced
* debian/watch: Fixed the versions matched (x.y.z instead of x.y.z..z)
* debian/rules:
  - Added the missing get-orig-source target (Closes: #724704)
  - Improved the clean target
* debian/control:
  - Build depend on scala (>= 2.10) and bnd
  - Use canonical URLs for the Vcs-* fields
  - Standards-Version updated to 3.9.6 (no changes)
* Switch to debhelper level 9

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*     ___ ____ ___   __   ___   ___
2
2
**    / _// __// _ | / /  / _ | / _ \  Scala classfile decoder
3
 
**  __\ \/ /__/ __ |/ /__/ __ |/ ___/  (c) 2003-2011, LAMP/EPFL
 
3
**  __\ \/ /__/ __ |/ /__/ __ |/ ___/  (c) 2003-2013, LAMP/EPFL
4
4
** /____/\___/_/ |_/____/_/ |_/_/      http://scala-lang.org/
5
5
**
6
6
*/
8
8
package scala.tools.scalap
9
9
 
10
10
import java.io.{ PrintStream, OutputStreamWriter, ByteArrayOutputStream }
 
11
import scala.reflect.NameTransformer
11
12
import scalax.rules.scalasig._
12
 
import tools.nsc.util.{ ClassPath, JavaClassPath }
13
 
import tools.util.PathResolver
 
13
import scala.tools.nsc.util.{ ClassPath, JavaClassPath }
 
14
import scala.tools.util.PathResolver
14
15
import ClassPath.DefaultJavaContext
15
 
import tools.nsc.io.{ PlainFile, AbstractFile }
 
16
import scala.tools.nsc.io.{ PlainFile, AbstractFile }
16
17
 
17
18
/**The main object used to execute scalap on the command-line.
18
19
 *
96
97
   */
97
98
  def process(args: Arguments, path: ClassPath[AbstractFile])(classname: String): Unit = {
98
99
    // find the classfile
99
 
    val encName = Names.encode(
100
 
      if (classname == "scala.AnyRef") "java.lang.Object"
101
 
      else classname)
 
100
    val encName = classname match {
 
101
      case "scala.AnyRef" => "java.lang.Object"
 
102
      case _ =>
 
103
        // we have to encode every fragment of a name separately, otherwise the NameTransformer
 
104
        // will encode using unicode escaping dot separators as well
 
105
        // we can afford allocations because this is not a performance critical code
 
106
        classname.split('.').map(NameTransformer.encode).mkString(".")
 
107
    }
102
108
    val cls = path.findClass(encName)
103
109
    if (cls.isDefined && cls.get.binary.isDefined) {
104
110
      val cfile = cls.get.binary.get
131
137
    def asClasspathString = ""
132
138
 
133
139
    val context     = DefaultJavaContext
134
 
    val classes     = IndexedSeq[ClassRep]()
135
 
    val packages    = IndexedSeq[ClassPath[AbstractFile]]()
136
 
    val sourcepaths = IndexedSeq[AbstractFile]()
 
140
    val classes     = IndexedSeq()
 
141
    val packages    = IndexedSeq()
 
142
    val sourcepaths = IndexedSeq()
137
143
  }
138
144
}
139
145
 
178
184
    val cparg = List("-classpath", "-cp") map (arguments getArgument _) reduceLeft (_ orElse _)
179
185
    val path = cparg match {
180
186
      case Some(cp) => new JavaClassPath(DefaultJavaContext.classesInExpandedPath(cp), DefaultJavaContext)
181
 
      case _        => PathResolver.fromPathString("")
 
187
      case _        => PathResolver.fromPathString(".") // include '.' in the default classpath SI-6669
182
188
    }
183
189
    // print the classpath if output is verbose
184
190
    if (verbose)