in chill-scala/src/main/scala/com/twitter/chill/ManifestSerializer.scala [55:72]
def write(kser: Kryo, out: Output, obj: Manifest[T]): Unit = writeInternal(kser, out, obj)
def read(kser: Kryo, in: Input, cls: Class[Manifest[T]]): Manifest[T] = {
val sidx = in.readInt(true)
if (sidx == 0) {
val clazz = kser.readObject(in, classOf[Class[T]])
val targsCnt = in.readInt(true)
if (targsCnt == 0) {
Manifest.classType(clazz)
} else {
// We don't need to know the cls:
val typeArgs = (0 until targsCnt).map(_ => read(kser, in, null))
Manifest.classType(clazz, typeArgs.head, typeArgs.tail: _*)
}
} else {
singletons(sidx - 1).asInstanceOf[Manifest[T]]
}
}