From c04f63e15731cf1f2e4e23265c117634cebc2621 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 29 Oct 2013 22:11:07 +0400 Subject: [PATCH] Change object deserialization strategy Objects now have synthetic class objects in deserialization as well. "Class" proto message now can have a synthetic class object proto within, if it's not contained in any external class file, which is the case with objects. Drop "class_object_present" field from binary format, since its value is equivalent to the presence of "class_object" field --- .../jet/codegen/NamespaceCodegen.java | 6 +- .../builtins/jet/ByteRange.kotlin_class | Bin 148 -> 148 bytes .../builtins/jet/CharRange.kotlin_class | Bin 148 -> 148 bytes .../builtins/jet/DoubleRange.kotlin_class | Bin 148 -> 148 bytes .../builtins/jet/FloatRange.kotlin_class | Bin 148 -> 148 bytes .../builtins/jet/InlineStrategy.kotlin_class | Bin 42 -> 42 bytes .../builtins/jet/IntRange.kotlin_class | Bin 148 -> 148 bytes .../builtins/jet/LongRange.kotlin_class | Bin 149 -> 149 bytes .../builtins/jet/ShortRange.kotlin_class | Bin 149 -> 149 bytes .../frontend/builtins/jet/Unit.kotlin_class | Bin 27 -> 27 bytes .../serialization/src/descriptors.proto | 11 +- .../AbstractDescriptorFinder.java | 4 +- .../serialization/DescriptorSerializer.java | 22 +- .../descriptors/serialization/ProtoBuf.java | 785 +++++++++++++++--- .../DeserializedClassDescriptor.java | 24 +- .../resolve/java/scope/JavaPackageScope.java | 6 +- .../DeserializedDescriptorResolver.java | 16 +- 17 files changed, 709 insertions(+), 165 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java index 255bdbf87ce..5a86794c013 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/NamespaceCodegen.java @@ -210,14 +210,12 @@ public class NamespaceCodegen extends MemberCodegen { * @param namespaceFiles all files should have same package name * @return */ - public static boolean shouldGenerateNSClass(Collection namespaceFiles) { + public static boolean shouldGenerateNSClass(@NotNull Collection namespaceFiles) { checkAllFilesHaveSameNamespace(namespaceFiles); for (JetFile file : namespaceFiles) { for (JetDeclaration declaration : file.getDeclarations()) { - if (declaration instanceof JetProperty || - declaration instanceof JetNamedFunction || - declaration instanceof JetObjectDeclaration) { + if (declaration instanceof JetProperty || declaration instanceof JetNamedFunction) { return true; } } diff --git a/compiler/frontend/builtins/jet/ByteRange.kotlin_class b/compiler/frontend/builtins/jet/ByteRange.kotlin_class index 0102268d2c4cc1c0359408c8e6398887a3e2e5f0..46489a6ccf0b874db79347767467490f739d2e07 100644 GIT binary patch delta 42 mcmbQjIE7J(gH1w2iNT16i%CFEh)swENb`VsvM}C6r6K@g1q5jT delta 42 mcmbQjIE7J(gH1xjh=+?wKu(BFhy_UVfO)boo(JPZr6K@gMFfxl diff --git a/compiler/frontend/builtins/jet/CharRange.kotlin_class b/compiler/frontend/builtins/jet/CharRange.kotlin_class index 2a9c5b567f6d98ada8cf58393df168cfc2846c9f..0ee43f3fb2af9809e539bdc869a6e345d126da9b 100644 GIT binary patch delta 42 mcmbQjIE7J(gH1wIiNT16i%CFEh)swENb`evvM}C6r6K@gX#{Wp delta 42 mcmbQjIE7J(gH1xzh=+?wKu(BFhy_UVgL$$ro(JPZr6K@gwFH*{ diff --git a/compiler/frontend/builtins/jet/DoubleRange.kotlin_class b/compiler/frontend/builtins/jet/DoubleRange.kotlin_class index 492a35a0f037c56348b173ecb7095e0a7931399e..b12fccefea45d24e6c12a3dc485f490a83e93616 100644 GIT binary patch delta 42 mcmbQjIE7J(gH1wAiNT16i%CFEh)swENDF{@vM}C6r6K@gp#*aP delta 42 mcmbQjIE7J(gH1xrh=+?wKu(BFhy_RsfO)boo(JPZr6K@g@dTOx diff --git a/compiler/frontend/builtins/jet/FloatRange.kotlin_class b/compiler/frontend/builtins/jet/FloatRange.kotlin_class index cf697889c3e2dcb609d893f3508bfdba1c5f915f..750c7ef0f96ca64c30cc9e61ce8cc5aaad26d28d 100644 GIT binary patch delta 42 mcmbQjIE7J(gH1wQiNT16i%CFEh)swENDG2_vM}C6r6K@g*#vd~ delta 42 mcmbQjIE7J(gH1x*h=+?wKu(BFhy_Rsf_btqo(JPZr6K@hEd-qa diff --git a/compiler/frontend/builtins/jet/InlineStrategy.kotlin_class b/compiler/frontend/builtins/jet/InlineStrategy.kotlin_class index 6db15d8e2f54deebb23c035b745272c79bd33917..c49d1ffbcb5d6c4ca62f044ea16b4a2cd57e3ab1 100644 GIT binary patch literal 42 tcmd;RW0Z(jVld+2ViM35ViRHk((wsL7!!^%X7O@ya~xtcV0Hov0sxJt2JZj> literal 42 tcmd;RW0Z(D;^ATv&=q16Vgb_e9*hY`7!!^%X7O@ya~xtcV0Hov0|1e$2NnPT diff --git a/compiler/frontend/builtins/jet/IntRange.kotlin_class b/compiler/frontend/builtins/jet/IntRange.kotlin_class index e4664f6d2c7c6c2b46b34ad6fbbd537ba28c25e6..cc467983a33437a0dbe3ed7ae5aee7ea7dde39b6 100644 GIT binary patch delta 42 mcmbQjIE7J(gH3`>iNT16i%CFEh)swENV9->vM}C6r6K@dc?3%U delta 42 mcmbQjIE7J(gH3|Xh=+?wKu(BFhy_TqfO)boo(JPZr6K@dnFMkG diff --git a/compiler/frontend/builtins/jet/LongRange.kotlin_class b/compiler/frontend/builtins/jet/LongRange.kotlin_class index d9b5489efd25261dd488ad803fed9d9c3ae9c018..948879b48cf8e4d275a4cceec666bf7af088d8fe 100644 GIT binary patch delta 42 mcmbQrIF(U}gH1w0iNT16i%CFEh)swENDF~^vM}C6rD6bMWCVNw delta 42 mcmbQrIF(U}gH1xhh=+?wKu(BFhy_RsfqAkpo(JPZrD6bMyab~F diff --git a/compiler/frontend/builtins/jet/ShortRange.kotlin_class b/compiler/frontend/builtins/jet/ShortRange.kotlin_class index 0666bd591ab8734cf9ac0e0c81af8b19f580ee83..f5c42bc390a0ffd044e77c59e0c56044254c2c71 100644 GIT binary patch delta 42 mcmbQrIF(U}gH1wGiNT16i%CFEh)swENDG5`vM}C6rD6bMoCJRW delta 42 mcmbQrIF(U}gH1xxh=+?wKu(BFhy_RsgL$$ro(JPZrD6bM_ync^ diff --git a/compiler/frontend/builtins/jet/Unit.kotlin_class b/compiler/frontend/builtins/jet/Unit.kotlin_class index a3086e7bf97ef2021210fdfdb6ac50223624aa4c..3d0779f0597fc4d5edb4613239e3c7a18f424490 100644 GIT binary patch literal 27 gcmd;Jli*NdFk<0i5@5>W<>KZz#Av|m1mbc403o9SnE(I) literal 27 gcmd;Jli)C7;bIbC@?gy3<>KZz#Av|m1QOr?03;OxzyJUM diff --git a/compiler/frontend/serialization/src/descriptors.proto b/compiler/frontend/serialization/src/descriptors.proto index 60c35db20f0..ec25a73cfbb 100644 --- a/compiler/frontend/serialization/src/descriptors.proto +++ b/compiler/frontend/serialization/src/descriptors.proto @@ -110,6 +110,15 @@ message Class { required int32 fq_name = 3; + message ClassObject { + // If this field is present, it contains serialized data for a synthetic class object, for which there's no class file. + // Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class + optional Class data = 1; + } + + // This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file + optional ClassObject class_object = 4; + repeated TypeParameter type_parameter = 5; repeated Type supertype = 6; @@ -118,8 +127,6 @@ message Class { repeated int32 nested_class_name = 7; repeated int32 nested_object_name = 8; - optional bool class_object_present = 9 [default = false]; - repeated Callable member = 11; repeated int32 enum_entry = 12; diff --git a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorFinder.java b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorFinder.java index d0330634589..854627891e3 100644 --- a/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorFinder.java +++ b/compiler/frontend/serialization/src/org/jetbrains/jet/descriptors/serialization/AbstractDescriptorFinder.java @@ -26,7 +26,6 @@ import org.jetbrains.jet.storage.MemoizedFunctionToNullable; import org.jetbrains.jet.storage.StorageManager; public abstract class AbstractDescriptorFinder implements DescriptorFinder { - private final MemoizedFunctionToNullable findClass; private final AnnotationDeserializer annotationDeserializer; @@ -46,7 +45,8 @@ public abstract class AbstractDescriptorFinder implements DescriptorFinder { AbstractDescriptorFinder _this = AbstractDescriptorFinder.this; ClassDescriptor classDescriptor = - new DeserializedClassDescriptor(storageManager, _this.annotationDeserializer, _this, classData); + new DeserializedClassDescriptor(storageManager, _this.annotationDeserializer, _this, classData.getNameResolver(), + classData.getClassProto()); classDescriptorCreated(classDescriptor); return classDescriptor; } 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 92c2c869c3a..26423e6e752 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 @@ -29,17 +29,14 @@ import org.jetbrains.jet.renderer.DescriptorRenderer; import java.util.*; -import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getEnumEntriesScope; -import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isTopLevelOrInnerClass; +import static org.jetbrains.jet.lang.resolve.DescriptorUtils.*; public class DescriptorSerializer { private static final DescriptorRenderer RENDERER = DescriptorRenderer.STARTS_FROM_NAME; private static final Comparator DESCRIPTOR_COMPARATOR = new Comparator() { @Override - public int compare( - DeclarationDescriptor o1, DeclarationDescriptor o2 - ) { + public int compare(@NotNull DeclarationDescriptor o1, @NotNull DeclarationDescriptor o2) { int names = o1.getName().compareTo(o2.getName()); if (names != 0) return names; @@ -134,9 +131,9 @@ public class DescriptorSerializer { builder.addNestedObjectName(nameIndex); } - if (classDescriptor.getClassObjectDescriptor() != null) { - // false is default - builder.setClassObjectPresent(true); + ClassDescriptor classObject = classDescriptor.getClassObjectDescriptor(); + if (classObject != null) { + builder.setClassObject(classObjectProto(classObject)); } if (classDescriptor.getKind() == ClassKind.ENUM_CLASS) { @@ -150,6 +147,15 @@ public class DescriptorSerializer { return builder; } + @NotNull + private ProtoBuf.Class.ClassObject classObjectProto(@NotNull ClassDescriptor classObject) { + if (isObject(classObject.getContainingDeclaration())) { + return ProtoBuf.Class.ClassObject.newBuilder().setData(classProto(classObject)).build(); + } + + return ProtoBuf.Class.ClassObject.getDefaultInstance(); + } + @NotNull public ProtoBuf.Callable.Builder callableProto(@NotNull CallableMemberDescriptor descriptor) { ProtoBuf.Callable.Builder builder = ProtoBuf.Callable.newBuilder(); 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 ed7cf46cb04..1eb76baa0c4 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 @@ -4354,6 +4354,24 @@ public final class ProtoBuf { */ int getFqName(); + // optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+     * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+     * 
+ */ + boolean hasClassObject(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+     * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+     * 
+ */ + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject getClassObject(); + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 5; /** * repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 5; @@ -4427,16 +4445,6 @@ public final class ProtoBuf { */ int getNestedObjectName(int index); - // optional bool class_object_present = 9 [default = false]; - /** - * optional bool class_object_present = 9 [default = false]; - */ - boolean hasClassObjectPresent(); - /** - * optional bool class_object_present = 9 [default = false]; - */ - boolean getClassObjectPresent(); - // repeated .org.jetbrains.jet.descriptors.serialization.Callable member = 11; /** * repeated .org.jetbrains.jet.descriptors.serialization.Callable member = 11; @@ -4542,26 +4550,39 @@ public final class ProtoBuf { fqName_ = input.readInt32(); break; } + case 34: { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.Builder subBuilder = null; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subBuilder = classObject_.toBuilder(); + } + classObject_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(classObject_); + classObject_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000008; + break; + } case 42: { - if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000008; + mutable_bitField0_ |= 0x00000010; } typeParameter_.add(input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.TypeParameter.PARSER, extensionRegistry)); break; } case 50: { - if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { supertype_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000010; + mutable_bitField0_ |= 0x00000020; } supertype_.add(input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.PARSER, extensionRegistry)); break; } case 56: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { nestedClassName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } nestedClassName_.add(input.readInt32()); break; @@ -4569,9 +4590,9 @@ public final class ProtoBuf { case 58: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) { nestedClassName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } while (input.getBytesUntilLimit() > 0) { nestedClassName_.add(input.readInt32()); @@ -4580,9 +4601,9 @@ public final class ProtoBuf { break; } case 64: { - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + if (!((mutable_bitField0_ & 0x00000080) == 0x00000080)) { nestedObjectName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000040; + mutable_bitField0_ |= 0x00000080; } nestedObjectName_.add(input.readInt32()); break; @@ -4590,9 +4611,9 @@ public final class ProtoBuf { case 66: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) { + if (!((mutable_bitField0_ & 0x00000080) == 0x00000080) && input.getBytesUntilLimit() > 0) { nestedObjectName_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000040; + mutable_bitField0_ |= 0x00000080; } while (input.getBytesUntilLimit() > 0) { nestedObjectName_.add(input.readInt32()); @@ -4600,11 +4621,6 @@ public final class ProtoBuf { input.popLimit(limit); break; } - case 72: { - bitField0_ |= 0x00000008; - classObjectPresent_ = input.readBool(); - break; - } case 90: { if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { member_ = new java.util.ArrayList(); @@ -4655,16 +4671,16 @@ public final class ProtoBuf { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { - if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_); } - if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { supertype_ = java.util.Collections.unmodifiableList(supertype_); } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { nestedClassName_ = java.util.Collections.unmodifiableList(nestedClassName_); } - if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { + if (((mutable_bitField0_ & 0x00000080) == 0x00000080)) { nestedObjectName_ = java.util.Collections.unmodifiableList(nestedObjectName_); } if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { @@ -4800,6 +4816,437 @@ public final class ProtoBuf { // @@protoc_insertion_point(enum_scope:org.jetbrains.jet.descriptors.serialization.Class.Kind) } + public interface ClassObjectOrBuilder + extends com.google.protobuf.MessageLiteOrBuilder { + + // optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+       * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+       * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+       * 
+ */ + boolean hasData(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+       * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+       * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+       * 
+ */ + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class getData(); + } + /** + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.Class.ClassObject} + */ + public static final class ClassObject extends + com.google.protobuf.GeneratedMessageLite + implements ClassObjectOrBuilder { + // Use ClassObject.newBuilder() to construct. + private ClassObject(com.google.protobuf.GeneratedMessageLite.Builder builder) { + super(builder); + + } + private ClassObject(boolean noInit) {} + + private static final ClassObject defaultInstance; + public static ClassObject getDefaultInstance() { + return defaultInstance; + } + + public ClassObject getDefaultInstanceForType() { + return defaultInstance; + } + + private ClassObject( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.Builder subBuilder = null; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + subBuilder = data_.toBuilder(); + } + data_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(data_); + data_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000001; + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + makeExtensionsImmutable(); + } + } + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public ClassObject parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ClassObject(input, extensionRegistry); + } + }; + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + private int bitField0_; + // optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + public static final int DATA_FIELD_NUMBER = 1; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class data_; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+       * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+       * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+       * 
+ */ + public boolean hasData() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+       * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+       * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class getData() { + return data_; + } + + private void initFields() { + data_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (hasData()) { + if (!getData().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, data_); + } + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, data_); + } + 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.Class.ClassObject parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseDelimitedFrom(input, extensionRegistry); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return PARSER.parseFrom(input); + } + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return PARSER.parseFrom(input, extensionRegistry); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + /** + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.Class.ClassObject} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageLite.Builder< + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject, Builder> + implements org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObjectOrBuilder { + // Construct using org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + data_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject getDefaultInstanceForType() { + return org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance(); + } + + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject build() { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject buildPartial() { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject result = new org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.data_ = data_; + result.bitField0_ = to_bitField0_; + return result; + } + + public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject other) { + if (other == org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance()) return this; + if (other.hasData()) { + mergeData(other.getData()); + } + return this; + } + + public final boolean isInitialized() { + if (hasData()) { + if (!getData().isInitialized()) { + + return false; + } + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject) e.getUnfinishedMessage(); + throw e; + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + // optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class data_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.getDefaultInstance(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public boolean hasData() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class getData() { + return data_; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public Builder setData(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class value) { + if (value == null) { + throw new NullPointerException(); + } + data_ = value; + + bitField0_ |= 0x00000001; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public Builder setData( + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.Builder builderForValue) { + data_ = builderForValue.build(); + + bitField0_ |= 0x00000001; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public Builder mergeData(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class value) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + data_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.getDefaultInstance()) { + data_ = + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.newBuilder(data_).mergeFrom(value).buildPartial(); + } else { + data_ = value; + } + + bitField0_ |= 0x00000001; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class data = 1; + * + *
+         * If this field is present, it contains serialized data for a synthetic class object, for which there's no class file.
+         * Otherwise class object was compiled to a separate class file and serialized data can be found in the annotation on that class
+         * 
+ */ + public Builder clearData() { + data_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.Class.ClassObject) + } + + static { + defaultInstance = new ClassObject(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.Class.ClassObject) + } + public interface PrimaryConstructorOrBuilder extends com.google.protobuf.MessageLiteOrBuilder { @@ -5337,6 +5784,30 @@ public final class ProtoBuf { return fqName_; } + // optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + public static final int CLASS_OBJECT_FIELD_NUMBER = 4; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject classObject_; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+     * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+     * 
+ */ + public boolean hasClassObject() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+     * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+     * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject getClassObject() { + return classObject_; + } + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 5; public static final int TYPE_PARAMETER_FIELD_NUMBER = 5; private java.util.List typeParameter_; @@ -5470,22 +5941,6 @@ public final class ProtoBuf { return nestedObjectName_.get(index); } - // optional bool class_object_present = 9 [default = false]; - public static final int CLASS_OBJECT_PRESENT_FIELD_NUMBER = 9; - private boolean classObjectPresent_; - /** - * optional bool class_object_present = 9 [default = false]; - */ - public boolean hasClassObjectPresent() { - return ((bitField0_ & 0x00000008) == 0x00000008); - } - /** - * optional bool class_object_present = 9 [default = false]; - */ - public boolean getClassObjectPresent() { - return classObjectPresent_; - } - // repeated .org.jetbrains.jet.descriptors.serialization.Callable member = 11; public static final int MEMBER_FIELD_NUMBER = 11; private java.util.List member_; @@ -5573,11 +6028,11 @@ public final class ProtoBuf { flags_ = 0; extraVisibility_ = ""; fqName_ = 0; + classObject_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance(); typeParameter_ = java.util.Collections.emptyList(); supertype_ = java.util.Collections.emptyList(); nestedClassName_ = java.util.Collections.emptyList(); nestedObjectName_ = java.util.Collections.emptyList(); - classObjectPresent_ = false; member_ = java.util.Collections.emptyList(); enumEntry_ = java.util.Collections.emptyList(); primaryConstructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.PrimaryConstructor.getDefaultInstance(); @@ -5591,6 +6046,12 @@ public final class ProtoBuf { memoizedIsInitialized = 0; return false; } + if (hasClassObject()) { + if (!getClassObject().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } for (int i = 0; i < getTypeParameterCount(); i++) { if (!getTypeParameter(i).isInitialized()) { memoizedIsInitialized = 0; @@ -5631,6 +6092,9 @@ public final class ProtoBuf { if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, fqName_); } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, classObject_); + } for (int i = 0; i < typeParameter_.size(); i++) { output.writeMessage(5, typeParameter_.get(i)); } @@ -5643,9 +6107,6 @@ public final class ProtoBuf { for (int i = 0; i < nestedObjectName_.size(); i++) { output.writeInt32(8, nestedObjectName_.get(i)); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - output.writeBool(9, classObjectPresent_); - } for (int i = 0; i < member_.size(); i++) { output.writeMessage(11, member_.get(i)); } @@ -5675,6 +6136,10 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, fqName_); } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, classObject_); + } for (int i = 0; i < typeParameter_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, typeParameter_.get(i)); @@ -5701,10 +6166,6 @@ public final class ProtoBuf { size += dataSize; size += 1 * getNestedObjectNameList().size(); } - if (((bitField0_ & 0x00000008) == 0x00000008)) { - size += com.google.protobuf.CodedOutputStream - .computeBoolSize(9, classObjectPresent_); - } for (int i = 0; i < member_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(11, member_.get(i)); @@ -5819,15 +6280,15 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000002); fqName_ = 0; bitField0_ = (bitField0_ & ~0x00000004); - typeParameter_ = java.util.Collections.emptyList(); + classObject_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance(); bitField0_ = (bitField0_ & ~0x00000008); - supertype_ = java.util.Collections.emptyList(); + typeParameter_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000010); - nestedClassName_ = java.util.Collections.emptyList(); + supertype_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000020); - nestedObjectName_ = java.util.Collections.emptyList(); + nestedClassName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000040); - classObjectPresent_ = false; + nestedObjectName_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000080); member_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); @@ -5870,30 +6331,30 @@ public final class ProtoBuf { to_bitField0_ |= 0x00000004; } result.fqName_ = fqName_; - if (((bitField0_ & 0x00000008) == 0x00000008)) { - typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_); - bitField0_ = (bitField0_ & ~0x00000008); - } - result.typeParameter_ = typeParameter_; - if (((bitField0_ & 0x00000010) == 0x00000010)) { - supertype_ = java.util.Collections.unmodifiableList(supertype_); - bitField0_ = (bitField0_ & ~0x00000010); - } - result.supertype_ = supertype_; - if (((bitField0_ & 0x00000020) == 0x00000020)) { - nestedClassName_ = java.util.Collections.unmodifiableList(nestedClassName_); - bitField0_ = (bitField0_ & ~0x00000020); - } - result.nestedClassName_ = nestedClassName_; - if (((bitField0_ & 0x00000040) == 0x00000040)) { - nestedObjectName_ = java.util.Collections.unmodifiableList(nestedObjectName_); - bitField0_ = (bitField0_ & ~0x00000040); - } - result.nestedObjectName_ = nestedObjectName_; - if (((from_bitField0_ & 0x00000080) == 0x00000080)) { + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } - result.classObjectPresent_ = classObjectPresent_; + result.classObject_ = classObject_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + typeParameter_ = java.util.Collections.unmodifiableList(typeParameter_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.typeParameter_ = typeParameter_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + supertype_ = java.util.Collections.unmodifiableList(supertype_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.supertype_ = supertype_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + nestedClassName_ = java.util.Collections.unmodifiableList(nestedClassName_); + bitField0_ = (bitField0_ & ~0x00000040); + } + result.nestedClassName_ = nestedClassName_; + if (((bitField0_ & 0x00000080) == 0x00000080)) { + nestedObjectName_ = java.util.Collections.unmodifiableList(nestedObjectName_); + bitField0_ = (bitField0_ & ~0x00000080); + } + result.nestedObjectName_ = nestedObjectName_; if (((bitField0_ & 0x00000100) == 0x00000100)) { member_ = java.util.Collections.unmodifiableList(member_); bitField0_ = (bitField0_ & ~0x00000100); @@ -5925,10 +6386,13 @@ public final class ProtoBuf { if (other.hasFqName()) { setFqName(other.getFqName()); } + if (other.hasClassObject()) { + mergeClassObject(other.getClassObject()); + } if (!other.typeParameter_.isEmpty()) { if (typeParameter_.isEmpty()) { typeParameter_ = other.typeParameter_; - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000010); } else { ensureTypeParameterIsMutable(); typeParameter_.addAll(other.typeParameter_); @@ -5938,7 +6402,7 @@ public final class ProtoBuf { if (!other.supertype_.isEmpty()) { if (supertype_.isEmpty()) { supertype_ = other.supertype_; - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000020); } else { ensureSupertypeIsMutable(); supertype_.addAll(other.supertype_); @@ -5948,7 +6412,7 @@ public final class ProtoBuf { if (!other.nestedClassName_.isEmpty()) { if (nestedClassName_.isEmpty()) { nestedClassName_ = other.nestedClassName_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); } else { ensureNestedClassNameIsMutable(); nestedClassName_.addAll(other.nestedClassName_); @@ -5958,16 +6422,13 @@ public final class ProtoBuf { if (!other.nestedObjectName_.isEmpty()) { if (nestedObjectName_.isEmpty()) { nestedObjectName_ = other.nestedObjectName_; - bitField0_ = (bitField0_ & ~0x00000040); + bitField0_ = (bitField0_ & ~0x00000080); } else { ensureNestedObjectNameIsMutable(); nestedObjectName_.addAll(other.nestedObjectName_); } } - if (other.hasClassObjectPresent()) { - setClassObjectPresent(other.getClassObjectPresent()); - } if (!other.member_.isEmpty()) { if (member_.isEmpty()) { member_ = other.member_; @@ -5999,6 +6460,12 @@ public final class ProtoBuf { return false; } + if (hasClassObject()) { + if (!getClassObject().isInitialized()) { + + return false; + } + } for (int i = 0; i < getTypeParameterCount(); i++) { if (!getTypeParameter(i).isInitialized()) { @@ -6245,13 +6712,98 @@ public final class ProtoBuf { return this; } + // optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject classObject_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public boolean hasClassObject() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject getClassObject() { + return classObject_; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public Builder setClassObject(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject value) { + if (value == null) { + throw new NullPointerException(); + } + classObject_ = value; + + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public Builder setClassObject( + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.Builder builderForValue) { + classObject_ = builderForValue.build(); + + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public Builder mergeClassObject(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject value) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + classObject_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance()) { + classObject_ = + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.newBuilder(classObject_).mergeFrom(value).buildPartial(); + } else { + classObject_ = value; + } + + bitField0_ |= 0x00000008; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Class.ClassObject class_object = 4; + * + *
+       * This field is present if and only if the class has a class object. Its proto should be found either here or in the separate file
+       * 
+ */ + public Builder clearClassObject() { + classObject_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Class.ClassObject.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + // repeated .org.jetbrains.jet.descriptors.serialization.TypeParameter type_parameter = 5; private java.util.List typeParameter_ = java.util.Collections.emptyList(); private void ensureTypeParameterIsMutable() { - if (!((bitField0_ & 0x00000008) == 0x00000008)) { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { typeParameter_ = new java.util.ArrayList(typeParameter_); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000010; } } @@ -6356,7 +6908,7 @@ public final class ProtoBuf { */ public Builder clearTypeParameter() { typeParameter_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000008); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -6374,9 +6926,9 @@ public final class ProtoBuf { private java.util.List supertype_ = java.util.Collections.emptyList(); private void ensureSupertypeIsMutable() { - if (!((bitField0_ & 0x00000010) == 0x00000010)) { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { supertype_ = new java.util.ArrayList(supertype_); - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000020; } } @@ -6481,7 +7033,7 @@ public final class ProtoBuf { */ public Builder clearSupertype() { supertype_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000010); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -6498,9 +7050,9 @@ public final class ProtoBuf { // repeated int32 nested_class_name = 7; private java.util.List nestedClassName_ = java.util.Collections.emptyList(); private void ensureNestedClassNameIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { nestedClassName_ = new java.util.ArrayList(nestedClassName_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; } } /** @@ -6591,7 +7143,7 @@ public final class ProtoBuf { */ public Builder clearNestedClassName() { nestedClassName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -6599,9 +7151,9 @@ public final class ProtoBuf { // repeated int32 nested_object_name = 8; private java.util.List nestedObjectName_ = java.util.Collections.emptyList(); private void ensureNestedObjectNameIsMutable() { - if (!((bitField0_ & 0x00000040) == 0x00000040)) { + if (!((bitField0_ & 0x00000080) == 0x00000080)) { nestedObjectName_ = new java.util.ArrayList(nestedObjectName_); - bitField0_ |= 0x00000040; + bitField0_ |= 0x00000080; } } /** @@ -6657,40 +7209,7 @@ public final class ProtoBuf { */ public Builder clearNestedObjectName() { nestedObjectName_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000040); - - return this; - } - - // optional bool class_object_present = 9 [default = false]; - private boolean classObjectPresent_ ; - /** - * optional bool class_object_present = 9 [default = false]; - */ - public boolean hasClassObjectPresent() { - return ((bitField0_ & 0x00000080) == 0x00000080); - } - /** - * optional bool class_object_present = 9 [default = false]; - */ - public boolean getClassObjectPresent() { - return classObjectPresent_; - } - /** - * optional bool class_object_present = 9 [default = false]; - */ - public Builder setClassObjectPresent(boolean value) { - bitField0_ |= 0x00000080; - classObjectPresent_ = value; - - return this; - } - /** - * optional bool class_object_present = 9 [default = false]; - */ - public Builder clearClassObjectPresent() { bitField0_ = (bitField0_ & ~0x00000080); - classObjectPresent_ = false; return this; } 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 01b7fdf4aa9..cf6e40e8905 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 @@ -48,6 +48,7 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme private final ClassId classId; private final ProtoBuf.Class classProto; + private final StorageManager storageManager; private final TypeDeserializer typeDeserializer; private final DescriptorDeserializer deserializer; private final DeserializedMemberScope memberScope; @@ -74,14 +75,13 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme @NotNull StorageManager storageManager, @NotNull AnnotationDeserializer annotationResolver, @NotNull DescriptorFinder descriptorFinder, - @NotNull ClassData classData + @NotNull NameResolver nameResolver, + @NotNull ProtoBuf.Class classProto ) { - super(storageManager, - classData.getNameResolver().getClassId(classData.getClassProto().getFqName()).getRelativeClassName().shortName()); - NameResolver nameResolver = classData.getNameResolver(); - this.classProto = classData.getClassProto(); - + super(storageManager, nameResolver.getClassId(classProto.getFqName()).getRelativeClassName().shortName()); + this.classProto = classProto; this.classId = nameResolver.getClassId(classProto.getFqName()); + this.storageManager = storageManager; this.descriptorFinder = descriptorFinder; TypeDeserializer notNullTypeDeserializer = new TypeDeserializer(storageManager, null, nameResolver, @@ -238,7 +238,7 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme @Nullable private ClassDescriptor computeClassObjectDescriptor() { - if (!classProto.getClassObjectPresent()) { + if (!classProto.hasClassObject()) { return null; } @@ -252,6 +252,16 @@ public class DeserializedClassDescriptor extends AbstractClassDescriptor impleme return classObject; } + if (getKind() == ClassKind.OBJECT) { + ProtoBuf.Class.ClassObject classObjectProto = classProto.getClassObject(); + if (!classObjectProto.hasData()) { + throw new IllegalStateException("Object should have a serialized class object: " + classId); + } + + return new DeserializedClassDescriptor(storageManager, annotationDeserializer, descriptorFinder, deserializer.getNameResolver(), + classObjectProto.getData()); + } + return descriptorFinder.findClass(classId.createNestedClassId(getClassObjectName(getName()))); } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/scope/JavaPackageScope.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/scope/JavaPackageScope.java index 39d7fbaecc7..60894a40ae4 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/scope/JavaPackageScope.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/scope/JavaPackageScope.java @@ -55,11 +55,7 @@ public final class JavaPackageScope extends JavaBaseScope { @Override public ClassifierDescriptor getClassifier(@NotNull Name name) { - ClassDescriptor classDescriptor = memberResolver.resolveClass(packageFQN.child(name), IGNORE_KOTLIN_SOURCES); - if (classDescriptor == null || classDescriptor.getKind().isSingleton()) { - return null; - } - return classDescriptor; + return memberResolver.resolveClass(packageFQN.child(name), IGNORE_KOTLIN_SOURCES); } @Override diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java index cc4c45921c0..142fee4678c 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializedDescriptorResolver.java @@ -18,6 +18,7 @@ package org.jetbrains.jet.lang.resolve.kotlin; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.jet.descriptors.serialization.ClassData; import org.jetbrains.jet.descriptors.serialization.ClassId; import org.jetbrains.jet.descriptors.serialization.DescriptorFinder; import org.jetbrains.jet.descriptors.serialization.JavaProtoBufUtil; @@ -97,15 +98,22 @@ public final class DeserializedDescriptorResolver { @Nullable public ClassDescriptor resolveClass(@NotNull KotlinJvmBinaryClass kotlinClass) { String[] data = readData(kotlinClass); - return data == null ? null : new DeserializedClassDescriptor(storageManager, annotationDeserializer, javaDescriptorFinder, - JavaProtoBufUtil.readClassDataFrom(data)); + if (data != null) { + ClassData classData = JavaProtoBufUtil.readClassDataFrom(data); + return new DeserializedClassDescriptor(storageManager, annotationDeserializer, javaDescriptorFinder, + classData.getNameResolver(), classData.getClassProto()); + } + return null; } @Nullable public JetScope createKotlinPackageScope(@NotNull NamespaceDescriptor descriptor, @NotNull KotlinJvmBinaryClass kotlinClass) { String[] data = readData(kotlinClass); - return data == null ? null : new DeserializedPackageMemberScope(storageManager, descriptor, annotationDeserializer, - javaDescriptorFinder, JavaProtoBufUtil.readPackageDataFrom(data)); + if (data != null) { + return new DeserializedPackageMemberScope(storageManager, descriptor, annotationDeserializer, javaDescriptorFinder, + JavaProtoBufUtil.readPackageDataFrom(data)); + } + return null; } @Nullable