Restore support for local class literals in annotation arguments
This was broken in c1ab08c8ce where we started to represent KClassValue
as a ClassId of the referenced class + number of times it's been wrapped
into kotlin.Array. Local classes do not have a sane ClassId, so in this
change we restore the old behavior by representing KClassValue with a
sealed class value instead
#KT-29891 Fixed
This commit is contained in:
@@ -140,9 +140,13 @@ private fun ConstantValue<*>.toRuntimeValue(classLoader: ClassLoader): Any? = wh
|
||||
Util.getEnumConstantByName(enumClass as Class<out Enum<*>>, entryName.asString())
|
||||
}
|
||||
}
|
||||
is KClassValue -> {
|
||||
val (classId, arrayDimensions) = value
|
||||
loadClass(classLoader, classId, arrayDimensions)
|
||||
is KClassValue -> when (val classValue = value) {
|
||||
is KClassValue.Value.NormalClass ->
|
||||
loadClass(classLoader, classValue.classId, classValue.arrayDimensions)
|
||||
is KClassValue.Value.LocalClass -> {
|
||||
// TODO: this doesn't work because of KT-30013
|
||||
(classValue.type.constructor.declarationDescriptor as? ClassDescriptor)?.toJavaClass()
|
||||
}
|
||||
}
|
||||
is ErrorValue, is NullValue -> null
|
||||
else -> value // Primitives and strings
|
||||
|
||||
Reference in New Issue
Block a user