From 4f12a3d86e3628edbaab9edc2e58528adf8131a0 Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Fri, 31 May 2013 17:42:46 +0400 Subject: [PATCH] Stub support for annotations --- .../serialization/src/descriptors.proto | 14 +- .../serialization/AbstractClassResolver.java | 10 +- .../serialization/DescriptorDeserializer.java | 45 +- .../serialization/DescriptorSerializer.java | 16 +- .../jet/descriptors/serialization/Flags.java | 37 +- .../descriptors/serialization/ProtoBuf.java | 695 +++--------------- .../descriptors/AnnotationDeserializer.java | 48 ++ .../DeserializedClassDescriptor.java | 28 +- .../AbstractDescriptorSerializationTest.java | 38 +- .../BuiltinsDeserializationTest.java | 21 +- 10 files changed, 290 insertions(+), 662 deletions(-) create mode 100644 compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java diff --git a/compiler/frontend/serialization/src/descriptors.proto b/compiler/frontend/serialization/src/descriptors.proto index 5c2e09e682d..4449905d8d9 100644 --- a/compiler/frontend/serialization/src/descriptors.proto +++ b/compiler/frontend/serialization/src/descriptors.proto @@ -101,14 +101,13 @@ message Class { /* Visibility Modality + has_annotation ClassKind is_inner */ - optional int32 flags = 1 [default = 0 /*internal final class*/]; + optional int32 flags = 1 [default = 0 /*internal final class, no annotations*/]; optional string extra_visibility = 2; // for things like java-specific visibilities - repeated Annotation annotations = 3; - required int32 name = 4; repeated TypeParameter typeParameters = 5; @@ -147,17 +146,17 @@ message Callable { /* Visibility Modality + has_annotations fun/val/var/constructor Kind inline setter::Modality setter::Visibility + setter::has_annotations */ optional int32 flags = 1; optional string extra_visibility = 2; // for things like java-specific visibilities - repeated Annotation annotations = 3; - repeated TypeParameter typeParameters = 4; optional Type receiverType = 5; @@ -167,6 +166,7 @@ message Callable { message ValueParameter { /* declaresDefault + has_annotations */ optional int32 flags = 1; required int32 name = 2; @@ -194,8 +194,4 @@ enum Visibility { PROTECTED = 0x02; PUBLIC = 0x03; EXTRA = 0x04; // there's an extra field for the actual visibility -} - -message Annotation { - // TODO ??? } \ No newline at end of file diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractClassResolver.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractClassResolver.java index 3c0782edfa3..dea6cd941c6 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractClassResolver.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractClassResolver.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.descriptors.serialization; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer; import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedClassDescriptor; import org.jetbrains.jet.lang.descriptors.ClassDescriptor; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; @@ -31,9 +32,11 @@ public abstract class AbstractClassResolver implements ClassResolver { private final NameResolver nameResolver; private final NestedClassResolver nestedClassResolver; private final MemoizedFunctionToNotNull findClass; + private final AnnotationDeserializer annotationDeserializer; - public AbstractClassResolver(@NotNull NameResolver nameResolver) { + public AbstractClassResolver(@NotNull NameResolver nameResolver, @NotNull AnnotationDeserializer annotationDeserializer) { this.nameResolver = nameResolver; + this.annotationDeserializer = annotationDeserializer; this.nestedClassResolver = new NestedClassResolver() { @Nullable @@ -55,11 +58,14 @@ public abstract class AbstractClassResolver implements ClassResolver { protected ClassDescriptor doCompute(ClassId classId) { ProtoBuf.Class classProto = getClassProto(classId); assert classProto != null : "No class found: " + classId; + DeclarationDescriptor owner = classId.isTopLevelClass() ? getPackage(classId.getPackageFqName()) : findClass(classId.getOuterClassId()); assert owner != null : "No owner found for " + classId; + + AbstractClassResolver outer = AbstractClassResolver.this; ClassDescriptor classDescriptor = new DeserializedClassDescriptor( - owner, AbstractClassResolver.this.nameResolver, AbstractClassResolver.this, nestedClassResolver, classProto, null + owner, outer.nameResolver, outer.annotationDeserializer, outer, nestedClassResolver, classProto, null ); classDescriptorCreated(classDescriptor); return classDescriptor; diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java index e06d9c5abbe..1b4e188e22d 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorDeserializer.java @@ -17,6 +17,7 @@ package org.jetbrains.jet.descriptors.serialization; import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.Modality; import org.jetbrains.jet.lang.descriptors.Visibility; @@ -36,32 +37,38 @@ public class DescriptorDeserializer { public static DescriptorDeserializer create( @NotNull DeclarationDescriptor containingDeclaration, @NotNull NameResolver nameResolver, - @NotNull ClassResolver classResolver + @NotNull ClassResolver classResolver, + @NotNull AnnotationDeserializer annotationDeserializer ) { - return new DescriptorDeserializer(new TypeDeserializer(null, nameResolver, classResolver), containingDeclaration, nameResolver); + return new DescriptorDeserializer(new TypeDeserializer(null, nameResolver, classResolver), containingDeclaration, nameResolver, + annotationDeserializer); } @NotNull public static DescriptorDeserializer create( @NotNull TypeDeserializer typeDeserializer, @NotNull DeclarationDescriptor containingDeclaration, - @NotNull NameResolver nameResolver + @NotNull NameResolver nameResolver, + @NotNull AnnotationDeserializer annotationDeserializer ) { - return new DescriptorDeserializer(typeDeserializer, containingDeclaration, nameResolver); + return new DescriptorDeserializer(typeDeserializer, containingDeclaration, nameResolver, annotationDeserializer); } private final DeclarationDescriptor containingDeclaration; private final NameResolver nameResolver; private final TypeDeserializer typeDeserializer; + private final AnnotationDeserializer annotationDeserializer; private DescriptorDeserializer( @NotNull TypeDeserializer typeDeserializer, @NotNull DeclarationDescriptor containingDeclaration, - @NotNull NameResolver nameResolver + @NotNull NameResolver nameResolver, + @NotNull AnnotationDeserializer annotationDeserializer ) { this.typeDeserializer = typeDeserializer; this.containingDeclaration = containingDeclaration; this.nameResolver = nameResolver; + this.annotationDeserializer = annotationDeserializer; } @NotNull @@ -71,7 +78,7 @@ public class DescriptorDeserializer { @NotNull private DescriptorDeserializer createChildDeserializer(@NotNull DeclarationDescriptor descriptor) { - return create(new TypeDeserializer(typeDeserializer), descriptor, nameResolver); + return create(new TypeDeserializer(typeDeserializer), descriptor, nameResolver, annotationDeserializer); } @NotNull @@ -94,8 +101,7 @@ public class DescriptorDeserializer { int flags = proto.getFlags(); PropertyDescriptorImpl property = new PropertyDescriptorImpl( containingDeclaration, - // TODO: annotations - Collections.emptyList(), + getAnnotations(proto), modality(Flags.getModality(flags)), visibility(Flags.getVisibility(flags)), Flags.getCallableKind(flags) == Callable.CallableKind.VAR, @@ -119,8 +125,7 @@ public class DescriptorDeserializer { int flags = proto.getFlags(); SimpleFunctionDescriptorImpl function = new SimpleFunctionDescriptorImpl( containingDeclaration, - // TODO: annotations - Collections.emptyList(), + getAnnotations(proto), nameResolver.getName(proto.getName()), memberKind(Flags.getMemberKind(flags)) ); @@ -146,8 +151,7 @@ public class DescriptorDeserializer { ClassDescriptor classDescriptor = (ClassDescriptor) containingDeclaration; ConstructorDescriptorImpl descriptor = new ConstructorDescriptorImpl( classDescriptor, - // TODO - Collections.emptyList(), + getAnnotations(proto), // TODO: primary true); DescriptorDeserializer local = createChildDeserializer(descriptor); @@ -160,6 +164,12 @@ public class DescriptorDeserializer { return descriptor; } + private List getAnnotations(Callable proto) { + return Flags.hasAnnotations(proto.getFlags()) + ? annotationDeserializer.loadCallableAnnotations(proto) + : Collections.emptyList(); + } + private static CallableMemberDescriptor.Kind memberKind(Callable.MemberKind memberKind) { switch (memberKind) { case DECLARATION: @@ -247,7 +257,7 @@ public class DescriptorDeserializer { int id = proto.getId(); TypeParameterDescriptorImpl descriptor = TypeParameterDescriptorImpl.createForFurtherModification( containingDeclaration, - // TODO + // TODO (type parameter annotations are not supported in Java 7) Collections.emptyList(), proto.getReified(), variance(proto.getVariance()), @@ -291,11 +301,16 @@ public class DescriptorDeserializer { return new ValueParameterDescriptorImpl( containingDeclaration, index, - // TODO - Collections.emptyList(), + getAnnotations(proto), nameResolver.getName(proto.getName()), typeDeserializer.type(proto.getType()), Flags.declaresDefaultValue(proto.getFlags()), typeDeserializer.typeOrNull(proto.hasVarargElementType() ? proto.getVarargElementType() : null)); } + + private List getAnnotations(Callable.ValueParameter proto) { + return Flags.hasAnnotations(proto.getFlags()) + ? annotationDeserializer.loadValueParameterAnnotations(proto) + : Collections.emptyList(); + } } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java index 6003ba12894..bcc05b4ce8d 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.descriptors.serialization; import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.*; +import org.jetbrains.jet.lang.descriptors.annotations.Annotated; import org.jetbrains.jet.lang.types.JetType; import org.jetbrains.jet.lang.types.TypeConstructor; import org.jetbrains.jet.lang.types.TypeProjection; @@ -52,10 +53,8 @@ public class DescriptorSerializer { public ProtoBuf.Class.Builder classProto(@NotNull ClassDescriptor classDescriptor) { ProtoBuf.Class.Builder builder = ProtoBuf.Class.newBuilder(); - // TODO annotations - - int flags = Flags.getClassFlags(classDescriptor.getVisibility(), classDescriptor.getModality(), classDescriptor.getKind(), - classDescriptor.isInner()); + int flags = Flags.getClassFlags(hasAnnotations(classDescriptor), classDescriptor.getVisibility(), + classDescriptor.getModality(), classDescriptor.getKind(), classDescriptor.isInner()); builder.setFlags(flags); // TODO extra visibility @@ -111,7 +110,8 @@ public class DescriptorSerializer { ProtoBuf.Callable.Builder builder = ProtoBuf.Callable.newBuilder(); // TODO setter flags - builder.setFlags(Flags.getCallableFlags(descriptor.getVisibility(), + // TODO setter annotations + builder.setFlags(Flags.getCallableFlags(hasAnnotations(descriptor), descriptor.getVisibility(), descriptor.getModality(), descriptor.getKind(), callableKind(descriptor), @@ -159,7 +159,7 @@ public class DescriptorSerializer { private ProtoBuf.Callable.ValueParameter.Builder valueParameter(ValueParameterDescriptor descriptor) { ProtoBuf.Callable.ValueParameter.Builder builder = ProtoBuf.Callable.ValueParameter.newBuilder(); - builder.setFlags(Flags.getValueParameterFlags(descriptor.declaresDefaultValue())); + builder.setFlags(Flags.getValueParameterFlags(hasAnnotations(descriptor), descriptor.declaresDefaultValue())); builder.setName(nameTable.getSimpleNameIndex(descriptor.getName())); @@ -283,4 +283,8 @@ public class DescriptorSerializer { private int getTypeParameterId(@NotNull TypeParameterDescriptor descriptor) { return typeParameters.intern(descriptor); } + + private static boolean hasAnnotations(Annotated descriptor) { + return !descriptor.getAnnotations().isEmpty(); + } } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java index 95c30287e95..d67db3a0215 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/Flags.java @@ -8,8 +8,11 @@ public class Flags { // Common + public static final int HAS_ANNOTATIONS_BIT_COUNT = 1; + public static final int HAS_ANNOTATIONS_OFFSET = 0; + public static final int VISIBILITY_BIT_COUNT = bitWidth(ProtoBuf.Visibility.values()); - public static final int VISIBILITY_OFFSET = 0; + public static final int VISIBILITY_OFFSET = HAS_ANNOTATIONS_OFFSET + HAS_ANNOTATIONS_BIT_COUNT; public static final int MODALITY_BIT_COUNT = bitWidth(ProtoBuf.Modality.values()); public static final int MODALITY_OFFSET = VISIBILITY_OFFSET + VISIBILITY_BIT_COUNT; @@ -36,7 +39,7 @@ public class Flags { // Parameters public static final int DECLARES_DEFAULT_VALUE_BIT_COUNT = 1; - public static final int DECLARES_DEFAULT_VALUE_OFFSET = 0; + public static final int DECLARES_DEFAULT_VALUE_OFFSET = HAS_ANNOTATIONS_OFFSET + HAS_ANNOTATIONS_BIT_COUNT; // --- @@ -96,13 +99,25 @@ public class Flags { return getValue(flags, BOOLEANS, DECLARES_DEFAULT_VALUE_BIT_COUNT, DECLARES_DEFAULT_VALUE_OFFSET); } - public static int getClassFlags(Visibility visibility, Modality modality, ClassKind kind, boolean inner) { + public static boolean hasAnnotations(int flags) { + return getValue(flags, BOOLEANS, HAS_ANNOTATIONS_BIT_COUNT, HAS_ANNOTATIONS_OFFSET); + } + + public static int getClassFlags( + boolean hasAnnotations, + Visibility visibility, + Modality modality, + ClassKind kind, + boolean inner + ) { + int hasAnnotationsInt = hasAnnotations ? 1 : 0; int visibilityInt = visibility(visibility).getNumber(); int modalityInt = modality(modality).getNumber(); int classKindInt = classKind(kind).getNumber(); int innerInt = inner ? 1 : 0; - return visibilityInt << VISIBILITY_OFFSET + return hasAnnotationsInt << HAS_ANNOTATIONS_OFFSET | modalityInt << MODALITY_OFFSET + | visibilityInt << VISIBILITY_OFFSET | classKindInt << CLASS_KIND_OFFSET | innerInt << INNER_OFFSET ; @@ -129,19 +144,21 @@ public class Flags { } public static int getCallableFlags( - @NotNull Visibility visibility, + boolean hasAnnotations, @NotNull Visibility visibility, @NotNull Modality modality, @NotNull CallableMemberDescriptor.Kind memberKind, @NotNull ProtoBuf.Callable.CallableKind callableKind, boolean inline ) { + int hasAnnotationsInt = hasAnnotations ? 1 : 0; int visibilityInt = visibility(visibility).getNumber(); int modalityInt = modality(modality).getNumber(); int memberKindInt = memberKind(memberKind).getNumber(); int callableKindInt = callableKind.getNumber(); int inlineInt = inline ? 1 : 0; - return visibilityInt << VISIBILITY_OFFSET + return hasAnnotationsInt << HAS_ANNOTATIONS_OFFSET | modalityInt << MODALITY_OFFSET + | visibilityInt << VISIBILITY_OFFSET | memberKindInt << MEMBER_KIND_OFFSET | callableKindInt << CALLABLE_KIND_OFFSET | inlineInt << INLINE_OFFSET @@ -193,9 +210,11 @@ public class Flags { throw new IllegalArgumentException("Unknown member kind: " + kind); } - public static int getValueParameterFlags(boolean declaresDefaultValue) { + public static int getValueParameterFlags(boolean hasAnnotations, boolean declaresDefaultValue) { + int hasAnnotationsInt = hasAnnotations ? 1 : 0; int declaresDefaultValueInt = declaresDefaultValue ? 1 : 0; - return declaresDefaultValueInt << DECLARES_DEFAULT_VALUE_OFFSET - ; + return hasAnnotationsInt << HAS_ANNOTATIONS_OFFSET + | declaresDefaultValueInt << DECLARES_DEFAULT_VALUE_OFFSET + ; } } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java index d2bbbfcf542..a9a46d143b9 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java @@ -3332,12 +3332,6 @@ public final class ProtoBuf { boolean hasExtraVisibility(); String getExtraVisibility(); - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - java.util.List - getAnnotationsList(); - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index); - int getAnnotationsCount(); - // required int32 name = 4; boolean hasName(); int getName(); @@ -3495,27 +3489,6 @@ public final class ProtoBuf { } } - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - public static final int ANNOTATIONS_FIELD_NUMBER = 3; - private java.util.List annotations_; - public java.util.List getAnnotationsList() { - return annotations_; - } - public java.util.List - getAnnotationsOrBuilderList() { - return annotations_; - } - public int getAnnotationsCount() { - return annotations_.size(); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index) { - return annotations_.get(index); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.AnnotationOrBuilder getAnnotationsOrBuilder( - int index) { - return annotations_.get(index); - } - // required int32 name = 4; public static final int NAME_FIELD_NUMBER = 4; private int name_; @@ -3640,7 +3613,6 @@ public final class ProtoBuf { private void initFields() { flags_ = 0; extraVisibility_ = ""; - annotations_ = java.util.Collections.emptyList(); name_ = 0; typeParameters_ = java.util.Collections.emptyList(); supertypes_ = java.util.Collections.emptyList(); @@ -3696,9 +3668,6 @@ public final class ProtoBuf { if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getExtraVisibilityBytes()); } - for (int i = 0; i < annotations_.size(); i++) { - output.writeMessage(3, annotations_.get(i)); - } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(4, name_); } @@ -3739,10 +3708,6 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getExtraVisibilityBytes()); } - for (int i = 0; i < annotations_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, annotations_.get(i)); - } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, name_); @@ -3891,24 +3856,22 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000001); extraVisibility_ = ""; bitField0_ = (bitField0_ & ~0x00000002); - annotations_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); name_ = 0; - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000004); typeParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); supertypes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); nestedClassNames_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); nestedObjectNames_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); classObjectPresent_ = false; - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); primaryConstructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000100); members_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); return this; } @@ -3950,46 +3913,41 @@ public final class ProtoBuf { to_bitField0_ |= 0x00000002; } result.extraVisibility_ = extraVisibility_; - if (((bitField0_ & 0x00000004) == 0x00000004)) { - annotations_ = java.util.Collections.unmodifiableList(annotations_); - bitField0_ = (bitField0_ & ~0x00000004); - } - result.annotations_ = annotations_; - if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.name_ = name_; - if (((bitField0_ & 0x00000010) == 0x00000010)) { + if (((bitField0_ & 0x00000008) == 0x00000008)) { typeParameters_ = java.util.Collections.unmodifiableList(typeParameters_); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); } result.typeParameters_ = typeParameters_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { + if (((bitField0_ & 0x00000010) == 0x00000010)) { supertypes_ = java.util.Collections.unmodifiableList(supertypes_); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } result.supertypes_ = supertypes_; - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { nestedClassNames_ = java.util.Collections.unmodifiableList(nestedClassNames_); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); } result.nestedClassNames_ = nestedClassNames_; - if (((bitField0_ & 0x00000080) == 0x00000080)) { + if (((bitField0_ & 0x00000040) == 0x00000040)) { nestedObjectNames_ = java.util.Collections.unmodifiableList(nestedObjectNames_); - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); } result.nestedObjectNames_ = nestedObjectNames_; - if (((from_bitField0_ & 0x00000100) == 0x00000100)) { + if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000008; } result.classObjectPresent_ = classObjectPresent_; - if (((from_bitField0_ & 0x00000200) == 0x00000200)) { + if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000010; } result.primaryConstructor_ = primaryConstructor_; - if (((bitField0_ & 0x00000400) == 0x00000400)) { + if (((bitField0_ & 0x00000200) == 0x00000200)) { members_ = java.util.Collections.unmodifiableList(members_); - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); } result.members_ = members_; result.bitField0_ = to_bitField0_; @@ -4004,23 +3962,13 @@ public final class ProtoBuf { if (other.hasExtraVisibility()) { setExtraVisibility(other.getExtraVisibility()); } - if (!other.annotations_.isEmpty()) { - if (annotations_.isEmpty()) { - annotations_ = other.annotations_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureAnnotationsIsMutable(); - annotations_.addAll(other.annotations_); - } - - } if (other.hasName()) { setName(other.getName()); } if (!other.typeParameters_.isEmpty()) { if (typeParameters_.isEmpty()) { typeParameters_ = other.typeParameters_; - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); } else { ensureTypeParametersIsMutable(); typeParameters_.addAll(other.typeParameters_); @@ -4030,7 +3978,7 @@ public final class ProtoBuf { if (!other.supertypes_.isEmpty()) { if (supertypes_.isEmpty()) { supertypes_ = other.supertypes_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); } else { ensureSupertypesIsMutable(); supertypes_.addAll(other.supertypes_); @@ -4040,7 +3988,7 @@ public final class ProtoBuf { if (!other.nestedClassNames_.isEmpty()) { if (nestedClassNames_.isEmpty()) { nestedClassNames_ = other.nestedClassNames_; - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); } else { ensureNestedClassNamesIsMutable(); nestedClassNames_.addAll(other.nestedClassNames_); @@ -4050,7 +3998,7 @@ public final class ProtoBuf { if (!other.nestedObjectNames_.isEmpty()) { if (nestedObjectNames_.isEmpty()) { nestedObjectNames_ = other.nestedObjectNames_; - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); } else { ensureNestedObjectNamesIsMutable(); nestedObjectNames_.addAll(other.nestedObjectNames_); @@ -4066,7 +4014,7 @@ public final class ProtoBuf { if (!other.members_.isEmpty()) { if (members_.isEmpty()) { members_ = other.members_; - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); } else { ensureMembersIsMutable(); members_.addAll(other.members_); @@ -4135,14 +4083,8 @@ public final class ProtoBuf { extraVisibility_ = input.readBytes(); break; } - case 26: { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder subBuilder = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAnnotations(subBuilder.buildPartial()); - break; - } case 32: { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000004; name_ = input.readInt32(); break; } @@ -4187,7 +4129,7 @@ public final class ProtoBuf { break; } case 72: { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000080; classObjectPresent_ = input.readBool(); break; } @@ -4269,111 +4211,22 @@ public final class ProtoBuf { } - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - private java.util.List annotations_ = - java.util.Collections.emptyList(); - private void ensureAnnotationsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - annotations_ = new java.util.ArrayList(annotations_); - bitField0_ |= 0x00000004; - } - } - - public java.util.List getAnnotationsList() { - return java.util.Collections.unmodifiableList(annotations_); - } - public int getAnnotationsCount() { - return annotations_.size(); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index) { - return annotations_.get(index); - } - public Builder setAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.set(index, value); - - return this; - } - public Builder setAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.set(index, builderForValue.build()); - - return this; - } - public Builder addAnnotations(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.add(value); - - return this; - } - public Builder addAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.add(index, value); - - return this; - } - public Builder addAnnotations( - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.add(builderForValue.build()); - - return this; - } - public Builder addAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.add(index, builderForValue.build()); - - return this; - } - public Builder addAllAnnotations( - java.lang.Iterable values) { - ensureAnnotationsIsMutable(); - super.addAll(values, annotations_); - - return this; - } - public Builder clearAnnotations() { - annotations_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - - return this; - } - public Builder removeAnnotations(int index) { - ensureAnnotationsIsMutable(); - annotations_.remove(index); - - return this; - } - // required int32 name = 4; private int name_ ; public boolean hasName() { - return ((bitField0_ & 0x00000008) == 0x00000008); + return ((bitField0_ & 0x00000004) == 0x00000004); } public int getName() { return name_; } public Builder setName(int value) { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000004; name_ = value; return this; } public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000004); name_ = 0; return this; @@ -4383,9 +4236,9 @@ public final class ProtoBuf { private java.util.List typeParameters_ = java.util.Collections.emptyList(); private void ensureTypeParametersIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { + if (!((bitField0_ & 0x00000008) == 0x00000008)) { typeParameters_ = new java.util.ArrayList(typeParameters_); - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000008; } } @@ -4457,7 +4310,7 @@ public final class ProtoBuf { } public Builder clearTypeParameters() { typeParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); return this; } @@ -4472,9 +4325,9 @@ public final class ProtoBuf { private java.util.List supertypes_ = java.util.Collections.emptyList(); private void ensureSupertypesIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { supertypes_ = new java.util.ArrayList(supertypes_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; } } @@ -4546,7 +4399,7 @@ public final class ProtoBuf { } public Builder clearSupertypes() { supertypes_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -4560,9 +4413,9 @@ public final class ProtoBuf { // repeated int32 nestedClassNames = 7; private java.util.List nestedClassNames_ = java.util.Collections.emptyList();; private void ensureNestedClassNamesIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { nestedClassNames_ = new java.util.ArrayList(nestedClassNames_); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; } } public java.util.List @@ -4597,7 +4450,7 @@ public final class ProtoBuf { } public Builder clearNestedClassNames() { nestedClassNames_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -4605,9 +4458,9 @@ public final class ProtoBuf { // repeated int32 nestedObjectNames = 8; private java.util.List nestedObjectNames_ = java.util.Collections.emptyList();; private void ensureNestedObjectNamesIsMutable() { - if (!((bitField0_ & 0x00000080) == 0x00000080)) { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { nestedObjectNames_ = new java.util.ArrayList(nestedObjectNames_); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; } } public java.util.List @@ -4642,7 +4495,7 @@ public final class ProtoBuf { } public Builder clearNestedObjectNames() { nestedObjectNames_ = java.util.Collections.emptyList();; - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -4650,19 +4503,19 @@ public final class ProtoBuf { // optional bool classObjectPresent = 9 [default = false]; private boolean classObjectPresent_ ; public boolean hasClassObjectPresent() { - return ((bitField0_ & 0x00000100) == 0x00000100); + return ((bitField0_ & 0x00000080) == 0x00000080); } public boolean getClassObjectPresent() { return classObjectPresent_; } public Builder setClassObjectPresent(boolean value) { - bitField0_ |= 0x00000100; + bitField0_ |= 0x00000080; classObjectPresent_ = value; return this; } public Builder clearClassObjectPresent() { - bitField0_ = (bitField0_ & ~0x00000100); + bitField0_ = (bitField0_ & ~0x00000080); classObjectPresent_ = false; return this; @@ -4671,7 +4524,7 @@ public final class ProtoBuf { // optional .org.jetbrains.jet.descriptors.serialization.Callable primaryConstructor = 10; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable primaryConstructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.getDefaultInstance(); public boolean hasPrimaryConstructor() { - return ((bitField0_ & 0x00000200) == 0x00000200); + return ((bitField0_ & 0x00000100) == 0x00000100); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable getPrimaryConstructor() { return primaryConstructor_; @@ -4682,18 +4535,18 @@ public final class ProtoBuf { } primaryConstructor_ = value; - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } public Builder setPrimaryConstructor( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.Builder builderForValue) { primaryConstructor_ = builderForValue.build(); - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } public Builder mergePrimaryConstructor(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable value) { - if (((bitField0_ & 0x00000200) == 0x00000200) && + if (((bitField0_ & 0x00000100) == 0x00000100) && primaryConstructor_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.getDefaultInstance()) { primaryConstructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.newBuilder(primaryConstructor_).mergeFrom(value).buildPartial(); @@ -4701,13 +4554,13 @@ public final class ProtoBuf { primaryConstructor_ = value; } - bitField0_ |= 0x00000200; + bitField0_ |= 0x00000100; return this; } public Builder clearPrimaryConstructor() { primaryConstructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Callable.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000200); + bitField0_ = (bitField0_ & ~0x00000100); return this; } @@ -4715,9 +4568,9 @@ public final class ProtoBuf { private java.util.List members_ = java.util.Collections.emptyList(); private void ensureMembersIsMutable() { - if (!((bitField0_ & 0x00000400) == 0x00000400)) { + if (!((bitField0_ & 0x00000200) == 0x00000200)) { members_ = new java.util.ArrayList(members_); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000200; } } @@ -4789,7 +4642,7 @@ public final class ProtoBuf { } public Builder clearMembers() { members_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000400); + bitField0_ = (bitField0_ & ~0x00000200); return this; } @@ -4822,12 +4675,6 @@ public final class ProtoBuf { boolean hasExtraVisibility(); String getExtraVisibility(); - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - java.util.List - getAnnotationsList(); - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index); - int getAnnotationsCount(); - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; java.util.List getTypeParametersList(); @@ -5549,27 +5396,6 @@ public final class ProtoBuf { } } - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - public static final int ANNOTATIONS_FIELD_NUMBER = 3; - private java.util.List annotations_; - public java.util.List getAnnotationsList() { - return annotations_; - } - public java.util.List - getAnnotationsOrBuilderList() { - return annotations_; - } - public int getAnnotationsCount() { - return annotations_.size(); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index) { - return annotations_.get(index); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.AnnotationOrBuilder getAnnotationsOrBuilder( - int index) { - return annotations_.get(index); - } - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; public static final int TYPEPARAMETERS_FIELD_NUMBER = 4; private java.util.List typeParameters_; @@ -5645,7 +5471,6 @@ public final class ProtoBuf { private void initFields() { flags_ = 0; extraVisibility_ = ""; - annotations_ = java.util.Collections.emptyList(); typeParameters_ = java.util.Collections.emptyList(); receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); name_ = 0; @@ -5700,9 +5525,6 @@ public final class ProtoBuf { if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getExtraVisibilityBytes()); } - for (int i = 0; i < annotations_.size(); i++) { - output.writeMessage(3, annotations_.get(i)); - } for (int i = 0; i < typeParameters_.size(); i++) { output.writeMessage(4, typeParameters_.get(i)); } @@ -5734,10 +5556,6 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getExtraVisibilityBytes()); } - for (int i = 0; i < annotations_.size(); i++) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(3, annotations_.get(i)); - } for (int i = 0; i < typeParameters_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, typeParameters_.get(i)); @@ -5864,18 +5682,16 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000001); extraVisibility_ = ""; bitField0_ = (bitField0_ & ~0x00000002); - annotations_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); typeParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000004); receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); name_ = 0; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); valueParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -5918,29 +5734,24 @@ public final class ProtoBuf { } result.extraVisibility_ = extraVisibility_; if (((bitField0_ & 0x00000004) == 0x00000004)) { - annotations_ = java.util.Collections.unmodifiableList(annotations_); + typeParameters_ = java.util.Collections.unmodifiableList(typeParameters_); bitField0_ = (bitField0_ & ~0x00000004); } - result.annotations_ = annotations_; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - typeParameters_ = java.util.Collections.unmodifiableList(typeParameters_); - bitField0_ = (bitField0_ & ~0x00000008); - } result.typeParameters_ = typeParameters_; - if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } result.receiverType_ = receiverType_; - if (((from_bitField0_ & 0x00000020) == 0x00000020)) { + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000008; } result.name_ = name_; - if (((bitField0_ & 0x00000040) == 0x00000040)) { + if (((bitField0_ & 0x00000020) == 0x00000020)) { valueParameters_ = java.util.Collections.unmodifiableList(valueParameters_); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); } result.valueParameters_ = valueParameters_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000010; } result.returnType_ = returnType_; @@ -5956,20 +5767,10 @@ public final class ProtoBuf { if (other.hasExtraVisibility()) { setExtraVisibility(other.getExtraVisibility()); } - if (!other.annotations_.isEmpty()) { - if (annotations_.isEmpty()) { - annotations_ = other.annotations_; - bitField0_ = (bitField0_ & ~0x00000004); - } else { - ensureAnnotationsIsMutable(); - annotations_.addAll(other.annotations_); - } - - } if (!other.typeParameters_.isEmpty()) { if (typeParameters_.isEmpty()) { typeParameters_ = other.typeParameters_; - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000004); } else { ensureTypeParametersIsMutable(); typeParameters_.addAll(other.typeParameters_); @@ -5985,7 +5786,7 @@ public final class ProtoBuf { if (!other.valueParameters_.isEmpty()) { if (valueParameters_.isEmpty()) { valueParameters_ = other.valueParameters_; - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); } else { ensureValueParametersIsMutable(); valueParameters_.addAll(other.valueParameters_); @@ -6059,12 +5860,6 @@ public final class ProtoBuf { extraVisibility_ = input.readBytes(); break; } - case 26: { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder subBuilder = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.newBuilder(); - input.readMessage(subBuilder, extensionRegistry); - addAnnotations(subBuilder.buildPartial()); - break; - } case 34: { org.jetbrains.jet.descriptors.serialization.ProtoBuf.TypeParameter.Builder subBuilder = org.jetbrains.jet.descriptors.serialization.ProtoBuf.TypeParameter.newBuilder(); input.readMessage(subBuilder, extensionRegistry); @@ -6081,7 +5876,7 @@ public final class ProtoBuf { break; } case 48: { - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; name_ = input.readInt32(); break; } @@ -6163,102 +5958,13 @@ public final class ProtoBuf { } - // repeated .org.jetbrains.jet.descriptors.serialization.Annotation annotations = 3; - private java.util.List annotations_ = - java.util.Collections.emptyList(); - private void ensureAnnotationsIsMutable() { - if (!((bitField0_ & 0x00000004) == 0x00000004)) { - annotations_ = new java.util.ArrayList(annotations_); - bitField0_ |= 0x00000004; - } - } - - public java.util.List getAnnotationsList() { - return java.util.Collections.unmodifiableList(annotations_); - } - public int getAnnotationsCount() { - return annotations_.size(); - } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getAnnotations(int index) { - return annotations_.get(index); - } - public Builder setAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.set(index, value); - - return this; - } - public Builder setAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.set(index, builderForValue.build()); - - return this; - } - public Builder addAnnotations(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.add(value); - - return this; - } - public Builder addAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation value) { - if (value == null) { - throw new NullPointerException(); - } - ensureAnnotationsIsMutable(); - annotations_.add(index, value); - - return this; - } - public Builder addAnnotations( - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.add(builderForValue.build()); - - return this; - } - public Builder addAnnotations( - int index, org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.Builder builderForValue) { - ensureAnnotationsIsMutable(); - annotations_.add(index, builderForValue.build()); - - return this; - } - public Builder addAllAnnotations( - java.lang.Iterable values) { - ensureAnnotationsIsMutable(); - super.addAll(values, annotations_); - - return this; - } - public Builder clearAnnotations() { - annotations_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000004); - - return this; - } - public Builder removeAnnotations(int index) { - ensureAnnotationsIsMutable(); - annotations_.remove(index); - - return this; - } - // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter typeParameters = 4; private java.util.List typeParameters_ = java.util.Collections.emptyList(); private void ensureTypeParametersIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { typeParameters_ = new java.util.ArrayList(typeParameters_); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000004; } } @@ -6330,7 +6036,7 @@ public final class ProtoBuf { } public Builder clearTypeParameters() { typeParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -6344,7 +6050,7 @@ public final class ProtoBuf { // optional .org.jetbrains.jet.descriptors.serialization.Type receiverType = 5; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); public boolean hasReceiverType() { - return ((bitField0_ & 0x00000010) == 0x00000010); + return ((bitField0_ & 0x00000008) == 0x00000008); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReceiverType() { return receiverType_; @@ -6355,18 +6061,18 @@ public final class ProtoBuf { } receiverType_ = value; - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000008; return this; } public Builder setReceiverType( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { receiverType_ = builderForValue.build(); - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000008; return this; } public Builder mergeReceiverType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000010) == 0x00000010) && + if (((bitField0_ & 0x00000008) == 0x00000008) && receiverType_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance()) { receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.newBuilder(receiverType_).mergeFrom(value).buildPartial(); @@ -6374,32 +6080,32 @@ public final class ProtoBuf { receiverType_ = value; } - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000008; return this; } public Builder clearReceiverType() { receiverType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000008); return this; } // required int32 name = 6; private int name_ ; public boolean hasName() { - return ((bitField0_ & 0x00000020) == 0x00000020); + return ((bitField0_ & 0x00000010) == 0x00000010); } public int getName() { return name_; } public Builder setName(int value) { - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000010; name_ = value; return this; } public Builder clearName() { - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000010); name_ = 0; return this; @@ -6409,9 +6115,9 @@ public final class ProtoBuf { private java.util.List valueParameters_ = java.util.Collections.emptyList(); private void ensureValueParametersIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { valueParameters_ = new java.util.ArrayList(valueParameters_); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000020; } } @@ -6483,7 +6189,7 @@ public final class ProtoBuf { } public Builder clearValueParameters() { valueParameters_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -6497,7 +6203,7 @@ public final class ProtoBuf { // required .org.jetbrains.jet.descriptors.serialization.Type returnType = 8; private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); public boolean hasReturnType() { - return ((bitField0_ & 0x00000080) == 0x00000080); + return ((bitField0_ & 0x00000040) == 0x00000040); } public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getReturnType() { return returnType_; @@ -6508,18 +6214,18 @@ public final class ProtoBuf { } returnType_ = value; - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; return this; } public Builder setReturnType( org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { returnType_ = builderForValue.build(); - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; return this; } public Builder mergeReturnType(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { - if (((bitField0_ & 0x00000080) == 0x00000080) && + if (((bitField0_ & 0x00000040) == 0x00000040) && returnType_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance()) { returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.newBuilder(returnType_).mergeFrom(value).buildPartial(); @@ -6527,13 +6233,13 @@ public final class ProtoBuf { returnType_ = value; } - bitField0_ |= 0x00000080; + bitField0_ |= 0x00000040; return this; } public Builder clearReturnType() { returnType_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); - bitField0_ = (bitField0_ & ~0x00000080); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -6548,227 +6254,6 @@ public final class ProtoBuf { // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.Callable) } - public interface AnnotationOrBuilder - extends com.google.protobuf.MessageLiteOrBuilder { - } - public static final class Annotation extends - com.google.protobuf.GeneratedMessageLite - implements AnnotationOrBuilder { - // Use Annotation.newBuilder() to construct. - private Annotation(Builder builder) { - super(builder); - } - private Annotation(boolean noInit) {} - - private static final Annotation defaultInstance; - public static Annotation getDefaultInstance() { - return defaultInstance; - } - - public Annotation getDefaultInstanceForType() { - return defaultInstance; - } - - private void initFields() { - } - private byte memoizedIsInitialized = -1; - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized != -1) return isInitialized == 1; - - memoizedIsInitialized = 1; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - memoizedSerializedSize = size; - return size; - } - - private static final long serialVersionUID = 0L; - @java.lang.Override - protected java.lang.Object writeReplace() - throws java.io.ObjectStreamException { - return super.writeReplace(); - } - - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - com.google.protobuf.ByteString data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - byte[] data, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data, extensionRegistry) - .buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseDelimitedFrom( - java.io.InputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - Builder builder = newBuilder(); - if (builder.mergeDelimitedFrom(input, extensionRegistry)) { - return builder.buildParsed(); - } else { - return null; - } - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation parseFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - return newBuilder().mergeFrom(input, extensionRegistry) - .buildParsed(); - } - - public static Builder newBuilder() { return Builder.create(); } - public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation prototype) { - return newBuilder().mergeFrom(prototype); - } - public Builder toBuilder() { return newBuilder(this); } - - public static final class Builder extends - com.google.protobuf.GeneratedMessageLite.Builder< - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation, Builder> - implements org.jetbrains.jet.descriptors.serialization.ProtoBuf.AnnotationOrBuilder { - // Construct using org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.newBuilder() - private Builder() { - maybeForceBuilderInitialization(); - } - - private void maybeForceBuilderInitialization() { - } - private static Builder create() { - return new Builder(); - } - - public Builder clear() { - super.clear(); - return this; - } - - public Builder clone() { - return create().mergeFrom(buildPartial()); - } - - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation getDefaultInstanceForType() { - return org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.getDefaultInstance(); - } - - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation build() { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return result; - } - - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation buildPartial() { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation result = new org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation(this); - return result; - } - - public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation other) { - if (other == org.jetbrains.jet.descriptors.serialization.ProtoBuf.Annotation.getDefaultInstance()) return this; - return this; - } - - public final boolean isInitialized() { - return true; - } - - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - while (true) { - int tag = input.readTag(); - switch (tag) { - case 0: - - return this; - default: { - if (!parseUnknownField(input, extensionRegistry, tag)) { - - return this; - } - break; - } - } - } - } - - - // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.Annotation) - } - - static { - defaultInstance = new Annotation(true); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.Annotation) - } - static { } diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java new file mode 100644 index 00000000000..7f803c32233 --- /dev/null +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/AnnotationDeserializer.java @@ -0,0 +1,48 @@ +package org.jetbrains.jet.descriptors.serialization.descriptors; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jet.descriptors.serialization.ProtoBuf; +import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; + +import java.util.List; + +public interface AnnotationDeserializer { + AnnotationDeserializer UNSUPPORTED = new AnnotationDeserializer() { + @NotNull + @Override + public List loadClassAnnotations( + @NotNull ProtoBuf.Class classProto + ) { + throw new UnsupportedOperationException("Annotations are not supported"); + } + + @NotNull + @Override + public List loadCallableAnnotations( + @NotNull ProtoBuf.Callable callableProto + ) { + throw new UnsupportedOperationException("Annotations are not supported"); + } + + @NotNull + @Override + public List loadValueParameterAnnotations( + @NotNull ProtoBuf.Callable.ValueParameter parameterProto + ) { + throw new UnsupportedOperationException("Annotations are not supported"); + } + }; + + @NotNull + List loadClassAnnotations(@NotNull ProtoBuf.Class classProto); + + @NotNull + List loadCallableAnnotations( + @NotNull ProtoBuf.Callable callableProto + ); + + @NotNull + List loadValueParameterAnnotations( + @NotNull ProtoBuf.Callable.ValueParameter parameterProto + ); +} diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java index b52abd92a70..013b9729139 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/descriptors/DeserializedClassDescriptor.java @@ -25,9 +25,7 @@ import org.jetbrains.jet.lang.descriptors.impl.ClassDescriptorBase; import org.jetbrains.jet.lang.descriptors.impl.ReceiverParameterDescriptorImpl; import org.jetbrains.jet.lang.resolve.OverrideResolver; import org.jetbrains.jet.lang.resolve.TraceUtil; -import org.jetbrains.jet.lang.resolve.lazy.storage.MemoizedFunctionToNullableImpl; -import org.jetbrains.jet.lang.resolve.lazy.storage.NullableLazyValue; -import org.jetbrains.jet.lang.resolve.lazy.storage.NullableLazyValueImpl; +import org.jetbrains.jet.lang.resolve.lazy.storage.*; import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.receivers.ClassReceiver; @@ -46,6 +44,9 @@ public class DeserializedClassDescriptor extends ClassDescriptorBase implements private final NullableLazyValue primaryConstructor; + private final AnnotationDeserializer annotationDeserializer; + private final NotNullLazyValue> annotations; + private final NestedClassResolver nestedClassResolver; private final NullableLazyValue classObjectDescriptor; @@ -63,6 +64,7 @@ public class DeserializedClassDescriptor extends ClassDescriptorBase implements public DeserializedClassDescriptor( @NotNull DeclarationDescriptor containingDeclaration, @NotNull NameResolver nameResolver, + @NotNull AnnotationDeserializer annotationResolver, @NotNull ClassResolver classResolver, @NotNull NestedClassResolver _nestedClassResolver, @NotNull ProtoBuf.Class classProto, @@ -70,7 +72,7 @@ public class DeserializedClassDescriptor extends ClassDescriptorBase implements ) { this.classProto = classProto; this.typeDeserializer = new TypeDeserializer(outerTypeDeserializer, nameResolver, classResolver); - this.deserializer = DescriptorDeserializer.create(typeDeserializer, this, nameResolver); + this.deserializer = DescriptorDeserializer.create(typeDeserializer, this, nameResolver, annotationResolver); this.containingDeclaration = containingDeclaration; this.typeConstructor = new DeserializedClassTypeConstructor(); @@ -84,6 +86,15 @@ public class DeserializedClassDescriptor extends ClassDescriptorBase implements this.kind = DescriptorDeserializer.classKind(Flags.getClassKind(flags)); this.isInner = Flags.isInner(flags); + this.annotationDeserializer = annotationResolver; + this.annotations = new NotNullLazyValueImpl>() { + @NotNull + @Override + protected List doCompute() { + return computeAnnotations(); + } + }; + this.primaryConstructor = new NullableLazyValueImpl() { @Override protected ConstructorDescriptor doCompute() { @@ -169,9 +180,16 @@ public class DeserializedClassDescriptor extends ClassDescriptorBase implements return name; } + private List computeAnnotations() { + if (!Flags.hasAnnotations(classProto.getFlags())) { + return Collections.emptyList(); + } + return annotationDeserializer.loadClassAnnotations(classProto); + } + @Override public List getAnnotations() { - return Collections.emptyList(); // TODO + return annotations.compute(); } @Override diff --git a/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java b/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java index 1a21917a677..1ca932e9a66 100644 --- a/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java +++ b/compiler/tests/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorSerializationTest.java @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.JetTestUtils; import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; +import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer; import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedClassDescriptor; import org.jetbrains.jet.di.InjectorForJavaDescriptorResolver; import org.jetbrains.jet.lang.descriptors.*; @@ -49,11 +50,14 @@ import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.RedeclarationHandler; import org.jetbrains.jet.lang.resolve.scopes.WritableScope; import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl; +import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; import org.jetbrains.jet.test.util.NamespaceComparator; import java.io.*; import java.util.*; +import static org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer.UNSUPPORTED; + public abstract class AbstractDescriptorSerializationTest extends KotlinTestWithEnvironment { public static final Name TEST_PACKAGE_NAME = Name.identifier("test"); @@ -74,6 +78,35 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith } }; + public static final AnnotationDeserializer DUMMY_ANNOTATION_DESERIALIZER = new AnnotationDeserializer() { + @NotNull + @Override + public List loadClassAnnotations( + @NotNull ProtoBuf.Class classProto + ) { + // This is a hack for tests: only data annotations are present in test data so far + AnnotationDescriptor annotationDescriptor = new AnnotationDescriptor(); + annotationDescriptor.setAnnotationType(KotlinBuiltIns.getInstance().getDataClassAnnotation().getDefaultType()); + return Collections.singletonList(annotationDescriptor); + } + + @NotNull + @Override + public List loadCallableAnnotations( + @NotNull ProtoBuf.Callable callableProto + ) { + throw new UnsupportedOperationException(); // TODO + } + + @NotNull + @Override + public List loadValueParameterAnnotations( + @NotNull ProtoBuf.Callable.ValueParameter parameterProto + ) { + throw new UnsupportedOperationException(); // TODO + } + }; + @Override protected JetCoreEnvironment createEnvironment() { return createEnvironmentWithMockJdk(ConfigurationKind.JDK_ONLY); @@ -184,7 +217,7 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith } DescriptorDeserializer deserializer = - DescriptorDeserializer.create(namespace, new NameResolver(simpleNames, qualifiedNames), classResolver); + DescriptorDeserializer.create(namespace, new NameResolver(simpleNames, qualifiedNames), classResolver, UNSUPPORTED); for (ProtoBuf.Callable proto : callableProtos) { CallableMemberDescriptor descriptor = deserializer.loadCallable(proto); if (descriptor instanceof FunctionDescriptor) { @@ -359,7 +392,8 @@ public abstract class AbstractDescriptorSerializationTest extends KotlinTestWith }; NameResolver nameResolver = new NameResolver(classMetadata.simpleNames, classMetadata.qualifiedNames); - return new DeserializedClassDescriptor(containingDeclaration, nameResolver, this, nestedClassResolver, classMetadata.classProto, null); + return new DeserializedClassDescriptor(containingDeclaration, nameResolver, DUMMY_ANNOTATION_DESERIALIZER, + this, nestedClassResolver, classMetadata.classProto, null); } @Nullable diff --git a/compiler/tests/org/jetbrains/jet/descriptors/serialization/BuiltinsDeserializationTest.java b/compiler/tests/org/jetbrains/jet/descriptors/serialization/BuiltinsDeserializationTest.java index 777bfa17701..d5980ee71bc 100644 --- a/compiler/tests/org/jetbrains/jet/descriptors/serialization/BuiltinsDeserializationTest.java +++ b/compiler/tests/org/jetbrains/jet/descriptors/serialization/BuiltinsDeserializationTest.java @@ -23,6 +23,7 @@ import org.jetbrains.annotations.Nullable; import org.jetbrains.jet.ConfigurationKind; import org.jetbrains.jet.TestJdkKind; import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment; +import org.jetbrains.jet.descriptors.serialization.descriptors.AnnotationDeserializer; import org.jetbrains.jet.jvm.compiler.ExpectedLoadErrorsUtil; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.AnnotationDescriptor; @@ -60,13 +61,13 @@ public class BuiltinsDeserializationTest extends KotlinTestWithEnvironment { NamespaceComparator.Configuration configuration = NamespaceComparator.RECURSIVE.withRenderer( new DescriptorRendererBuilder() - .setWithDefinedIn(false) - .setExcludedAnnotationClasses(Arrays.asList(new FqName(ExpectedLoadErrorsUtil.ANNOTATION_CLASS_NAME))) - .setOverrideRenderingPolicy(DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE) - .setVerbose(true) - .setAlwaysRenderAny(true) - .setPrettyFunctionTypes(false) - .build() + .setWithDefinedIn(false) + .setExcludedAnnotationClasses(Arrays.asList(new FqName(ExpectedLoadErrorsUtil.ANNOTATION_CLASS_NAME))) + .setOverrideRenderingPolicy(DescriptorRenderer.OverrideRenderingPolicy.RENDER_OPEN_OVERRIDE) + .setVerbose(true) + .setAlwaysRenderAny(true) + .setPrettyFunctionTypes(false) + .build() ); NamespaceComparator.validateAndCompareNamespaces(KotlinBuiltIns.getInstance().getBuiltInsPackage(), actualNamespace, configuration, null); } @@ -82,7 +83,7 @@ public class BuiltinsDeserializationTest extends KotlinTestWithEnvironment { NameResolver nameResolver = NameSerializationUtil.createNameResolver(serializer.getNameTable()); - ClassResolver classResolver = new AbstractClassResolver(nameResolver) { + ClassResolver classResolver = new AbstractClassResolver(nameResolver, AnnotationDeserializer.UNSUPPORTED) { @NotNull @Override @@ -177,7 +178,9 @@ public class BuiltinsDeserializationTest extends KotlinTestWithEnvironment { NameResolver nameResolver, ClassResolver classResolver ) { - DescriptorDeserializer descriptorDeserializer = DescriptorDeserializer.create(actualNamespace, nameResolver, classResolver); + DescriptorDeserializer descriptorDeserializer; + descriptorDeserializer = + DescriptorDeserializer.create(actualNamespace, nameResolver, classResolver, AnnotationDeserializer.UNSUPPORTED); for (ProtoBuf.Callable callableProto : callableProtos) { CallableMemberDescriptor callableMemberDescriptor = descriptorDeserializer.loadCallable(callableProto); if (callableMemberDescriptor instanceof PropertyDescriptor) {