Support KClass<*> annotation arguments in serialization/deserialization

#KT-11586 Fixed
This commit is contained in:
Alexander Udalov
2017-10-19 15:44:31 +02:00
parent d0e8f99d60
commit f2be34ca1c
11 changed files with 106 additions and 10 deletions
@@ -97,9 +97,12 @@ class AnnotationSerializer(private val stringTable: StringTable) {
intValue = value.value.toLong()
}
override fun visitKClassValue(value: KClassValue?, data: Unit?) {
// TODO: support class literals
throw UnsupportedOperationException("Class literal annotation arguments are not yet supported: $value")
override fun visitKClassValue(value: KClassValue, data: Unit) {
val descriptor = value.value.constructor.declarationDescriptor as? ClassDescriptor
?: throw UnsupportedOperationException("Class literal annotation argument should be a class: $value")
type = Type.CLASS
classId = stringTable.getFqNameIndex(descriptor)
}
override fun visitLongValue(value: LongValue, data: Unit) {