summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab
diff options
context:
space:
mode:
authorSeth Tisue <seth@tisue.net>2016-11-14 07:49:24 -0800
committerGitHub <noreply@github.com>2016-11-14 07:49:24 -0800
commitdde2cff7ddc19307f4ab9830a9d70d4d6651311b (patch)
treed6a9cde651d865e7607781f1bcbe031d292d4500 /src/compiler/scala/tools/nsc/symtab
parent71972e7c3fb719885bbff71c808d3ca4fe2019a1 (diff)
parent3c5990ce5839f4bdfca8fed7f2c415a72f6a8bd8 (diff)
downloadscala-dde2cff7ddc19307f4ab9830a9d70d4d6651311b.tar.gz
scala-dde2cff7ddc19307f4ab9830a9d70d4d6651311b.tar.bz2
scala-dde2cff7ddc19307f4ab9830a9d70d4d6651311b.zip
Merge pull request #5384 from som-snytt/issue/9915
SI-9915 Utf8_info are modified UTF8
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 7e81fad606..1a4671e15f 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -8,7 +8,7 @@ package tools.nsc
package symtab
package classfile
-import java.io.{File, IOException}
+import java.io.{ByteArrayInputStream, DataInputStream, File, IOException}
import java.lang.Integer.toHexString
import scala.collection.{immutable, mutable}
@@ -212,10 +212,14 @@ abstract class ClassfileParser {
case name: Name => name
case _ =>
val start = firstExpecting(index, CONSTANT_UTF8)
- recordAtIndex(newTermName(in.buf, start + 2, in.getChar(start).toInt), index)
+ val len = in.getChar(start).toInt
+ recordAtIndex(TermName(fromMUTF8(in.buf, start, len + 2)), index)
}
)
+ private def fromMUTF8(bytes: Array[Byte], offset: Int, len: Int): String =
+ new DataInputStream(new ByteArrayInputStream(bytes, offset, len)).readUTF
+
/** Return the name found at given index in the constant pool, with '/' replaced by '.'. */
def getExternalName(index: Int): Name = {
if (index <= 0 || len <= index)