Create array instances of correct types in reflection
Based on #4168. #KT-44977 Fixed Co-authored-by: Arkady Bazhanov <arkady.bazhanov@gmail.com>
This commit is contained in:
+1
-2
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classId
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
@@ -84,7 +83,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n
|
||||
Type.CLASS -> KClassValue(nameResolver.getClassId(value.classId), value.arrayDimensionCount)
|
||||
Type.ENUM -> EnumValue(nameResolver.getClassId(value.classId), nameResolver.getName(value.enumValueId))
|
||||
Type.ANNOTATION -> AnnotationValue(deserializeAnnotation(value.annotation, nameResolver))
|
||||
Type.ARRAY -> ConstantValueFactory.createArrayValue(
|
||||
Type.ARRAY -> DeserializedArrayValue(
|
||||
value.arrayElementList.map { resolveValue(builtIns.anyType, it, nameResolver) },
|
||||
expectedType
|
||||
)
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.types.KotlinType
|
||||
|
||||
class DeserializedArrayValue(value: List<ConstantValue<*>>, val type: KotlinType) : ArrayValue(value, { type })
|
||||
Reference in New Issue
Block a user