From f0f4fedd503b2d332af4ff24d1934f150f8c79fc Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Tue, 31 Jul 2012 17:33:45 +0200 Subject: I actually managed to hit the limit of Scala signature annotation not fitting into a single string (high five everyone) and entered the undisovered region of arrEncode in GenASM. arrEncode returns Array[String] so asm.AnnotationWriter is not going to like it. Already discussed with @magarciaEPFL but please review again. --- src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala index e590a0b691..f681de93b6 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala @@ -993,8 +993,13 @@ abstract class GenASM extends SubComponent with BytecodeWriters { case sb@ScalaSigBytes(bytes) => // see http://www.scala-lang.org/sid/10 (Storage of pickled Scala signatures in class files) // also JVMS Sec. 4.7.16.1 The element_value structure and JVMS Sec. 4.4.7 The CONSTANT_Utf8_info Structure. - val assocValue = (if(sb.fitsInOneString) strEncode(sb) else arrEncode(sb)) - av.visit(name, assocValue) + if (sb.fitsInOneString) + av.visit(name, strEncode(sb)) + else { + val arrAnnotV: asm.AnnotationVisitor = av.visitArray(name) + for(arg <- arrEncode(sb)) { arrAnnotV.visit(name, arg) } + arrAnnotV.visitEnd() + } // for the lazy val in ScalaSigBytes to be GC'ed, the invoker of emitAnnotations() should hold the ScalaSigBytes in a method-local var that doesn't escape. case ArrayAnnotArg(args) => -- cgit v1.2.3