Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ClassManifest.typeArguments returns empty list on array manifests #3758
I was told on the mailing list this is a bug so I'll just copy and paste from there (see below). I was using Scala 2.8.0 Final.
I was hoping to retrieve the manifest of an array's element type like so:
This returns an empty list. Looking at the Manifest.arrayManifest method, I see that it is implemented as
override def arrayManifest: Manifest[Array[T]] = Manifest.classType[Array[T]](arrayClass[T](erasure))
This explains why the above retuns Nil but it looks like implementing it as
override def arrayManifest: Manifest[Array[T]] = Manifest.classType[Array[T]](arrayClass[T](erasure), this)
would solve the problem.
Imported From: https://issues.scala-lang.org/browse/SI-3758?orig=1
protected def argString = if (typeArguments.nonEmpty) typeArguments.mkString("[", ", ", "]") else if (erasure.isArray) "["+ClassManifest.fromClass(erasure.getComponentType)+"]" else ""
So I won't touch this pending feedback. (The suggested patch does have the intended effect.)