Serialize compile time constant for property initializer
This commit is contained in:
+8
-4
@@ -20,11 +20,10 @@ import kotlin.Function1;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor;
|
||||
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
|
||||
import org.jetbrains.jet.lang.resolve.constants.*;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaDescriptorResolver;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.ErrorReporter;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.ResolverPackage;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolver;
|
||||
import org.jetbrains.jet.storage.MemoizedFunctionToNotNull;
|
||||
@@ -87,8 +86,13 @@ public class DescriptorDeserializersStorage {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public KotlinJvmBinaryClass.AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc) {
|
||||
return new MemberAnnotationVisitor(MemberSignature.fromFieldNameAndDesc(name, desc));
|
||||
public KotlinJvmBinaryClass.AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc, @Nullable Object initializer) {
|
||||
MemberSignature signature = MemberSignature.fromFieldNameAndDesc(name, desc);
|
||||
if (initializer != null) {
|
||||
propertyConstants.put(signature, ConstantUtils.createCompileTimeConstant(
|
||||
initializer, /* canBeUsedInAnnotation */ true, /* isPureIntConstant */ true, /* expectedType */ null));
|
||||
}
|
||||
return new MemberAnnotationVisitor(signature);
|
||||
}
|
||||
|
||||
class AnnotationVisitorForMethod extends MemberAnnotationVisitor implements KotlinJvmBinaryClass.MethodAnnotationVisitor {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public interface KotlinJvmBinaryClass {
|
||||
MethodAnnotationVisitor visitMethod(@NotNull Name name, @NotNull String desc);
|
||||
|
||||
@Nullable
|
||||
AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc);
|
||||
AnnotationVisitor visitField(@NotNull Name name, @NotNull String desc, @Nullable Object initializer);
|
||||
}
|
||||
|
||||
interface AnnotationVisitor {
|
||||
|
||||
Reference in New Issue
Block a user