Skip to content

Commit d834d90

Browse files
committed
Merge pull request scala#1353 from gkossakowski/SI-6376-scalap-is-broken
Fix problem with names encoding in scalap.
2 parents 008db40 + c215592 commit d834d90

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/scalap/scala/tools/scalap/Main.scala

+8-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,14 @@ class Main {
9797
*/
9898
def process(args: Arguments, path: ClassPath[AbstractFile])(classname: String): Unit = {
9999
// find the classfile
100-
val encName = NameTransformer.encode(
101-
if (classname == "scala.AnyRef") "java.lang.Object"
102-
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+
}
103108
val cls = path.findClass(encName)
104109
if (cls.isDefined && cls.get.binary.isDefined) {
105110
val cfile = cls.get.binary.get

0 commit comments

Comments
 (0)