Remove unneeded members of ConstantValueFactory
This commit is contained in:
+12
-15
@@ -24,10 +24,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.constants.AnnotationValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValueFactory
|
||||
import org.jetbrains.kotlin.resolve.constants.EnumValue
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value
|
||||
@@ -70,16 +67,16 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n
|
||||
nameResolver: NameResolver
|
||||
): ConstantValue<*> {
|
||||
val result: ConstantValue<*> = when (value.type) {
|
||||
Type.BYTE -> ConstantValueFactory.createByteValue(value.intValue.toByte())
|
||||
Type.CHAR -> ConstantValueFactory.createCharValue(value.intValue.toChar())
|
||||
Type.SHORT -> ConstantValueFactory.createShortValue(value.intValue.toShort())
|
||||
Type.INT -> ConstantValueFactory.createIntValue(value.intValue.toInt())
|
||||
Type.LONG -> ConstantValueFactory.createLongValue(value.intValue)
|
||||
Type.FLOAT -> ConstantValueFactory.createFloatValue(value.floatValue)
|
||||
Type.DOUBLE -> ConstantValueFactory.createDoubleValue(value.doubleValue)
|
||||
Type.BOOLEAN -> ConstantValueFactory.createBooleanValue(value.intValue != 0L)
|
||||
Type.BYTE -> ByteValue(value.intValue.toByte())
|
||||
Type.CHAR -> CharValue(value.intValue.toChar())
|
||||
Type.SHORT -> ShortValue(value.intValue.toShort())
|
||||
Type.INT -> IntValue(value.intValue.toInt())
|
||||
Type.LONG -> LongValue(value.intValue)
|
||||
Type.FLOAT -> FloatValue(value.floatValue)
|
||||
Type.DOUBLE -> DoubleValue(value.doubleValue)
|
||||
Type.BOOLEAN -> BooleanValue(value.intValue != 0L)
|
||||
Type.STRING -> {
|
||||
ConstantValueFactory.createStringValue(nameResolver.getString(value.stringValue))
|
||||
StringValue(nameResolver.getString(value.stringValue))
|
||||
}
|
||||
Type.CLASS -> {
|
||||
resolveClassLiteralValue(nameResolver.getClassId(value.classId))
|
||||
@@ -124,7 +121,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n
|
||||
}
|
||||
else {
|
||||
// This means that an annotation class has been changed incompatibly without recompiling clients
|
||||
ConstantValueFactory.createErrorValue("Unexpected argument value")
|
||||
ErrorValue.create("Unexpected argument value")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +131,7 @@ class AnnotationDeserializer(private val module: ModuleDescriptor, private val n
|
||||
val starProjectedType = resolveClass(classId).defaultType.replaceArgumentsWithStarProjections()
|
||||
val kClass = resolveClass(ClassId.topLevel(KotlinBuiltIns.FQ_NAMES.kClass.toSafe()))
|
||||
val type = KotlinTypeFactory.simpleNotNullType(Annotations.EMPTY, kClass, listOf(TypeProjectionImpl(starProjectedType)))
|
||||
return ConstantValueFactory.createKClassValue(type)
|
||||
return KClassValue(type)
|
||||
}
|
||||
|
||||
private fun resolveArrayElementType(value: Value, nameResolver: NameResolver): SimpleType =
|
||||
|
||||
Reference in New Issue
Block a user