summaryrefslogtreecommitdiff
path: root/src/scalap
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-19 16:43:44 +0200
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2012-09-19 16:43:44 +0200
commitc215592fde3d70c5924de40d5ff27cb374cee93d (patch)
treec15c49464f7a69ff7cb942a95a67b78a18de08ec /src/scalap
parentb9fd3f713d4c0122c1411315ad25049d117df57c (diff)
downloadscala-c215592fde3d70c5924de40d5ff27cb374cee93d.tar.gz
scala-c215592fde3d70c5924de40d5ff27cb374cee93d.tar.bz2
scala-c215592fde3d70c5924de40d5ff27cb374cee93d.zip
Fix problem with names encoding in scalap.
The refactoring performed in 020053c321 made use of naming encoding more consisted but introduced a regression in scalap. The problem is that the old encoder that scalap had didn't escape any characters that were not included in its opcode list. `NameTransformer` performs full encoding so it also encodes dots that are being used as separators for packages. Therefore, in order to retain the old behaviour we need to split the name by dots before feeding each fragment to `NameTransformer`. Review by @paulp.
Diffstat (limited to 'src/scalap')
-rw-r--r--src/scalap/scala/tools/scalap/Main.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/scalap/scala/tools/scalap/Main.scala b/src/scalap/scala/tools/scalap/Main.scala
index 49c272cc28..a514f0d5a1 100644
--- a/src/scalap/scala/tools/scalap/Main.scala
+++ b/src/scalap/scala/tools/scalap/Main.scala
@@ -97,9 +97,14 @@ class Main {
*/
def process(args: Arguments, path: ClassPath[AbstractFile])(classname: String): Unit = {
// find the classfile
- val encName = NameTransformer.encode(
- if (classname == "scala.AnyRef") "java.lang.Object"
- else classname)
+ val encName = classname match {
+ case "scala.AnyRef" => "java.lang.Object"
+ case _ =>
+ // we have to encode every fragment of a name separately, otherwise the NameTransformer
+ // will encode using unicode escaping dot separators as well
+ // we can afford allocations because this is not a performance critical code
+ classname.split('.').map(NameTransformer.encode).mkString(".")
+ }
val cls = path.findClass(encName)
if (cls.isDefined && cls.get.binary.isDefined) {
val cfile = cls.get.binary.get