diff options
author | Paul Phillips <paulp@improving.org> | 2009-03-05 23:47:56 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2009-03-05 23:47:56 +0000 |
commit | 0bd2114450d971a562be4ba6893e7f2b492b061c (patch) | |
tree | 90050ce882f6a1a5bc97ee0ed5d0e3668f77edcc | |
parent | 9bedaaa81711cf077437d2868442431b1b15ee8d (diff) | |
download | scala-0bd2114450d971a562be4ba6893e7f2b492b061c.tar.gz scala-0bd2114450d971a562be4ba6893e7f2b492b061c.tar.bz2 scala-0bd2114450d971a562be4ba6893e7f2b492b061c.zip |
Fix for #1769.
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 4 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 14 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 4dc08eedc0..ca7ee5697c 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -1028,11 +1028,11 @@ abstract class GenJVM extends SubComponent { case BOX(kind) => val boxedType = definitions.boxedClass(kind.toType.typeSymbol) val mtype = new JMethodType(javaType(boxedType), Array(javaType(kind))) - jcode.emitINVOKESTATIC(BoxesRunTime, "boxTo" + boxedType.nameString, mtype) + jcode.emitINVOKESTATIC(BoxesRunTime, "boxTo" + boxedType.cleanNameString, mtype) case UNBOX(kind) => val mtype = new JMethodType(javaType(kind), Array(JObjectType.JAVA_LANG_OBJECT)) - jcode.emitINVOKESTATIC(BoxesRunTime, "unboxTo" + kind.toType.typeSymbol.nameString, mtype) + jcode.emitINVOKESTATIC(BoxesRunTime, "unboxTo" + kind.toType.typeSymbol.cleanNameString, mtype) case NEW(REFERENCE(cls)) => val className = javaName(cls) diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 0e91e1b5bb..25be41ee93 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1296,11 +1296,15 @@ trait Symbols { * E.g. $eq => =. * If settings.uniquId adds id. */ - def nameString: String = { - var s = simpleName.decode - if (s endsWith nme.LOCAL_SUFFIX) - s = s.substring(0, s.length - nme.LOCAL_SUFFIX.length) - s + idString + def nameString: String = cleanNameString + idString + + /** A nameString that never adds idString, for use in e.g. GenJVM + * where appending #uniqid breaks the bytecode. + */ + def cleanNameString: String = { + val s = simpleName.decode + if (s endsWith nme.LOCAL_SUFFIX) s.substring(0, s.length - nme.LOCAL_SUFFIX.length) + else s } /** String representation of symbol's full name with <code>separator</code> |