Permalink

Browse files
SI-7556 Fix runtime reflection involving ScalaLongSignature
Scala type information is stored in classfiles in encoded in a String in the ScalaSignature annotation. When it is too big for a single String, it is split into an array of Strings in a different annotation, ScalaLongSignature. The enclosed test, with a class containing 3000 methods, uses the latter. It exposes a bug in the way runtime reflection decodes that data. It must concatentate and *then* decode, rather that the other way around.
- Loading branch information...
Showing with 3,019 additions and 9 deletions.
@@ -0,0 +1,2 @@ | |||
class annotations: List(scala.reflect.ScalaLongSignature) | |||
3001 decls via runtime reflection |
@@ -0,0 +1,11 @@ | |||
import scala.reflect.runtime.universe._ | |||
object Test { | |||
def main(args: Array[String]) { | |||
val mc = new MegaClass | |||
val anns = mc.getClass.getAnnotations.map(_.annotationType.getName).toList.sorted | |||
println(s"class annotations: $anns") | |||
val N = typeTag[MegaClass].tpe.declarations.size // was: error reading Scala signature of MegaClass: 65935 | |||
println(s"$N decls via runtime reflection") | |||
} | |||
} |

Oops, something went wrong.
Please sign in to comment.
0 comments on commit
28c5f73