Support serialization/deserialization of local classes

Most of these changes are aimed to support and correctly transform ClassId for
local classes, no actual bytes are written or read at the moment (see next
commits). See the comment on ClassId for clarification.

A hack in DescriptorSerializer which erased anonymous types to Any (which had
been breaking the consistency between descriptors resolved from sources and
from serialized information) is now gone
This commit is contained in:
Alexander Udalov
2015-02-13 23:28:15 +03:00
parent add9bb34cb
commit 0d05fca838
14 changed files with 216 additions and 176 deletions
@@ -28,6 +28,9 @@ public class JavaClassDataFinder(
) : ClassDataFinder {
override fun findClassData(classId: ClassId): ClassData? {
val kotlinJvmBinaryClass = kotlinClassFinder.findKotlinClass(classId) ?: return null
assert(kotlinJvmBinaryClass.getClassId() == classId) {
"Class with incorrect id found: expected $classId, actual ${kotlinJvmBinaryClass.getClassId()}"
}
val data = deserializedDescriptorResolver.readData(kotlinJvmBinaryClass, KotlinClassHeader.Kind.CLASS) ?: return null
return JvmProtoBufUtil.readClassDataFrom(data)
}