Split CompileTimeConstant into two entities
1. ConstantValue * just holds some value and its type * implementations for concrete constants 2. CompileTimeConstant * is only produced by ConstantExpressionEvaluator * has additional flags (canBeUsedInAnnotation etc) * has two implementations TypedCompileTimeConstant containing a constant value and IntegerValueConstant which does not have exact type * can be converted to ConstantValue Adjustt usages to use ConstantValue if flags are not needed Add tests for some uncovered cases
This commit is contained in:
+10
-9
@@ -30,7 +30,8 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValueFactory
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.resolveTopLevelClass
|
||||
import org.jetbrains.kotlin.resolve.jvm.PLATFORM_TYPES
|
||||
import org.jetbrains.kotlin.types.*
|
||||
@@ -64,7 +65,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
annotationClass?.getDefaultType() ?: ErrorUtils.createErrorType(fqName.asString())
|
||||
}
|
||||
|
||||
private val factory = CompileTimeConstantFactory(CompileTimeConstant.Parameters.Impl(true, false, false), c.module.builtIns)
|
||||
private val factory = ConstantValueFactory(c.module.builtIns)
|
||||
|
||||
override fun getType(): JetType = type()
|
||||
|
||||
@@ -74,7 +75,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
|
||||
override fun getAllValueArguments() = allValueArguments()
|
||||
|
||||
private fun computeValueArguments(): Map<ValueParameterDescriptor, CompileTimeConstant<*>> {
|
||||
private fun computeValueArguments(): Map<ValueParameterDescriptor, ConstantValue<*>> {
|
||||
val constructors = getAnnotationClass().getConstructors()
|
||||
if (constructors.isEmpty()) return mapOf()
|
||||
|
||||
@@ -100,9 +101,9 @@ class LazyJavaAnnotationDescriptor(
|
||||
|
||||
private fun getAnnotationClass() = getType().getConstructor().getDeclarationDescriptor() as ClassDescriptor
|
||||
|
||||
private fun resolveAnnotationArgument(argument: JavaAnnotationArgument?): CompileTimeConstant<*>? {
|
||||
private fun resolveAnnotationArgument(argument: JavaAnnotationArgument?): ConstantValue<*>? {
|
||||
return when (argument) {
|
||||
is JavaLiteralAnnotationArgument -> factory.createCompileTimeConstant(argument.value)
|
||||
is JavaLiteralAnnotationArgument -> factory.createConstantValue(argument.value)
|
||||
is JavaEnumValueAnnotationArgument -> resolveFromEnumValue(argument.resolve())
|
||||
is JavaArrayAnnotationArgument -> resolveFromArray(argument.name ?: DEFAULT_ANNOTATION_MEMBER_NAME, argument.getElements())
|
||||
is JavaAnnotationAsAnnotationArgument -> resolveFromAnnotation(argument.getAnnotation())
|
||||
@@ -111,13 +112,13 @@ class LazyJavaAnnotationDescriptor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun resolveFromAnnotation(javaAnnotation: JavaAnnotation): CompileTimeConstant<*>? {
|
||||
private fun resolveFromAnnotation(javaAnnotation: JavaAnnotation): ConstantValue<*>? {
|
||||
val descriptor = c.resolveAnnotation(javaAnnotation) ?: return null
|
||||
|
||||
return factory.createAnnotationValue(descriptor)
|
||||
}
|
||||
|
||||
private fun resolveFromArray(argumentName: Name, elements: List<JavaAnnotationArgument>): CompileTimeConstant<*>? {
|
||||
private fun resolveFromArray(argumentName: Name, elements: List<JavaAnnotationArgument>): ConstantValue<*>? {
|
||||
if (getType().isError()) return null
|
||||
|
||||
val valueParameter = DescriptorResolverUtils.getAnnotationParameterByName(argumentName, getAnnotationClass()) ?: return null
|
||||
@@ -128,7 +129,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
return factory.createArrayValue(values, valueParameter.getType())
|
||||
}
|
||||
|
||||
private fun resolveFromEnumValue(element: JavaField?): CompileTimeConstant<*>? {
|
||||
private fun resolveFromEnumValue(element: JavaField?): ConstantValue<*>? {
|
||||
if (element == null || !element.isEnumEntry()) return null
|
||||
|
||||
val containingJavaClass = element.getContainingClass()
|
||||
@@ -142,7 +143,7 @@ class LazyJavaAnnotationDescriptor(
|
||||
return factory.createEnumValue(classifier)
|
||||
}
|
||||
|
||||
private fun resolveFromJavaClassObjectType(javaType: JavaType): CompileTimeConstant<*>? {
|
||||
private fun resolveFromJavaClassObjectType(javaType: JavaType): ConstantValue<*>? {
|
||||
// Class type is never nullable in 'Foo.class' in Java
|
||||
val type = TypeUtils.makeNotNullable(c.typeResolver.transformJavaType(
|
||||
javaType,
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ class LazyJavaClassDescriptor(
|
||||
getAnnotations().
|
||||
findAnnotation(JvmAnnotationNames.PURELY_IMPLEMENTS_ANNOTATION) ?: return null
|
||||
|
||||
val fqNameString = (annotation.getAllValueArguments().values().singleOrNull() as? StringValue)?.getValue() ?: return null
|
||||
val fqNameString = (annotation.getAllValueArguments().values().singleOrNull() as? StringValue)?.value ?: return null
|
||||
if (!isValidJavaFqName(fqNameString)) return null
|
||||
|
||||
return FqName(fqNameString)
|
||||
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.java.structure;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
|
||||
public interface JavaPropertyInitializerEvaluator {
|
||||
JavaPropertyInitializerEvaluator DO_NOTHING = new JavaPropertyInitializerEvaluator() {
|
||||
@Nullable
|
||||
@Override
|
||||
public CompileTimeConstant<?> getInitializerConstant(@NotNull JavaField field, @NotNull PropertyDescriptor descriptor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNotNullCompileTimeConstant(@NotNull JavaField field) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
CompileTimeConstant<?> getInitializerConstant(@NotNull JavaField field, @NotNull PropertyDescriptor descriptor);
|
||||
|
||||
boolean isNotNullCompileTimeConstant(@NotNull JavaField field);
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.java.structure
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.PropertyDescriptor
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
|
||||
public interface JavaPropertyInitializerEvaluator {
|
||||
public fun getInitializerConstant(field: JavaField, descriptor: PropertyDescriptor): ConstantValue<*>?
|
||||
|
||||
public fun isNotNullCompileTimeConstant(field: JavaField): Boolean
|
||||
|
||||
public object DoNothing : JavaPropertyInitializerEvaluator {
|
||||
override fun getInitializerConstant(field: JavaField, descriptor: PropertyDescriptor) = null
|
||||
|
||||
override fun isNotNullCompileTimeConstant(field: JavaField) = false
|
||||
}
|
||||
}
|
||||
+13
-11
@@ -26,7 +26,9 @@ import org.jetbrains.kotlin.load.java.components.DescriptorResolverUtils
|
||||
import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
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.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.AnnotationDeserializer
|
||||
import org.jetbrains.kotlin.serialization.deserialization.ErrorReporter
|
||||
@@ -42,16 +44,16 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
storageManager: StorageManager,
|
||||
kotlinClassFinder: KotlinClassFinder,
|
||||
errorReporter: ErrorReporter
|
||||
) : AbstractBinaryClassAnnotationAndConstantLoader<AnnotationDescriptor, CompileTimeConstant<*>>(
|
||||
) : AbstractBinaryClassAnnotationAndConstantLoader<AnnotationDescriptor, ConstantValue<*>>(
|
||||
storageManager, kotlinClassFinder, errorReporter
|
||||
) {
|
||||
private val annotationDeserializer = AnnotationDeserializer(module)
|
||||
private val factory = CompileTimeConstantFactory(CompileTimeConstant.Parameters.ThrowException, module.builtIns)
|
||||
private val factory = ConstantValueFactory(module.builtIns)
|
||||
|
||||
override fun loadTypeAnnotation(proto: ProtoBuf.Annotation, nameResolver: NameResolver): AnnotationDescriptor =
|
||||
annotationDeserializer.deserializeAnnotation(proto, nameResolver)
|
||||
|
||||
override fun loadConstant(desc: String, initializer: Any): CompileTimeConstant<*>? {
|
||||
override fun loadConstant(desc: String, initializer: Any): ConstantValue<*>? {
|
||||
val normalizedValue: Any = if (desc in "ZBCS") {
|
||||
val intValue = initializer as Int
|
||||
when (desc) {
|
||||
@@ -66,7 +68,7 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
initializer
|
||||
}
|
||||
|
||||
return factory.createCompileTimeConstant(normalizedValue)
|
||||
return factory.createConstantValue(normalizedValue)
|
||||
}
|
||||
|
||||
override fun loadAnnotation(
|
||||
@@ -76,7 +78,7 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
val annotationClass = resolveClass(annotationClassId)
|
||||
|
||||
return object : KotlinJvmBinaryClass.AnnotationArgumentVisitor {
|
||||
private val arguments = HashMap<ValueParameterDescriptor, CompileTimeConstant<*>>()
|
||||
private val arguments = HashMap<ValueParameterDescriptor, ConstantValue<*>>()
|
||||
|
||||
override fun visit(name: Name?, value: Any?) {
|
||||
if (name != null) {
|
||||
@@ -90,7 +92,7 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
|
||||
override fun visitArray(name: Name): AnnotationArrayArgumentVisitor? {
|
||||
return object : KotlinJvmBinaryClass.AnnotationArrayArgumentVisitor {
|
||||
private val elements = ArrayList<CompileTimeConstant<*>>()
|
||||
private val elements = ArrayList<ConstantValue<*>>()
|
||||
|
||||
override fun visit(value: Any?) {
|
||||
elements.add(createConstant(name, value))
|
||||
@@ -122,7 +124,7 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
}
|
||||
|
||||
// NOTE: see analogous code in AnnotationDeserializer
|
||||
private fun enumEntryValue(enumClassId: ClassId, name: Name): CompileTimeConstant<*> {
|
||||
private fun enumEntryValue(enumClassId: ClassId, name: Name): ConstantValue<*> {
|
||||
val enumClass = resolveClass(enumClassId)
|
||||
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
||||
val classifier = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(name)
|
||||
@@ -137,12 +139,12 @@ public class BinaryClassAnnotationAndConstantLoaderImpl(
|
||||
result.add(AnnotationDescriptorImpl(annotationClass.getDefaultType(), arguments))
|
||||
}
|
||||
|
||||
private fun createConstant(name: Name?, value: Any?): CompileTimeConstant<*> {
|
||||
return factory.createCompileTimeConstant(value) ?:
|
||||
private fun createConstant(name: Name?, value: Any?): ConstantValue<*> {
|
||||
return factory.createConstantValue(value) ?:
|
||||
factory.createErrorValue("Unsupported annotation argument: $name")
|
||||
}
|
||||
|
||||
private fun setArgumentValueByName(name: Name, argumentValue: CompileTimeConstant<*>) {
|
||||
private fun setArgumentValueByName(name: Name, argumentValue: ConstantValue<*>) {
|
||||
val parameter = DescriptorResolverUtils.getAnnotationParameterByName(name, annotationClass)
|
||||
if (parameter != null) {
|
||||
arguments[parameter] = argumentValue
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public class RuntimeModuleData private constructor(public val module: ModuleDesc
|
||||
val globalJavaResolverContext = GlobalJavaResolverContext(
|
||||
storageManager, ReflectJavaClassFinder(classLoader), reflectKotlinClassFinder, deserializedDescriptorResolver,
|
||||
ExternalAnnotationResolver.EMPTY, ExternalSignatureResolver.DO_NOTHING, RuntimeErrorReporter, JavaResolverCache.EMPTY,
|
||||
JavaPropertyInitializerEvaluator.DO_NOTHING, SamConversionResolver, RuntimeSourceElementFactory, singleModuleClassResolver
|
||||
JavaPropertyInitializerEvaluator.DoNothing, SamConversionResolver, RuntimeSourceElementFactory, singleModuleClassResolver
|
||||
)
|
||||
val lazyJavaPackageFragmentProvider = LazyJavaPackageFragmentProvider(globalJavaResolverContext, module, ReflectionTypes(module))
|
||||
val javaDescriptorResolver = JavaDescriptorResolver(lazyJavaPackageFragmentProvider, module)
|
||||
|
||||
+3
-3
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.builtins
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.builtins.BuiltInsProtoBuf
|
||||
import org.jetbrains.kotlin.serialization.deserialization.*
|
||||
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
class BuiltInsAnnotationAndConstantLoader(
|
||||
module: ModuleDescriptor
|
||||
) : AnnotationAndConstantLoader<AnnotationDescriptor, CompileTimeConstant<*>> {
|
||||
) : AnnotationAndConstantLoader<AnnotationDescriptor, ConstantValue<*>> {
|
||||
private val deserializer = AnnotationDeserializer(module)
|
||||
|
||||
override fun loadClassAnnotations(
|
||||
@@ -68,7 +68,7 @@ class BuiltInsAnnotationAndConstantLoader(
|
||||
proto: ProtoBuf.Callable,
|
||||
nameResolver: NameResolver,
|
||||
expectedType: JetType
|
||||
): CompileTimeConstant<*>? {
|
||||
): ConstantValue<*>? {
|
||||
val value = proto.getExtension(BuiltInsProtoBuf.compileTimeValue)
|
||||
return deserializer.resolveValue(expectedType, value, nameResolver)
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.resolve.scopes.JetScope;
|
||||
import org.jetbrains.kotlin.storage.LockBasedStorageManager;
|
||||
import org.jetbrains.kotlin.types.*;
|
||||
@@ -659,7 +659,7 @@ public class KotlinBuiltIns {
|
||||
@NotNull
|
||||
public AnnotationDescriptor createExtensionAnnotation() {
|
||||
return new AnnotationDescriptorImpl(getBuiltInClassByName("extension").getDefaultType(),
|
||||
Collections.<ValueParameterDescriptor, CompileTimeConstant<?>>emptyMap());
|
||||
Collections.<ValueParameterDescriptor, ConstantValue<?>>emptyMap());
|
||||
}
|
||||
|
||||
private static boolean isTypeAnnotatedWithExtension(@NotNull JetType type) {
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.jetbrains.kotlin.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitutor;
|
||||
|
||||
@@ -36,5 +36,5 @@ public interface VariableDescriptor extends CallableDescriptor {
|
||||
boolean isVar();
|
||||
|
||||
@Nullable
|
||||
CompileTimeConstant<?> getCompileTimeInitializer();
|
||||
ConstantValue<?> getCompileTimeInitializer();
|
||||
}
|
||||
|
||||
-2
@@ -50,6 +50,4 @@ public interface AnnotationArgumentVisitor<R, D> {
|
||||
R visitAnnotationValue(AnnotationValue value, D data);
|
||||
|
||||
R visitKClassValue(KClassValue value, D data);
|
||||
|
||||
R visitNumberTypeValue(IntegerValueTypeConstant value, D data);
|
||||
}
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.descriptors.annotations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -30,5 +30,5 @@ public interface AnnotationDescriptor {
|
||||
|
||||
@NotNull
|
||||
@ReadOnly
|
||||
Map<ValueParameterDescriptor, CompileTimeConstant<?>> getAllValueArguments();
|
||||
Map<ValueParameterDescriptor, ConstantValue<?>> getAllValueArguments();
|
||||
}
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.descriptors.annotations;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor;
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
|
||||
import java.util.Collections;
|
||||
@@ -27,11 +27,11 @@ import java.util.Map;
|
||||
|
||||
public class AnnotationDescriptorImpl implements AnnotationDescriptor {
|
||||
private final JetType annotationType;
|
||||
private final Map<ValueParameterDescriptor, CompileTimeConstant<?>> valueArguments;
|
||||
private final Map<ValueParameterDescriptor, ConstantValue<?>> valueArguments;
|
||||
|
||||
public AnnotationDescriptorImpl(
|
||||
@NotNull JetType annotationType,
|
||||
@NotNull Map<ValueParameterDescriptor, CompileTimeConstant<?>> valueArguments
|
||||
@NotNull Map<ValueParameterDescriptor, ConstantValue<?>> valueArguments
|
||||
) {
|
||||
this.annotationType = annotationType;
|
||||
this.valueArguments = Collections.unmodifiableMap(valueArguments);
|
||||
@@ -45,7 +45,7 @@ public class AnnotationDescriptorImpl implements AnnotationDescriptor {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<ValueParameterDescriptor, CompileTimeConstant<?>> getAllValueArguments() {
|
||||
public Map<ValueParameterDescriptor, ConstantValue<?>> getAllValueArguments() {
|
||||
return valueArguments;
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.resolve.constants.*;
|
||||
import org.jetbrains.kotlin.resolve.constants.StringValue;
|
||||
|
||||
public abstract class DefaultAnnotationArgumentVisitor<R, D> implements AnnotationArgumentVisitor<R, D> {
|
||||
public abstract R visitValue(@NotNull CompileTimeConstant<?> value, D data);
|
||||
public abstract R visitValue(@NotNull ConstantValue<?> value, D data);
|
||||
|
||||
@Override
|
||||
public R visitLongValue(@NotNull LongValue value, D data) {
|
||||
@@ -92,9 +92,4 @@ public abstract class DefaultAnnotationArgumentVisitor<R, D> implements Annotati
|
||||
public R visitAnnotationValue(AnnotationValue value, D data) {
|
||||
return visitValue(value, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R visitNumberTypeValue(IntegerValueTypeConstant value, D data) {
|
||||
return visitValue(value, data);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue;
|
||||
import org.jetbrains.kotlin.storage.NullableLazyValue;
|
||||
import org.jetbrains.kotlin.types.JetType;
|
||||
import org.jetbrains.kotlin.types.LazyType;
|
||||
@@ -32,7 +32,7 @@ import java.util.Set;
|
||||
|
||||
public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRootImpl implements VariableDescriptor {
|
||||
private JetType outType;
|
||||
protected NullableLazyValue<CompileTimeConstant<?>> compileTimeInitializer;
|
||||
protected NullableLazyValue<ConstantValue<?>> compileTimeInitializer;
|
||||
|
||||
public VariableDescriptorImpl(
|
||||
@NotNull DeclarationDescriptor containingDeclaration,
|
||||
@@ -59,7 +59,7 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public CompileTimeConstant<?> getCompileTimeInitializer() {
|
||||
public ConstantValue<?> getCompileTimeInitializer() {
|
||||
// Force computation and setting of compileTimeInitializer, if needed
|
||||
if (compileTimeInitializer == null && outType instanceof LazyType) {
|
||||
outType.getConstructor();
|
||||
@@ -71,7 +71,7 @@ public abstract class VariableDescriptorImpl extends DeclarationDescriptorNonRoo
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setCompileTimeInitializer(@NotNull NullableLazyValue<CompileTimeConstant<?>> compileTimeInitializer) {
|
||||
public void setCompileTimeInitializer(@NotNull NullableLazyValue<ConstantValue<?>> compileTimeInitializer) {
|
||||
assert !isVar() : "Compile-time value for property initializer should be recorded only for final variables " + getName();
|
||||
this.compileTimeInitializer = compileTimeInitializer;
|
||||
}
|
||||
|
||||
@@ -20,23 +20,20 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotated
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.DefaultAnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.descriptors.impl.DeclarationDescriptorVisitorEmptyBodies
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.FqNameBase
|
||||
import org.jetbrains.kotlin.name.FqNameUnsafe
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject
|
||||
import org.jetbrains.kotlin.resolve.constants.AnnotationValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ArrayValue
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.resolve.constants.KClassValue
|
||||
import org.jetbrains.kotlin.types.*
|
||||
import org.jetbrains.kotlin.types.ErrorUtils.UninferredParameterTypeConstructor
|
||||
import org.jetbrains.kotlin.types.error.MissingDependencyErrorClass
|
||||
import org.jetbrains.kotlin.utils.*
|
||||
|
||||
import java.util.*
|
||||
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject
|
||||
import org.jetbrains.kotlin.types.TypeUtils.CANT_INFER_FUNCTION_PARAM_TYPE
|
||||
import org.jetbrains.kotlin.types.error.MissingDependencyErrorClass
|
||||
import java.util.ArrayList
|
||||
|
||||
internal class DescriptorRendererImpl(
|
||||
val options: DescriptorRendererOptionsImpl
|
||||
@@ -384,7 +381,7 @@ internal class DescriptorRendererImpl(
|
||||
return (defaultList + argumentList).sort()
|
||||
}
|
||||
|
||||
private fun renderConstant(value: CompileTimeConstant<*>): String {
|
||||
private fun renderConstant(value: ConstantValue<*>): String {
|
||||
return when (value) {
|
||||
is ArrayValue -> value.value.map { renderConstant(it) }.joinToString(", ", "{", "}")
|
||||
is AnnotationValue -> renderAnnotation(value.value)
|
||||
@@ -709,9 +706,8 @@ internal class DescriptorRendererImpl(
|
||||
|
||||
private fun renderInitializer(variable: VariableDescriptor, builder: StringBuilder) {
|
||||
if (includePropertyConstant) {
|
||||
val initializer = variable.getCompileTimeInitializer()
|
||||
if (initializer != null) {
|
||||
builder.append(" = ").append(escape(renderConstant(initializer)))
|
||||
variable.getCompileTimeInitializer()?.let { constant ->
|
||||
builder.append(" = ").append(escape(renderConstant(constant)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class AnnotationValue(value: AnnotationDescriptor) :
|
||||
CompileTimeConstant<AnnotationDescriptor>(value, CompileTimeConstant.Parameters.Impl(true, false, false)) {
|
||||
public class AnnotationValue(value: AnnotationDescriptor) : ConstantValue<AnnotationDescriptor>(value) {
|
||||
override val type: JetType
|
||||
get() = value.getType()
|
||||
|
||||
|
||||
@@ -19,23 +19,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import java.util.*
|
||||
|
||||
public class ArrayValue(
|
||||
value: List<CompileTimeConstant<*>>,
|
||||
override val type: JetType,
|
||||
parameters: CompileTimeConstant.Parameters
|
||||
) : CompileTimeConstant<List<CompileTimeConstant<*>>>(value, parameters) {
|
||||
|
||||
public constructor(
|
||||
value: List<CompileTimeConstant<*>>,
|
||||
type: JetType,
|
||||
usesVariableAsConstant: Boolean
|
||||
) : this(value, type, CompileTimeConstant.Parameters.Impl(true, false, usesVariableAsConstant))
|
||||
|
||||
override fun canBeUsedInAnnotations() = true
|
||||
override fun isPure() = false
|
||||
|
||||
value: List<ConstantValue<*>>,
|
||||
override val type: JetType
|
||||
) : ConstantValue<List<ConstantValue<*>>>(value) {
|
||||
init {
|
||||
assert(KotlinBuiltIns.isArray(type) || KotlinBuiltIns.isPrimitiveArray(type)) { "Type should be an array, but was " + type + ": " + value }
|
||||
}
|
||||
|
||||
@@ -18,15 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class BooleanValue(
|
||||
value: Boolean,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : CompileTimeConstant<Boolean>(value, parameters) {
|
||||
override fun isPure(): Boolean = false
|
||||
|
||||
) : ConstantValue<Boolean>(value) {
|
||||
override val type = builtIns.getBooleanType()
|
||||
|
||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitBooleanValue(this, data)
|
||||
|
||||
@@ -18,13 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class ByteValue(
|
||||
value: Byte,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : IntegerValueConstant<Byte>(value, parameters) {
|
||||
) : IntegerValueConstant<Byte>(value) {
|
||||
|
||||
override val type = builtIns.getByteType()
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class CharValue(
|
||||
value: Char,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : IntegerValueConstant<Char>(value, parameters) {
|
||||
) : IntegerValueConstant<Char>(value) {
|
||||
|
||||
override val type = builtIns.getCharType()
|
||||
|
||||
@@ -37,7 +35,7 @@ public class CharValue(
|
||||
'\b' -> return "\\b"
|
||||
'\t' -> return "\\t"
|
||||
'\n' -> return "\\n"
|
||||
//TODO_R: can't escape form feed in Kotlin
|
||||
//TODO: KT-8507
|
||||
12.toChar() -> return "\\f"
|
||||
'\r' -> return "\\r"
|
||||
else -> return if (isPrintableUnicode(c)) Character.toString(c) else "?"
|
||||
|
||||
+70
-29
@@ -17,43 +17,84 @@
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
public abstract class CompileTimeConstant<T> protected constructor(
|
||||
public open val value: T,
|
||||
public val parameters: CompileTimeConstant.Parameters
|
||||
) {
|
||||
public open fun canBeUsedInAnnotations(): Boolean = parameters.canBeUsedInAnnotation
|
||||
public interface CompileTimeConstant<out T> {
|
||||
public val isError: Boolean
|
||||
get() = false
|
||||
|
||||
public open fun isPure(): Boolean = parameters.isPure
|
||||
public val parameters: CompileTimeConstant.Parameters
|
||||
|
||||
public open fun usesVariableAsConstant(): Boolean = parameters.usesVariableAsConstant
|
||||
public fun toConstantValue(expectedType: JetType): ConstantValue<T>
|
||||
|
||||
public abstract val type: JetType
|
||||
public fun getValue(expectedType: JetType): T = toConstantValue(expectedType).value
|
||||
|
||||
public abstract fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D): R
|
||||
public val canBeUsedInAnnotations: Boolean get() = parameters.canBeUsedInAnnotation
|
||||
|
||||
override fun toString() = value.toString()
|
||||
public val usesVariableAsConstant: Boolean get() = parameters.usesVariableAsConstant
|
||||
|
||||
public interface Parameters {
|
||||
public open val canBeUsedInAnnotation: Boolean
|
||||
public open val isPure: Boolean
|
||||
public open val usesVariableAsConstant: Boolean
|
||||
public val isPure: Boolean get() = parameters.isPure
|
||||
|
||||
public class Impl(
|
||||
override val canBeUsedInAnnotation: Boolean,
|
||||
override val isPure: Boolean,
|
||||
override val usesVariableAsConstant: Boolean
|
||||
) : Parameters
|
||||
public class Parameters(
|
||||
public val canBeUsedInAnnotation: Boolean,
|
||||
public val isPure: Boolean,
|
||||
public val usesVariableAsConstant: Boolean
|
||||
)
|
||||
}
|
||||
|
||||
public object ThrowException : Parameters {
|
||||
override val canBeUsedInAnnotation: Boolean
|
||||
get() = error("Should not be called")
|
||||
override val isPure: Boolean
|
||||
get() = error("Should not be called")
|
||||
override val usesVariableAsConstant: Boolean
|
||||
get() = error("Should not be called")
|
||||
public class TypedCompileTimeConstant<out T>(
|
||||
public val constantValue: ConstantValue<T>,
|
||||
override val parameters: CompileTimeConstant.Parameters
|
||||
) : CompileTimeConstant<T> {
|
||||
override val isError: Boolean
|
||||
get() = constantValue is ErrorValue
|
||||
|
||||
public val type: JetType = constantValue.type
|
||||
|
||||
override fun toConstantValue(expectedType: JetType): ConstantValue<T> = constantValue
|
||||
}
|
||||
|
||||
public fun <T> ConstantValue<T>.wrap(parameters: CompileTimeConstant.Parameters): TypedCompileTimeConstant<T>
|
||||
= TypedCompileTimeConstant(this, parameters)
|
||||
|
||||
public fun <T> ConstantValue<T>.wrap(
|
||||
canBeUsedInAnnotation: Boolean = this !is NullValue,
|
||||
isPure: Boolean = false,
|
||||
usesVariableAsConstant: Boolean = false
|
||||
): TypedCompileTimeConstant<T>
|
||||
= wrap(CompileTimeConstant.Parameters(canBeUsedInAnnotation, isPure, usesVariableAsConstant))
|
||||
|
||||
public class IntegerValueTypeConstant(
|
||||
private val value: Number,
|
||||
override val parameters: CompileTimeConstant.Parameters
|
||||
) : CompileTimeConstant<Number> {
|
||||
private val typeConstructor = IntegerValueTypeConstructor(value.toLong())
|
||||
|
||||
override fun toConstantValue(expectedType: JetType): ConstantValue<Number> {
|
||||
val factory = ConstantValueFactory(KotlinBuiltIns.getInstance())
|
||||
return when (getType(expectedType)) {
|
||||
KotlinBuiltIns.getInstance().getIntType() -> {
|
||||
factory.createIntValue(value.toInt())
|
||||
}
|
||||
KotlinBuiltIns.getInstance().getByteType() -> {
|
||||
factory.createByteValue(value.toByte())
|
||||
}
|
||||
KotlinBuiltIns.getInstance().getShortType() -> {
|
||||
factory.createShortValue(value.toShort())
|
||||
}
|
||||
else -> {
|
||||
factory.createLongValue(value.toLong())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val unknownIntegerType = JetTypeImpl(
|
||||
Annotations.EMPTY, typeConstructor, false, emptyList<TypeProjection>(),
|
||||
ErrorUtils.createErrorScope("Scope for number value type (" + typeConstructor.toString() + ")", true)
|
||||
)
|
||||
|
||||
public fun getType(expectedType: JetType): JetType = TypeUtils.getPrimitiveNumberType(typeConstructor, expectedType)
|
||||
|
||||
override fun toString() = typeConstructor.toString()
|
||||
}
|
||||
|
||||
-125
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
|
||||
public class CompileTimeConstantFactory(
|
||||
private val parameters: CompileTimeConstant.Parameters,
|
||||
private val builtins: KotlinBuiltIns
|
||||
) {
|
||||
fun createLongValue(value: Long) = LongValue(value, parameters, builtins)
|
||||
|
||||
fun createIntValue(value: Int) = IntValue(value, parameters, builtins)
|
||||
|
||||
fun createErrorValue(message: String) = ErrorValue.create(message)
|
||||
|
||||
fun createShortValue(value: Short) = ShortValue(value, parameters, builtins)
|
||||
|
||||
fun createByteValue(value: Byte) = ByteValue(value, parameters, builtins)
|
||||
|
||||
fun createDoubleValue(value: Double) = DoubleValue(value, parameters, builtins)
|
||||
|
||||
fun createFloatValue(value: Float) = FloatValue(value, parameters, builtins)
|
||||
|
||||
fun createBooleanValue(value: Boolean) = BooleanValue(value, parameters, builtins)
|
||||
|
||||
fun createCharValue(value: Char) = CharValue(value, parameters, builtins)
|
||||
|
||||
fun createStringValue(value: String) = StringValue(value, parameters, builtins)
|
||||
|
||||
fun createNullValue() = NullValue(builtins)
|
||||
|
||||
fun createEnumValue(enumEntryClass: ClassDescriptor): EnumValue = EnumValue(enumEntryClass)
|
||||
|
||||
fun createArrayValue(
|
||||
value: List<CompileTimeConstant<*>>,
|
||||
type: JetType
|
||||
) = ArrayValue(value, type, parameters)
|
||||
|
||||
fun createAnnotationValue(value: AnnotationDescriptor) = AnnotationValue(value)
|
||||
|
||||
fun createKClassValue(type: JetType) = KClassValue(type)
|
||||
|
||||
fun createNumberTypeValue(value: Number) = IntegerValueTypeConstant(value, parameters)
|
||||
|
||||
|
||||
fun createCompileTimeConstant(
|
||||
value: Any?,
|
||||
expectedType: JetType? = null
|
||||
): CompileTimeConstant<*>? {
|
||||
// TODO: primitive arrays
|
||||
if (expectedType == null) {
|
||||
when (value) {
|
||||
is Byte -> return createByteValue(value)
|
||||
is Short -> return createShortValue(value)
|
||||
is Int -> return createIntValue(value)
|
||||
is Long -> return createLongValue(value)
|
||||
}
|
||||
}
|
||||
return when (value) {
|
||||
is Byte, is Short, is Int, is Long -> getIntegerValue((value as Number).toLong(), expectedType)
|
||||
is Char -> createCharValue(value)
|
||||
is Float -> createFloatValue(value)
|
||||
is Double -> createDoubleValue(value)
|
||||
is Boolean -> createBooleanValue(value)
|
||||
is String -> createStringValue(value)
|
||||
null -> createNullValue()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
private fun getIntegerValue(
|
||||
value: Long,
|
||||
expectedType: JetType
|
||||
): CompileTimeConstant<*>? {
|
||||
fun defaultIntegerValue(value: Long) = when (value) {
|
||||
value.toInt().toLong() -> createIntValue(value.toInt())
|
||||
else -> createLongValue(value)
|
||||
}
|
||||
|
||||
if (TypeUtils.noExpectedType(expectedType) || expectedType.isError()) {
|
||||
return createNumberTypeValue(value)
|
||||
}
|
||||
|
||||
val notNullExpected = TypeUtils.makeNotNullable(expectedType)
|
||||
return when {
|
||||
KotlinBuiltIns.isLong(notNullExpected) -> createLongValue(value)
|
||||
|
||||
KotlinBuiltIns.isShort(notNullExpected) ->
|
||||
if (value == value.toShort().toLong())
|
||||
createShortValue(value.toShort())
|
||||
else
|
||||
defaultIntegerValue(value)
|
||||
|
||||
KotlinBuiltIns.isByte(notNullExpected) ->
|
||||
if (value == value.toByte().toLong())
|
||||
createByteValue(value.toByte())
|
||||
else
|
||||
defaultIntegerValue(value)
|
||||
|
||||
KotlinBuiltIns.isChar(notNullExpected) ->
|
||||
createIntValue(value.toInt())
|
||||
|
||||
else -> defaultIntegerValue(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public abstract class ConstantValue<out T>(public open val value: T) {
|
||||
public abstract val type: JetType
|
||||
|
||||
public abstract fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D): R
|
||||
|
||||
override fun toString() = value.toString()
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.TypeUtils
|
||||
|
||||
public class ConstantValueFactory(
|
||||
private val builtins: KotlinBuiltIns
|
||||
) {
|
||||
fun createLongValue(value: Long) = LongValue(value, builtins)
|
||||
|
||||
fun createIntValue(value: Int) = IntValue(value, builtins)
|
||||
|
||||
fun createErrorValue(message: String) = ErrorValue.create(message)
|
||||
|
||||
fun createShortValue(value: Short) = ShortValue(value, builtins)
|
||||
|
||||
fun createByteValue(value: Byte) = ByteValue(value, builtins)
|
||||
|
||||
fun createDoubleValue(value: Double) = DoubleValue(value, builtins)
|
||||
|
||||
fun createFloatValue(value: Float) = FloatValue(value, builtins)
|
||||
|
||||
fun createBooleanValue(value: Boolean) = BooleanValue(value, builtins)
|
||||
|
||||
fun createCharValue(value: Char) = CharValue(value, builtins)
|
||||
|
||||
fun createStringValue(value: String) = StringValue(value, builtins)
|
||||
|
||||
fun createNullValue() = NullValue(builtins)
|
||||
|
||||
fun createEnumValue(enumEntryClass: ClassDescriptor): EnumValue = EnumValue(enumEntryClass)
|
||||
|
||||
fun createArrayValue(
|
||||
value: List<ConstantValue<*>>,
|
||||
type: JetType
|
||||
) = ArrayValue(value, type)
|
||||
|
||||
fun createAnnotationValue(value: AnnotationDescriptor) = AnnotationValue(value)
|
||||
|
||||
fun createKClassValue(type: JetType) = KClassValue(type)
|
||||
|
||||
fun createConstantValue(
|
||||
value: Any?
|
||||
): ConstantValue<*>? {
|
||||
// TODO: primitive arrays
|
||||
return when (value) {
|
||||
is Byte -> createByteValue(value)
|
||||
is Short -> createShortValue(value)
|
||||
is Int -> createIntValue(value)
|
||||
is Long -> createLongValue(value)
|
||||
is Char -> createCharValue(value)
|
||||
is Float -> createFloatValue(value)
|
||||
is Double -> createDoubleValue(value)
|
||||
is Boolean -> createBooleanValue(value)
|
||||
is String -> createStringValue(value)
|
||||
null -> createNullValue()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
public fun createIntegerConstantValue(
|
||||
value: Long,
|
||||
expectedType: JetType
|
||||
): ConstantValue<*>? {
|
||||
val notNullExpected = TypeUtils.makeNotNullable(expectedType)
|
||||
return when {
|
||||
KotlinBuiltIns.isLong(notNullExpected) -> createLongValue(value)
|
||||
KotlinBuiltIns.isInt(notNullExpected) && value == value.toInt().toLong() -> createIntValue(value.toInt())
|
||||
KotlinBuiltIns.isShort(notNullExpected) && value == value.toShort().toLong() -> createShortValue(value.toShort())
|
||||
KotlinBuiltIns.isByte(notNullExpected) && value == value.toByte().toLong() -> createByteValue(value.toByte())
|
||||
KotlinBuiltIns.isChar(notNullExpected) -> createIntValue(value.toInt())
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class DoubleValue(
|
||||
value: Double,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : CompileTimeConstant<Double>(value, parameters) {
|
||||
|
||||
override fun isPure() = false
|
||||
|
||||
) : ConstantValue<Double>(value) {
|
||||
override val type = builtIns.getDoubleType()
|
||||
|
||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitDoubleValue(this, data)
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.classObjectType
|
||||
@@ -25,7 +24,7 @@ import org.jetbrains.kotlin.utils.sure
|
||||
|
||||
public class EnumValue(
|
||||
value: ClassDescriptor
|
||||
) : CompileTimeConstant<ClassDescriptor>(value, CompileTimeConstant.Parameters.Impl(true, false, false)) {
|
||||
) : ConstantValue<ClassDescriptor>(value) {
|
||||
|
||||
override val type: JetType
|
||||
get() = value.classObjectType.sure { "Enum entry must have a class object type: " + value }
|
||||
|
||||
@@ -16,12 +16,10 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public abstract class ErrorValue : CompileTimeConstant<Unit>(Unit, CompileTimeConstant.Parameters.Impl(true, false, false)) {
|
||||
public abstract class ErrorValue : ConstantValue<Unit>(Unit) {
|
||||
|
||||
deprecated("Should not be called, for this is not a real value, but a indication of an error")
|
||||
override val value: Unit
|
||||
|
||||
@@ -18,15 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class FloatValue(
|
||||
value: Float,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : CompileTimeConstant<Float>(value, parameters) {
|
||||
override fun isPure() = false
|
||||
|
||||
) : ConstantValue<Float>(value) {
|
||||
override val type = builtIns.getFloatType()
|
||||
|
||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitFloatValue(this, data)
|
||||
|
||||
@@ -18,13 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class IntValue(
|
||||
value: Int,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : IntegerValueConstant<Int>(value, parameters) {
|
||||
) : IntegerValueConstant<Int>(value) {
|
||||
|
||||
override val type = builtIns.getIntType()
|
||||
|
||||
|
||||
@@ -16,7 +16,4 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
public abstract class IntegerValueConstant<T> protected constructor(
|
||||
value: T,
|
||||
parameters: CompileTimeConstant.Parameters
|
||||
) : CompileTimeConstant<T>(value, parameters)
|
||||
public abstract class IntegerValueConstant<T> protected constructor(value: T) : ConstantValue<T>(value)
|
||||
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
import java.util.Collections
|
||||
|
||||
public class IntegerValueTypeConstant(
|
||||
value: Number,
|
||||
parameters: CompileTimeConstant.Parameters
|
||||
) : IntegerValueConstant<Number>(value, parameters) {
|
||||
|
||||
override fun isPure() = true
|
||||
|
||||
private val typeConstructor = IntegerValueTypeConstructor(value.toLong())
|
||||
|
||||
override val type = JetTypeImpl(
|
||||
Annotations.EMPTY, typeConstructor, false, emptyList<TypeProjection>()
|
||||
, ErrorUtils.createErrorScope("Scope for number value type (" + typeConstructor.toString() + ")", true)
|
||||
)
|
||||
|
||||
deprecated("")
|
||||
override val value: Number
|
||||
get() = throw UnsupportedOperationException("Use IntegerValueTypeConstant.getValue(expectedType) instead")
|
||||
|
||||
public fun getType(expectedType: JetType): JetType = TypeUtils.getPrimitiveNumberType(typeConstructor, expectedType)
|
||||
|
||||
public fun getValue(expectedType: JetType): Number {
|
||||
val numberValue = typeConstructor.getValue()
|
||||
val builtIns = KotlinBuiltIns.getInstance()
|
||||
|
||||
val valueType = getType(expectedType)
|
||||
if (valueType == builtIns.getIntType()) {
|
||||
return numberValue.toInt()
|
||||
}
|
||||
else if (valueType == builtIns.getByteType()) {
|
||||
return numberValue.toByte()
|
||||
}
|
||||
else if (valueType == builtIns.getShortType()) {
|
||||
return numberValue.toShort()
|
||||
}
|
||||
else {
|
||||
return numberValue.toLong()
|
||||
}
|
||||
}
|
||||
|
||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitNumberTypeValue(this, data)
|
||||
|
||||
override fun toString() = typeConstructor.toString()
|
||||
}
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class KClassValue(override val type: JetType) :
|
||||
CompileTimeConstant<JetType>(type, CompileTimeConstant.Parameters.Impl(true, false, false)) {
|
||||
ConstantValue<JetType>(type) {
|
||||
override val value: JetType
|
||||
get() = type.getArguments().single().getType()
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class LongValue(
|
||||
value: Long,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : IntegerValueConstant<Long>(value, parameters) {
|
||||
) : IntegerValueConstant<Long>(value) {
|
||||
|
||||
override val type = builtIns.getLongType()
|
||||
|
||||
|
||||
@@ -18,11 +18,10 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class NullValue(
|
||||
builtIns: KotlinBuiltIns
|
||||
) : CompileTimeConstant<Void?>(null, CompileTimeConstant.Parameters.Impl(false, false, false)) {
|
||||
) : ConstantValue<Void?>(null) {
|
||||
|
||||
override val type = builtIns.getNullableNothingType()
|
||||
|
||||
|
||||
@@ -18,13 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class ShortValue(
|
||||
value: Short,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : IntegerValueConstant<Short>(value, parameters) {
|
||||
) : IntegerValueConstant<Short>(value) {
|
||||
|
||||
override val type = builtIns.getShortType()
|
||||
|
||||
|
||||
@@ -18,15 +18,11 @@ package org.jetbrains.kotlin.resolve.constants
|
||||
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationArgumentVisitor
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
|
||||
public class StringValue(
|
||||
value: String,
|
||||
parameters: CompileTimeConstant.Parameters,
|
||||
builtIns: KotlinBuiltIns
|
||||
) : CompileTimeConstant<String>(value, parameters) {
|
||||
override fun isPure() = false
|
||||
|
||||
) : ConstantValue<String>(value) {
|
||||
override val type = builtIns.getStringType()
|
||||
|
||||
override fun <R, D> accept(visitor: AnnotationArgumentVisitor<R, D>, data: D) = visitor.visitStringValue(this, data)
|
||||
|
||||
+16
-14
@@ -16,22 +16,24 @@
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptorImpl
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
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.serialization.ProtoBuf.Annotation
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Argument.Value.Type
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.name.Name
|
||||
import org.jetbrains.kotlin.resolve.constants.*
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.types.ErrorUtils
|
||||
import org.jetbrains.kotlin.descriptors.ClassKind
|
||||
import org.jetbrains.kotlin.types.JetType
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
import org.jetbrains.kotlin.types.typeUtil.isSubtypeOf
|
||||
|
||||
@@ -39,7 +41,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
||||
private val builtIns: KotlinBuiltIns
|
||||
get() = module.builtIns
|
||||
|
||||
private val factory = CompileTimeConstantFactory(CompileTimeConstant.Parameters.ThrowException, builtIns)
|
||||
private val factory = ConstantValueFactory(builtIns)
|
||||
|
||||
public fun deserializeAnnotation(proto: Annotation, nameResolver: NameResolver): AnnotationDescriptor {
|
||||
val annotationClass = resolveClass(nameResolver.getClassId(proto.getId()))
|
||||
@@ -60,7 +62,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
||||
proto: Argument,
|
||||
parameterByName: Map<Name, ValueParameterDescriptor>,
|
||||
nameResolver: NameResolver
|
||||
): Pair<ValueParameterDescriptor, CompileTimeConstant<*>>? {
|
||||
): Pair<ValueParameterDescriptor, ConstantValue<*>>? {
|
||||
val parameter = parameterByName[nameResolver.getName(proto.getNameId())] ?: return null
|
||||
return Pair(parameter, resolveValue(parameter.getType(), proto.getValue(), nameResolver))
|
||||
}
|
||||
@@ -69,8 +71,8 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
||||
expectedType: JetType,
|
||||
value: Value,
|
||||
nameResolver: NameResolver
|
||||
): CompileTimeConstant<*> {
|
||||
val result = when (value.getType()) {
|
||||
): ConstantValue<*> {
|
||||
val result: ConstantValue<*> = when (value.getType()) {
|
||||
Type.BYTE -> factory.createByteValue(value.getIntValue().toByte())
|
||||
Type.CHAR -> factory.createCharValue(value.getIntValue().toChar())
|
||||
Type.SHORT -> factory.createShortValue(value.getIntValue().toShort())
|
||||
@@ -131,7 +133,7 @@ public class AnnotationDeserializer(private val module: ModuleDescriptor) {
|
||||
}
|
||||
|
||||
// NOTE: see analogous code in BinaryClassAnnotationAndConstantLoaderImpl
|
||||
private fun resolveEnumValue(enumClassId: ClassId, enumEntryName: Name): CompileTimeConstant<*> {
|
||||
private fun resolveEnumValue(enumClassId: ClassId, enumEntryName: Name): ConstantValue<*> {
|
||||
val enumClass = resolveClass(enumClassId)
|
||||
if (enumClass.getKind() == ClassKind.ENUM_CLASS) {
|
||||
val enumEntry = enumClass.getUnsubstitutedInnerClassesScope().getClassifier(enumEntryName)
|
||||
|
||||
+12
-4
@@ -16,14 +16,22 @@
|
||||
|
||||
package org.jetbrains.kotlin.serialization.deserialization
|
||||
|
||||
import org.jetbrains.kotlin.serialization.*
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
import org.jetbrains.kotlin.descriptors.impl.*
|
||||
import org.jetbrains.kotlin.descriptors.impl.ConstructorDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.PropertyGetterDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.PropertySetterDescriptorImpl
|
||||
import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl
|
||||
import org.jetbrains.kotlin.resolve.DescriptorFactory
|
||||
import org.jetbrains.kotlin.serialization.Flags
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.*
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.FUN
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.VAL
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf.Callable.CallableKind.VAR
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedAnnotations
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedClassDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor
|
||||
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor
|
||||
|
||||
public class MemberDeserializer(private val c: DeserializationContext) {
|
||||
public fun loadCallable(proto: Callable): CallableMemberDescriptor {
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.serialization.deserialization
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
import org.jetbrains.kotlin.resolve.constants.CompileTimeConstant
|
||||
import org.jetbrains.kotlin.resolve.constants.ConstantValue
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
|
||||
@@ -27,7 +27,7 @@ public class DeserializationComponents(
|
||||
public val storageManager: StorageManager,
|
||||
public val moduleDescriptor: ModuleDescriptor,
|
||||
public val classDataFinder: ClassDataFinder,
|
||||
public val annotationAndConstantLoader: AnnotationAndConstantLoader<AnnotationDescriptor, CompileTimeConstant<*>>,
|
||||
public val annotationAndConstantLoader: AnnotationAndConstantLoader<AnnotationDescriptor, ConstantValue<*>>,
|
||||
public val packageFragmentProvider: PackageFragmentProvider,
|
||||
public val localClassResolver: LocalClassResolver,
|
||||
public val flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer,
|
||||
|
||||
Reference in New Issue
Block a user