diff --git a/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt b/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt new file mode 100644 index 00000000000..83efa6c513a --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt @@ -0,0 +1,7 @@ +package test + +import java.util.* + +fun printStream() = System.out +fun list() = Collections.emptyList() +fun array(a: Array) = Arrays.copyOf(a, 2) \ No newline at end of file diff --git a/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.B.kt b/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.B.kt new file mode 100644 index 00000000000..d7efc560c2c --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.B.kt @@ -0,0 +1,22 @@ +import java.io.PrintStream +import java.util.ArrayList +import test.* + +// To check that flexible types are loaded +class Inv +fun inv(t: T): Inv = Inv() + +fun main(args: Array) { + printStream().checkError() + val p: Inv = inv(printStream()) + val p1: Inv = inv(printStream()) + + list().size() + val l: Inv> = inv(list()) + val l1: Inv?> = inv(list()) + + val a = array(Array(1){0}) + a[0] = 1 + val a1: Inv> = inv(a) + val a2: Inv?> = inv(a) +} \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/type/platform.kt b/compiler/testData/loadJava/compiledKotlin/type/platform.kt new file mode 100644 index 00000000000..af5e0f2bbe8 --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/type/platform.kt @@ -0,0 +1,8 @@ +//ALLOW_AST_ACCESS +package test + +import java.util.* + +fun printStream() = System.out +fun list() = Collections.emptyList() +fun array(a: Array) = Arrays.copyOf(a, 2) \ No newline at end of file diff --git a/compiler/testData/loadJava/compiledKotlin/type/platform.txt b/compiler/testData/loadJava/compiledKotlin/type/platform.txt new file mode 100644 index 00000000000..22f499e937a --- /dev/null +++ b/compiler/testData/loadJava/compiledKotlin/type/platform.txt @@ -0,0 +1,5 @@ +package test + +internal fun array(/*0*/ a: kotlin.Array): kotlin.Array<(out) kotlin.Int!>! +internal fun list(): kotlin.(Mutable)List! +internal fun printStream(): java.io.PrintStream! diff --git a/compiler/tests/org/jetbrains/jet/descriptors/serialization/DebugProtoBuf.java b/compiler/tests/org/jetbrains/jet/descriptors/serialization/DebugProtoBuf.java index 73d1f262c82..42ea3910ffb 100644 --- a/compiler/tests/org/jetbrains/jet/descriptors/serialization/DebugProtoBuf.java +++ b/compiler/tests/org/jetbrains/jet/descriptors/serialization/DebugProtoBuf.java @@ -232,48 +232,48 @@ public final class DebugProtoBuf { // @@protoc_insertion_point(enum_scope:org.jetbrains.jet.descriptors.serialization.Visibility) } - public interface SimpleNameTableOrBuilder + public interface StringTableOrBuilder extends com.google.protobuf.MessageOrBuilder { - // repeated string name = 1; + // repeated string string = 1; /** - * repeated string name = 1; + * repeated string string = 1; */ java.util.List - getNameList(); + getStringList(); /** - * repeated string name = 1; + * repeated string string = 1; */ - int getNameCount(); + int getStringCount(); /** - * repeated string name = 1; + * repeated string string = 1; */ - java.lang.String getName(int index); + java.lang.String getString(int index); /** - * repeated string name = 1; + * repeated string string = 1; */ com.google.protobuf.ByteString - getNameBytes(int index); + getStringBytes(int index); } /** - * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.SimpleNameTable} + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.StringTable} */ - public static final class SimpleNameTable extends + public static final class StringTable extends com.google.protobuf.GeneratedMessage - implements SimpleNameTableOrBuilder { - // Use SimpleNameTable.newBuilder() to construct. - private SimpleNameTable(com.google.protobuf.GeneratedMessage.Builder builder) { + implements StringTableOrBuilder { + // Use StringTable.newBuilder() to construct. + private StringTable(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } - private SimpleNameTable(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } + private StringTable(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } - private static final SimpleNameTable defaultInstance; - public static SimpleNameTable getDefaultInstance() { + private static final StringTable defaultInstance; + public static StringTable getDefaultInstance() { return defaultInstance; } - public SimpleNameTable getDefaultInstanceForType() { + public StringTable getDefaultInstanceForType() { return defaultInstance; } @@ -283,7 +283,7 @@ public final class DebugProtoBuf { getUnknownFields() { return this.unknownFields; } - private SimpleNameTable( + private StringTable( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -308,10 +308,10 @@ public final class DebugProtoBuf { } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.LazyStringArrayList(); + string_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000001; } - name_.add(input.readBytes()); + string_.add(input.readBytes()); break; } } @@ -323,7 +323,7 @@ public final class DebugProtoBuf { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.UnmodifiableLazyStringList(name_); + string_ = new com.google.protobuf.UnmodifiableLazyStringList(string_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); @@ -331,63 +331,63 @@ public final class DebugProtoBuf { } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor; + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_fieldAccessorTable + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.class, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.Builder.class); + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.class, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.Builder.class); } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public SimpleNameTable parsePartialFrom( + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public StringTable parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SimpleNameTable(input, extensionRegistry); + return new StringTable(input, extensionRegistry); } }; @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } - // repeated string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList name_; + // repeated string string = 1; + public static final int STRING_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList string_; /** - * repeated string name = 1; + * repeated string string = 1; */ public java.util.List - getNameList() { - return name_; + getStringList() { + return string_; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public int getNameCount() { - return name_.size(); + public int getStringCount() { + return string_.size(); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public java.lang.String getName(int index) { - return name_.get(index); + public java.lang.String getString(int index) { + return string_.get(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ public com.google.protobuf.ByteString - getNameBytes(int index) { - return name_.getByteString(index); + getStringBytes(int index) { + return string_.getByteString(index); } private void initFields() { - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -401,8 +401,8 @@ public final class DebugProtoBuf { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - for (int i = 0; i < name_.size(); i++) { - output.writeBytes(1, name_.getByteString(i)); + for (int i = 0; i < string_.size(); i++) { + output.writeBytes(1, string_.getByteString(i)); } getUnknownFields().writeTo(output); } @@ -415,12 +415,12 @@ public final class DebugProtoBuf { size = 0; { int dataSize = 0; - for (int i = 0; i < name_.size(); i++) { + for (int i = 0; i < string_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(name_.getByteString(i)); + .computeBytesSizeNoTag(string_.getByteString(i)); } size += dataSize; - size += 1 * getNameList().size(); + size += 1 * getStringList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -434,53 +434,53 @@ public final class DebugProtoBuf { return super.writeReplace(); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable 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.DebugProtoBuf.SimpleNameTable parseFrom(byte[] data) + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable 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.DebugProtoBuf.SimpleNameTable parseFrom(java.io.InputStream input) + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable 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.DebugProtoBuf.SimpleNameTable parseDelimitedFrom(java.io.InputStream input) + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseDelimitedFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable 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.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -489,7 +489,7 @@ public final class DebugProtoBuf { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable prototype) { + public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -501,24 +501,24 @@ public final class DebugProtoBuf { return builder; } /** - * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.SimpleNameTable} + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.StringTable} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTableOrBuilder { + implements org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTableOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor; + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_fieldAccessorTable + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_fieldAccessorTable .ensureFieldAccessorsInitialized( - org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.class, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.Builder.class); + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.class, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.Builder.class); } - // Construct using org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.newBuilder() + // Construct using org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -538,7 +538,7 @@ public final class DebugProtoBuf { public Builder clear() { super.clear(); - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -549,52 +549,52 @@ public final class DebugProtoBuf { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor; + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor; } - public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable getDefaultInstanceForType() { - return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.getDefaultInstance(); + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable getDefaultInstanceForType() { + return org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.getDefaultInstance(); } - public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable build() { - org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable result = buildPartial(); + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable build() { + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable buildPartial() { - org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable result = new org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable(this); + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable buildPartial() { + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable result = new org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.UnmodifiableLazyStringList( - name_); + string_ = new com.google.protobuf.UnmodifiableLazyStringList( + string_); bitField0_ = (bitField0_ & ~0x00000001); } - result.name_ = name_; + result.string_ = string_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable) { - return mergeFrom((org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable)other); + if (other instanceof org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable) { + return mergeFrom((org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable other) { - if (other == org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable.getDefaultInstance()) return this; - if (!other.name_.isEmpty()) { - if (name_.isEmpty()) { - name_ = other.name_; + public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable other) { + if (other == org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable.getDefaultInstance()) return this; + if (!other.string_.isEmpty()) { + if (string_.isEmpty()) { + string_ = other.string_; bitField0_ = (bitField0_ & ~0x00000001); } else { - ensureNameIsMutable(); - name_.addAll(other.name_); + ensureStringIsMutable(); + string_.addAll(other.string_); } onChanged(); } @@ -610,11 +610,11 @@ public final class DebugProtoBuf { com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable parsedMessage = null; + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.SimpleNameTable) e.getUnfinishedMessage(); + parsedMessage = (org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.StringTable) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { @@ -625,108 +625,108 @@ public final class DebugProtoBuf { } private int bitField0_; - // repeated string name = 1; - private com.google.protobuf.LazyStringList name_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureNameIsMutable() { + // repeated string string = 1; + private com.google.protobuf.LazyStringList string_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureStringIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.LazyStringArrayList(name_); + string_ = new com.google.protobuf.LazyStringArrayList(string_); bitField0_ |= 0x00000001; } } /** - * repeated string name = 1; + * repeated string string = 1; */ public java.util.List - getNameList() { - return java.util.Collections.unmodifiableList(name_); + getStringList() { + return java.util.Collections.unmodifiableList(string_); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public int getNameCount() { - return name_.size(); + public int getStringCount() { + return string_.size(); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public java.lang.String getName(int index) { - return name_.get(index); + public java.lang.String getString(int index) { + return string_.get(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ public com.google.protobuf.ByteString - getNameBytes(int index) { - return name_.getByteString(index); + getStringBytes(int index) { + return string_.getByteString(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder setName( + public Builder setString( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.set(index, value); + ensureStringIsMutable(); + string_.set(index, value); onChanged(); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addName( + public Builder addString( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.add(value); + ensureStringIsMutable(); + string_.add(value); onChanged(); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addAllName( + public Builder addAllString( java.lang.Iterable values) { - ensureNameIsMutable(); - super.addAll(values, name_); + ensureStringIsMutable(); + super.addAll(values, string_); onChanged(); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder clearName() { - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + public Builder clearString() { + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addNameBytes( + public Builder addStringBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.add(value); + ensureStringIsMutable(); + string_.add(value); onChanged(); return this; } - // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.SimpleNameTable) + // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.StringTable) } static { - defaultInstance = new SimpleNameTable(true); + defaultInstance = new StringTable(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.SimpleNameTable) + // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.StringTable) } public interface QualifiedNameTableOrBuilder @@ -874,10 +874,18 @@ public final class DebugProtoBuf { // required int32 short_name = 2; /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ boolean hasShortName(); /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ int getShortName(); @@ -1106,12 +1114,20 @@ public final class DebugProtoBuf { private int shortName_; /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasShortName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getShortName() { return shortName_; @@ -1439,18 +1455,30 @@ public final class DebugProtoBuf { private int shortName_ ; /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public boolean hasShortName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public int getShortName() { return shortName_; } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder setShortName(int value) { bitField0_ |= 0x00000002; @@ -1460,6 +1488,10 @@ public final class DebugProtoBuf { } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder clearShortName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -2123,6 +2155,60 @@ public final class DebugProtoBuf { * optional bool nullable = 3 [default = false]; */ boolean getNullable(); + + // optional int32 flexible_type_capabilities_id = 4; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + boolean hasFlexibleTypeCapabilitiesId(); + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + int getFlexibleTypeCapabilitiesId(); + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + boolean hasFlexibleUpperBound(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type getFlexibleUpperBound(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder getFlexibleUpperBoundOrBuilder(); } /** * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.Type} @@ -2201,6 +2287,24 @@ public final class DebugProtoBuf { nullable_ = input.readBool(); break; } + case 32: { + bitField0_ |= 0x00000004; + flexibleTypeCapabilitiesId_ = input.readInt32(); + break; + } + case 42: { + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder subBuilder = null; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subBuilder = flexibleUpperBound_.toBuilder(); + } + flexibleUpperBound_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(flexibleUpperBound_); + flexibleUpperBound_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000008; + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -3630,10 +3734,80 @@ public final class DebugProtoBuf { return nullable_; } + // optional int32 flexible_type_capabilities_id = 4; + public static final int FLEXIBLE_TYPE_CAPABILITIES_ID_FIELD_NUMBER = 4; + private int flexibleTypeCapabilitiesId_; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + public boolean hasFlexibleTypeCapabilitiesId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + public int getFlexibleTypeCapabilitiesId() { + return flexibleTypeCapabilitiesId_; + } + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + public static final int FLEXIBLE_UPPER_BOUND_FIELD_NUMBER = 5; + private org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type flexibleUpperBound_; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + public boolean hasFlexibleUpperBound() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type getFlexibleUpperBound() { + return flexibleUpperBound_; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder getFlexibleUpperBoundOrBuilder() { + return flexibleUpperBound_; + } + private void initFields() { constructor_ = org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Constructor.getDefaultInstance(); argument_ = java.util.Collections.emptyList(); nullable_ = false; + flexibleTypeCapabilitiesId_ = 0; + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -3654,6 +3828,12 @@ public final class DebugProtoBuf { return false; } } + if (hasFlexibleUpperBound()) { + if (!getFlexibleUpperBound().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } memoizedIsInitialized = 1; return true; } @@ -3670,6 +3850,12 @@ public final class DebugProtoBuf { if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBool(3, nullable_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(4, flexibleTypeCapabilitiesId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(5, flexibleUpperBound_); + } getUnknownFields().writeTo(output); } @@ -3691,6 +3877,14 @@ public final class DebugProtoBuf { size += com.google.protobuf.CodedOutputStream .computeBoolSize(3, nullable_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, flexibleTypeCapabilitiesId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, flexibleUpperBound_); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -3801,6 +3995,7 @@ public final class DebugProtoBuf { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getConstructorFieldBuilder(); getArgumentFieldBuilder(); + getFlexibleUpperBoundFieldBuilder(); } } private static Builder create() { @@ -3823,6 +4018,14 @@ public final class DebugProtoBuf { } nullable_ = false; bitField0_ = (bitField0_ & ~0x00000004); + flexibleTypeCapabilitiesId_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + if (flexibleUpperBoundBuilder_ == null) { + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.getDefaultInstance(); + } else { + flexibleUpperBoundBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -3872,6 +4075,18 @@ public final class DebugProtoBuf { to_bitField0_ |= 0x00000002; } result.nullable_ = nullable_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + result.flexibleTypeCapabilitiesId_ = flexibleTypeCapabilitiesId_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + if (flexibleUpperBoundBuilder_ == null) { + result.flexibleUpperBound_ = flexibleUpperBound_; + } else { + result.flexibleUpperBound_ = flexibleUpperBoundBuilder_.build(); + } result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -3920,6 +4135,12 @@ public final class DebugProtoBuf { if (other.hasNullable()) { setNullable(other.getNullable()); } + if (other.hasFlexibleTypeCapabilitiesId()) { + setFlexibleTypeCapabilitiesId(other.getFlexibleTypeCapabilitiesId()); + } + if (other.hasFlexibleUpperBound()) { + mergeFlexibleUpperBound(other.getFlexibleUpperBound()); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -3939,6 +4160,12 @@ public final class DebugProtoBuf { return false; } } + if (hasFlexibleUpperBound()) { + if (!getFlexibleUpperBound().isInitialized()) { + + return false; + } + } return true; } @@ -4351,6 +4578,234 @@ public final class DebugProtoBuf { return this; } + // optional int32 flexible_type_capabilities_id = 4; + private int flexibleTypeCapabilitiesId_ ; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public boolean hasFlexibleTypeCapabilitiesId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public int getFlexibleTypeCapabilitiesId() { + return flexibleTypeCapabilitiesId_; + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public Builder setFlexibleTypeCapabilitiesId(int value) { + bitField0_ |= 0x00000008; + flexibleTypeCapabilitiesId_ = value; + onChanged(); + return this; + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public Builder clearFlexibleTypeCapabilitiesId() { + bitField0_ = (bitField0_ & ~0x00000008); + flexibleTypeCapabilitiesId_ = 0; + onChanged(); + return this; + } + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + private org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder> flexibleUpperBoundBuilder_; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public boolean hasFlexibleUpperBound() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type getFlexibleUpperBound() { + if (flexibleUpperBoundBuilder_ == null) { + return flexibleUpperBound_; + } else { + return flexibleUpperBoundBuilder_.getMessage(); + } + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder setFlexibleUpperBound(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type value) { + if (flexibleUpperBoundBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + flexibleUpperBound_ = value; + onChanged(); + } else { + flexibleUpperBoundBuilder_.setMessage(value); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder setFlexibleUpperBound( + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder builderForValue) { + if (flexibleUpperBoundBuilder_ == null) { + flexibleUpperBound_ = builderForValue.build(); + onChanged(); + } else { + flexibleUpperBoundBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder mergeFlexibleUpperBound(org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type value) { + if (flexibleUpperBoundBuilder_ == null) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + flexibleUpperBound_ != org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.getDefaultInstance()) { + flexibleUpperBound_ = + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.newBuilder(flexibleUpperBound_).mergeFrom(value).buildPartial(); + } else { + flexibleUpperBound_ = value; + } + onChanged(); + } else { + flexibleUpperBoundBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder clearFlexibleUpperBound() { + if (flexibleUpperBoundBuilder_ == null) { + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.getDefaultInstance(); + onChanged(); + } else { + flexibleUpperBoundBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder getFlexibleUpperBoundBuilder() { + bitField0_ |= 0x00000010; + onChanged(); + return getFlexibleUpperBoundFieldBuilder().getBuilder(); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder getFlexibleUpperBoundOrBuilder() { + if (flexibleUpperBoundBuilder_ != null) { + return flexibleUpperBoundBuilder_.getMessageOrBuilder(); + } else { + return flexibleUpperBound_; + } + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + private com.google.protobuf.SingleFieldBuilder< + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder> + getFlexibleUpperBoundFieldBuilder() { + if (flexibleUpperBoundBuilder_ == null) { + flexibleUpperBoundBuilder_ = new com.google.protobuf.SingleFieldBuilder< + org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.Type.Builder, org.jetbrains.jet.descriptors.serialization.DebugProtoBuf.TypeOrBuilder>( + flexibleUpperBound_, + getParentForChildren(), + isClean()); + flexibleUpperBound_ = null; + } + return flexibleUpperBoundBuilder_; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.Type) } @@ -4378,10 +4833,18 @@ public final class DebugProtoBuf { // required int32 name = 2; /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ boolean hasName(); /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ int getName(); @@ -4670,12 +5133,20 @@ public final class DebugProtoBuf { private int name_; /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ public int getName() { return name_; @@ -5142,18 +5613,30 @@ public final class DebugProtoBuf { private int name_ ; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000002; @@ -5163,6 +5646,10 @@ public final class DebugProtoBuf { } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -10433,10 +10920,18 @@ public final class DebugProtoBuf { // required int32 name = 6; /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ boolean hasName(); /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ int getName(); @@ -10907,10 +11402,18 @@ public final class DebugProtoBuf { // required int32 name = 2; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ boolean hasName(); /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ int getName(); @@ -11102,12 +11605,20 @@ public final class DebugProtoBuf { private int name_; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; @@ -11564,18 +12075,30 @@ public final class DebugProtoBuf { private int name_ ; /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public int getName() { return name_; } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000002; @@ -11585,6 +12108,10 @@ public final class DebugProtoBuf { } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -12045,12 +12572,20 @@ public final class DebugProtoBuf { private int name_; /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ public int getName() { return name_; @@ -13295,18 +13830,30 @@ public final class DebugProtoBuf { private int name_ ; /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000040; @@ -13316,6 +13863,10 @@ public final class DebugProtoBuf { } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000040); @@ -13765,10 +14316,10 @@ public final class DebugProtoBuf { } private static com.google.protobuf.Descriptors.Descriptor - internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor; + internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_fieldAccessorTable; + internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_org_jetbrains_jet_descriptors_serialization_QualifiedNameTable_descriptor; private static @@ -13840,95 +14391,98 @@ public final class DebugProtoBuf { java.lang.String[] descriptorData = { "\n.core/serialization/src/descriptors.deb" + "ug.proto\022+org.jetbrains.jet.descriptors." + - "serialization\"\037\n\017SimpleNameTable\022\014\n\004name" + - "\030\001 \003(\t\"\317\002\n\022QualifiedNameTable\022e\n\016qualifi" + - "ed_name\030\001 \003(\0132M.org.jetbrains.jet.descri" + - "ptors.serialization.QualifiedNameTable.Q" + - "ualifiedName\032\321\001\n\rQualifiedName\022!\n\025parent" + - "_qualified_name\030\001 \001(\005:\002-1\022\022\n\nshort_name\030" + - "\002 \002(\005\022i\n\004kind\030\003 \001(\0162R.org.jetbrains.jet." + - "descriptors.serialization.QualifiedNameT", - "able.QualifiedName.Kind:\007PACKAGE\"\036\n\004Kind" + - "\022\t\n\005CLASS\020\000\022\013\n\007PACKAGE\020\001\"\263\004\n\004Type\022R\n\013con" + - "structor\030\001 \002(\0132=.org.jetbrains.jet.descr" + - "iptors.serialization.Type.Constructor\022L\n" + - "\010argument\030\002 \003(\0132:.org.jetbrains.jet.desc" + - "riptors.serialization.Type.Argument\022\027\n\010n" + - "ullable\030\003 \001(\010:\005false\032\231\001\n\013Constructor\022W\n\004" + - "kind\030\001 \001(\0162B.org.jetbrains.jet.descripto" + - "rs.serialization.Type.Constructor.Kind:\005" + - "CLASS\022\n\n\002id\030\002 \002(\005\"%\n\004Kind\022\t\n\005CLASS\020\000\022\022\n\016", - "TYPE_PARAMETER\020\001\032\323\001\n\010Argument\022^\n\nproject" + - "ion\030\001 \001(\0162E.org.jetbrains.jet.descriptor" + - "s.serialization.Type.Argument.Projection" + - ":\003INV\022?\n\004type\030\002 \002(\01321.org.jetbrains.jet." + - "descriptors.serialization.Type\"&\n\nProjec" + - "tion\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\"\213\002\n\rTypeP" + - "arameter\022\n\n\002id\030\001 \002(\005\022\014\n\004name\030\002 \002(\005\022\026\n\007re" + - "ified\030\003 \001(\010:\005false\022Z\n\010variance\030\004 \001(\0162C.o" + - "rg.jetbrains.jet.descriptors.serializati" + - "on.TypeParameter.Variance:\003INV\022F\n\013upper_", - "bound\030\005 \003(\01321.org.jetbrains.jet.descript" + - "ors.serialization.Type\"$\n\010Variance\022\006\n\002IN" + - "\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\"\254\006\n\005Class\022\020\n\005flags\030" + - "\001 \001(\005:\0010\022\030\n\020extra_visibility\030\002 \001(\t\022\017\n\007fq" + - "_name\030\003 \002(\005\022T\n\014class_object\030\004 \001(\0132>.org." + - "jetbrains.jet.descriptors.serialization." + - "Class.ClassObject\022R\n\016type_parameter\030\005 \003(" + - "\0132:.org.jetbrains.jet.descriptors.serial" + - "ization.TypeParameter\022D\n\tsupertype\030\006 \003(\013" + - "21.org.jetbrains.jet.descriptors.seriali", - "zation.Type\022\031\n\021nested_class_name\030\007 \003(\005\022E" + - "\n\006member\030\013 \003(\01325.org.jetbrains.jet.descr" + - "iptors.serialization.Callable\022\022\n\nenum_en" + - "try\030\014 \003(\005\022b\n\023primary_constructor\030\r \001(\0132E" + - ".org.jetbrains.jet.descriptors.serializa" + - "tion.Class.PrimaryConstructor\032O\n\013ClassOb" + - "ject\022@\n\004data\030\001 \001(\01322.org.jetbrains.jet.d" + - "escriptors.serialization.Class\032Y\n\022Primar" + - "yConstructor\022C\n\004data\030\001 \001(\01325.org.jetbrai" + - "ns.jet.descriptors.serialization.Callabl", - "e\"p\n\004Kind\022\t\n\005CLASS\020\000\022\t\n\005TRAIT\020\001\022\016\n\nENUM_" + - "CLASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CL" + - "ASS\020\004\022\n\n\006OBJECT\020\005\022\020\n\014CLASS_OBJECT\020\006\"P\n\007P" + - "ackage\022E\n\006member\030\001 \003(\01325.org.jetbrains.j" + - "et.descriptors.serialization.Callable\"\220\006" + - "\n\010Callable\022\r\n\005flags\030\001 \001(\005\022\030\n\020extra_visib" + - "ility\030\002 \001(\t\022\024\n\014getter_flags\030\t \001(\005\022\024\n\014set" + - "ter_flags\030\n \001(\005\022R\n\016type_parameter\030\004 \003(\0132" + + "serialization\"\035\n\013StringTable\022\016\n\006string\030\001" + + " \003(\t\"\317\002\n\022QualifiedNameTable\022e\n\016qualified" + + "_name\030\001 \003(\0132M.org.jetbrains.jet.descript" + + "ors.serialization.QualifiedNameTable.Qua" + + "lifiedName\032\321\001\n\rQualifiedName\022!\n\025parent_q" + + "ualified_name\030\001 \001(\005:\002-1\022\022\n\nshort_name\030\002 " + + "\002(\005\022i\n\004kind\030\003 \001(\0162R.org.jetbrains.jet.de" + + "scriptors.serialization.QualifiedNameTab", + "le.QualifiedName.Kind:\007PACKAGE\"\036\n\004Kind\022\t" + + "\n\005CLASS\020\000\022\013\n\007PACKAGE\020\001\"\253\005\n\004Type\022R\n\013const" + + "ructor\030\001 \002(\0132=.org.jetbrains.jet.descrip" + + "tors.serialization.Type.Constructor\022L\n\010a" + + "rgument\030\002 \003(\0132:.org.jetbrains.jet.descri" + + "ptors.serialization.Type.Argument\022\027\n\010nul" + + "lable\030\003 \001(\010:\005false\022%\n\035flexible_type_capa" + + "bilities_id\030\004 \001(\005\022O\n\024flexible_upper_boun" + + "d\030\005 \001(\01321.org.jetbrains.jet.descriptors." + + "serialization.Type\032\231\001\n\013Constructor\022W\n\004ki", + "nd\030\001 \001(\0162B.org.jetbrains.jet.descriptors" + + ".serialization.Type.Constructor.Kind:\005CL" + + "ASS\022\n\n\002id\030\002 \002(\005\"%\n\004Kind\022\t\n\005CLASS\020\000\022\022\n\016TY" + + "PE_PARAMETER\020\001\032\323\001\n\010Argument\022^\n\nprojectio" + + "n\030\001 \001(\0162E.org.jetbrains.jet.descriptors." + + "serialization.Type.Argument.Projection:\003" + + "INV\022?\n\004type\030\002 \002(\01321.org.jetbrains.jet.de" + + "scriptors.serialization.Type\"&\n\nProjecti" + + "on\022\006\n\002IN\020\000\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\"\213\002\n\rTypePar" + + "ameter\022\n\n\002id\030\001 \002(\005\022\014\n\004name\030\002 \002(\005\022\026\n\007reif", + "ied\030\003 \001(\010:\005false\022Z\n\010variance\030\004 \001(\0162C.org" + + ".jetbrains.jet.descriptors.serialization" + + ".TypeParameter.Variance:\003INV\022F\n\013upper_bo" + + "und\030\005 \003(\01321.org.jetbrains.jet.descriptor" + + "s.serialization.Type\"$\n\010Variance\022\006\n\002IN\020\000" + + "\022\007\n\003OUT\020\001\022\007\n\003INV\020\002\"\254\006\n\005Class\022\020\n\005flags\030\001 " + + "\001(\005:\0010\022\030\n\020extra_visibility\030\002 \001(\t\022\017\n\007fq_n" + + "ame\030\003 \002(\005\022T\n\014class_object\030\004 \001(\0132>.org.je" + + "tbrains.jet.descriptors.serialization.Cl" + + "ass.ClassObject\022R\n\016type_parameter\030\005 \003(\0132", ":.org.jetbrains.jet.descriptors.serializ" + - "ation.TypeParameter\022H\n\rreceiver_type\030\005 \001", - "(\01321.org.jetbrains.jet.descriptors.seria" + - "lization.Type\022\014\n\004name\030\006 \002(\005\022]\n\017value_par" + - "ameter\030\007 \003(\0132D.org.jetbrains.jet.descrip" + - "tors.serialization.Callable.ValueParamet" + - "er\022F\n\013return_type\030\010 \002(\01321.org.jetbrains." + - "jet.descriptors.serialization.Type\032\305\001\n\016V" + - "alueParameter\022\r\n\005flags\030\001 \001(\005\022\014\n\004name\030\002 \002" + - "(\005\022?\n\004type\030\003 \002(\01321.org.jetbrains.jet.des" + - "criptors.serialization.Type\022N\n\023vararg_el" + - "ement_type\030\004 \001(\01321.org.jetbrains.jet.des", - "criptors.serialization.Type*\005\010d\020\310\001\"Q\n\nMe" + - "mberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERRI" + - "DE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003\":\n" + - "\014CallableKind\022\007\n\003FUN\020\000\022\007\n\003VAL\020\001\022\007\n\003VAR\020\002" + - "\022\017\n\013CONSTRUCTOR\020\003*\005\010d\020\310\001*-\n\010Modality\022\t\n\005" + - "FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002*M\n\nVisib" + - "ility\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROT" + - "ECTED\020\002\022\n\n\006PUBLIC\020\003\022\t\n\005EXTRA\020\004B\022B\rDebugP" + - "rotoBuf\210\001\000" + "ation.TypeParameter\022D\n\tsupertype\030\006 \003(\01321" + + ".org.jetbrains.jet.descriptors.serializa" + + "tion.Type\022\031\n\021nested_class_name\030\007 \003(\005\022E\n\006" + + "member\030\013 \003(\01325.org.jetbrains.jet.descrip" + + "tors.serialization.Callable\022\022\n\nenum_entr" + + "y\030\014 \003(\005\022b\n\023primary_constructor\030\r \001(\0132E.o" + + "rg.jetbrains.jet.descriptors.serializati" + + "on.Class.PrimaryConstructor\032O\n\013ClassObje" + + "ct\022@\n\004data\030\001 \001(\01322.org.jetbrains.jet.des", + "criptors.serialization.Class\032Y\n\022PrimaryC" + + "onstructor\022C\n\004data\030\001 \001(\01325.org.jetbrains" + + ".jet.descriptors.serialization.Callable\"" + + "p\n\004Kind\022\t\n\005CLASS\020\000\022\t\n\005TRAIT\020\001\022\016\n\nENUM_CL" + + "ASS\020\002\022\016\n\nENUM_ENTRY\020\003\022\024\n\020ANNOTATION_CLAS" + + "S\020\004\022\n\n\006OBJECT\020\005\022\020\n\014CLASS_OBJECT\020\006\"P\n\007Pac" + + "kage\022E\n\006member\030\001 \003(\01325.org.jetbrains.jet" + + ".descriptors.serialization.Callable\"\220\006\n\010" + + "Callable\022\r\n\005flags\030\001 \001(\005\022\030\n\020extra_visibil" + + "ity\030\002 \001(\t\022\024\n\014getter_flags\030\t \001(\005\022\024\n\014sette", + "r_flags\030\n \001(\005\022R\n\016type_parameter\030\004 \003(\0132:." + + "org.jetbrains.jet.descriptors.serializat" + + "ion.TypeParameter\022H\n\rreceiver_type\030\005 \001(\013" + + "21.org.jetbrains.jet.descriptors.seriali" + + "zation.Type\022\014\n\004name\030\006 \002(\005\022]\n\017value_param" + + "eter\030\007 \003(\0132D.org.jetbrains.jet.descripto" + + "rs.serialization.Callable.ValueParameter" + + "\022F\n\013return_type\030\010 \002(\01321.org.jetbrains.je" + + "t.descriptors.serialization.Type\032\305\001\n\016Val" + + "ueParameter\022\r\n\005flags\030\001 \001(\005\022\014\n\004name\030\002 \002(\005", + "\022?\n\004type\030\003 \002(\01321.org.jetbrains.jet.descr" + + "iptors.serialization.Type\022N\n\023vararg_elem" + + "ent_type\030\004 \001(\01321.org.jetbrains.jet.descr" + + "iptors.serialization.Type*\005\010d\020\310\001\"Q\n\nMemb" + + "erKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE_OVERRIDE" + + "\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZED\020\003\":\n\014C" + + "allableKind\022\007\n\003FUN\020\000\022\007\n\003VAL\020\001\022\007\n\003VAR\020\002\022\017" + + "\n\013CONSTRUCTOR\020\003*\005\010d\020\310\001*-\n\010Modality\022\t\n\005FI" + + "NAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010ABSTRACT\020\002*M\n\nVisibil" + + "ity\022\014\n\010INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTEC", + "TED\020\002\022\n\n\006PUBLIC\020\003\022\t\n\005EXTRA\020\004B\022B\rDebugPro" + + "toBuf\210\001\000" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; - internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor = + internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor = getDescriptor().getMessageTypes().get(0); - internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_fieldAccessorTable = new + internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_org_jetbrains_jet_descriptors_serialization_SimpleNameTable_descriptor, - new java.lang.String[] { "Name", }); + internal_static_org_jetbrains_jet_descriptors_serialization_StringTable_descriptor, + new java.lang.String[] { "String", }); internal_static_org_jetbrains_jet_descriptors_serialization_QualifiedNameTable_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_org_jetbrains_jet_descriptors_serialization_QualifiedNameTable_fieldAccessorTable = new @@ -13946,7 +14500,7 @@ public final class DebugProtoBuf { internal_static_org_jetbrains_jet_descriptors_serialization_Type_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_jet_descriptors_serialization_Type_descriptor, - new java.lang.String[] { "Constructor", "Argument", "Nullable", }); + new java.lang.String[] { "Constructor", "Argument", "Nullable", "FlexibleTypeCapabilitiesId", "FlexibleUpperBound", }); internal_static_org_jetbrains_jet_descriptors_serialization_Type_Constructor_descriptor = internal_static_org_jetbrains_jet_descriptors_serialization_Type_descriptor.getNestedTypes().get(0); internal_static_org_jetbrains_jet_descriptors_serialization_Type_Constructor_fieldAccessorTable = new diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java index c646d39fb89..b7eb20b52f5 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/CompileKotlinAgainstKotlinTestGenerated.java @@ -128,6 +128,12 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl doTest(fileName); } + @TestMetadata("PlatformTypes.A.kt") + public void testPlatformTypes() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PlatformTypes.A.kt"); + doTest(fileName); + } + @TestMetadata("PropertyReference.A.kt") public void testPropertyReference() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/PropertyReference.A.kt"); diff --git a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java index 2e2d891bc81..5480ff264ab 100644 --- a/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/jvm/compiler/LoadJavaTestGenerated.java @@ -4612,6 +4612,12 @@ public class LoadJavaTestGenerated extends AbstractLoadJavaTest { doTestCompiledKotlin(fileName); } + @TestMetadata("platform.kt") + public void testPlatform() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/platform.kt"); + doTestCompiledKotlin(fileName); + } + @TestMetadata("String.kt") public void testString() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/String.kt"); diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java index 2b3ba996043..494530e12ea 100644 --- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/LazyResolveRecursiveComparingTestGenerated.java @@ -2826,6 +2826,12 @@ public class LazyResolveRecursiveComparingTestGenerated extends AbstractLazyReso doTest(fileName); } + @TestMetadata("platform.kt") + public void testPlatform() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/platform.kt"); + doTest(fileName); + } + @TestMetadata("String.kt") public void testString() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/String.kt"); diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/types/LazyJavaTypeResolver.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/types/LazyJavaTypeResolver.kt index 3d20ecd84fb..bd8a6597477 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/types/LazyJavaTypeResolver.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/lazy/types/LazyJavaTypeResolver.kt @@ -32,15 +32,17 @@ import org.jetbrains.jet.storage.* import java.util.HashSet import org.jetbrains.jet.lang.types.checker.JetTypeChecker import org.jetbrains.jet.lang.resolve.java.PLATFORM_TYPES -import org.jetbrains.jet.lang.resolve.java.lazy.types.Flexibility.* +import org.jetbrains.jet.lang.resolve.java.lazy.types.JavaTypeFlexibility.* import org.jetbrains.jet.lang.descriptors.annotations.Annotations import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames +import org.jetbrains.jet.lang.resolve.name.FqName +import kotlin.platform.platformStatic class LazyJavaTypeResolver( private val c: LazyJavaResolverContext, private val typeParameterResolver: TypeParameterResolver ) { - + public fun transformJavaType(javaType: JavaType, attr: JavaTypeAttributes): JetType { return when (javaType) { is JavaPrimitiveType -> { @@ -49,9 +51,13 @@ class LazyJavaTypeResolver( assert(jetType != null, "Primitive type is not found: " + canonicalText) jetType!! } - is JavaClassifierType -> if (PLATFORM_TYPES && attr.allowFlexible && attr.howThisTypeIsUsed != SUPERTYPE) - LazyFlexibleJavaClassifierType(javaType, attr) - else LazyJavaClassifierType(javaType, attr) + is JavaClassifierType -> + if (PLATFORM_TYPES && attr.allowFlexible && attr.howThisTypeIsUsed != SUPERTYPE) + FlexibleJavaClassifierTypeCapabilities.create( + LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_LOWER_BOUND)), + LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_UPPER_BOUND)) + ) + else LazyJavaClassifierType(javaType, attr) is JavaArrayType -> transformArrayType(javaType, attr) else -> throw UnsupportedOperationException("Unsupported type: " + javaType) } @@ -63,7 +69,7 @@ class LazyJavaTypeResolver( val jetType = JavaToKotlinClassMap.getInstance().mapPrimitiveKotlinClass("[" + javaComponentType.getCanonicalText()) if (jetType != null) { return if (PLATFORM_TYPES && attr.allowFlexible) - FlexibleJavaClassifierType.create(jetType, TypeUtils.makeNullable(jetType)) + FlexibleJavaClassifierTypeCapabilities.create(jetType, TypeUtils.makeNullable(jetType)) else TypeUtils.makeNullableAsSpecified(jetType, !attr.isMarkedNotNull) } } @@ -74,7 +80,7 @@ class LazyJavaTypeResolver( val componentType = transformJavaType(javaComponentType, howArgumentTypeIsUsed.toAttributes(attr.allowFlexible)) val result = KotlinBuiltIns.getInstance().getArrayType(projectionKind, componentType) return if (PLATFORM_TYPES && attr.allowFlexible) - FlexibleJavaClassifierType.create( + FlexibleJavaClassifierTypeCapabilities.create( KotlinBuiltIns.getInstance().getArrayType(INVARIANT, componentType), TypeUtils.makeNullable( KotlinBuiltIns.getInstance().getArrayType(OUT_VARIANCE, componentType) @@ -268,67 +274,60 @@ class LazyJavaTypeResolver( override fun getAnnotations() = attr.annotations } - public open class FlexibleJavaClassifierType protected ( - lowerBound: JetType, - upperBound: JetType - ) : DelegatingFlexibleType(lowerBound, upperBound), CustomTypeVariable, Specificity { - public class object { - public fun create(lowerBound: JetType, upperBound: JetType): JetType { - if (lowerBound == upperBound) return lowerBound - return FlexibleJavaClassifierType(lowerBound, upperBound) + public object FlexibleJavaClassifierTypeCapabilities : FlexibleTypeCapabilities { + platformStatic fun create(lowerBound: JetType, upperBound: JetType) = DelegatingFlexibleType.create(lowerBound, upperBound, this) + + override val id: String get() = "kotlin.jvm.PlatformType" + + override fun getCapability(capabilityClass: Class, jetType: JetType, flexibility: Flexibility): T? { + if (capabilityClass.isAssignableFrom(javaClass())) + [suppress("UNCHECKED_CAST")] + return Impl(flexibility) as T + else return null + } + + + private class Impl(val flexibility: Flexibility) : CustomTypeVariable, Specificity { + + private val lowerBound: JetType get() = flexibility.getLowerBound() + private val upperBound: JetType get() = flexibility.getUpperBound() + + override val isTypeVariable: Boolean = lowerBound.getConstructor() == upperBound.getConstructor() + && lowerBound.getConstructor().getDeclarationDescriptor() is TypeParameterDescriptor + + override val typeParameterDescriptor: TypeParameterDescriptor? = + if (isTypeVariable) lowerBound.getConstructor().getDeclarationDescriptor() as TypeParameterDescriptor else null + + override fun substitutionResult(replacement: JetType): JetType { + return if (replacement.isFlexible()) replacement + else create(TypeUtils.makeNotNullable(replacement), TypeUtils.makeNullable(replacement)) } - } - override fun create(lowerBound: JetType, upperBound: JetType): JetType { - return FlexibleJavaClassifierType.create(lowerBound, upperBound) - } - - override val isTypeVariable: Boolean = lowerBound.getConstructor() == upperBound.getConstructor() - && lowerBound.getConstructor().getDeclarationDescriptor() is TypeParameterDescriptor - - override val typeParameterDescriptor: TypeParameterDescriptor? = if (isTypeVariable) lowerBound.getConstructor().getDeclarationDescriptor() as TypeParameterDescriptor else null - - override fun substitutionResult(replacement: JetType): JetType { - return if (replacement.isFlexible()) replacement - else FlexibleJavaClassifierType(TypeUtils.makeNotNullable(replacement), TypeUtils.makeNullable(replacement)) - } - - override fun getSpecificityRelationTo(otherType: JetType): Specificity.Relation { - // For primitive types we have to take care of the case when there are two overloaded methods like - // foo(int) and foo(Integer) - // if we do not discriminate one of them, any call to foo(kotlin.Int) will result in overload resolution ambiguity - // so, for such cases, we discriminate Integer in favour of int - if (!KotlinBuiltIns.getInstance().isPrimitiveType(otherType) || !KotlinBuiltIns.getInstance().isPrimitiveType(getLowerBound())) { - return Specificity.Relation.DONT_KNOW + override fun getSpecificityRelationTo(otherType: JetType): Specificity.Relation { + // For primitive types we have to take care of the case when there are two overloaded methods like + // foo(int) and foo(Integer) + // if we do not discriminate one of them, any call to foo(kotlin.Int) will result in overload resolution ambiguity + // so, for such cases, we discriminate Integer in favour of int + if (!KotlinBuiltIns.getInstance().isPrimitiveType(otherType) || !KotlinBuiltIns.getInstance().isPrimitiveType(lowerBound)) { + return Specificity.Relation.DONT_KNOW + } + // Int! >< Int? + if (otherType.isFlexible()) return Specificity.Relation.DONT_KNOW + // Int? >< Int! + if (otherType.isNullable()) return Specificity.Relation.DONT_KNOW + // Int! lessSpecific Int + return Specificity.Relation.LESS_SPECIFIC } - // Int! >< Int? - if (otherType.isFlexible()) return Specificity.Relation.DONT_KNOW - // Int? >< Int! - if (otherType.isNullable()) return Specificity.Relation.DONT_KNOW - // Int! lessSpecific Int - return Specificity.Relation.LESS_SPECIFIC } } - /* - * For a java type like java.util.List - * lowerBound = MutableList - * upperBound = List - */ - private inner class LazyFlexibleJavaClassifierType( - javaType: JavaClassifierType, - attr: JavaTypeAttributes - ) : FlexibleJavaClassifierType( - LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_LOWER_BOUND)), - LazyJavaClassifierType(javaType, attr.toFlexible(FLEXIBLE_UPPER_BOUND)) - ) } trait JavaTypeAttributes { val howThisTypeIsUsed: TypeUsage val howThisTypeIsUsedAccordingToAnnotations: TypeUsage val isMarkedNotNull: Boolean - val flexibility: Flexibility + val flexibility: JavaTypeFlexibility get() = INFLEXIBLE val allowFlexible: Boolean get() = true @@ -337,7 +336,7 @@ trait JavaTypeAttributes { fun JavaTypeAttributes.isFlexible() = flexibility != INFLEXIBLE -enum class Flexibility { +enum class JavaTypeFlexibility { INFLEXIBLE FLEXIBLE_UPPER_BOUND FLEXIBLE_LOWER_BOUND @@ -375,7 +374,7 @@ fun TypeUsage.toAttributes(allowFlexible: Boolean = true) = object : JavaTypeAtt override val annotations: Annotations = Annotations.EMPTY } -fun JavaTypeAttributes.toFlexible(flexibility: Flexibility) = +fun JavaTypeAttributes.toFlexible(flexibility: JavaTypeFlexibility) = object : JavaTypeAttributes by this { override val flexibility = flexibility } diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java index 49fd0f79e20..d0b2bba46ae 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/java/sam/SingleAbstractMethodUtils.java @@ -102,7 +102,7 @@ public class SingleAbstractMethodUtils { if (fixedProjections == null) return null; if (JavaPackage.getPLATFORM_TYPES() && !isSamConstructor) { - return LazyJavaTypeResolver.FlexibleJavaClassifierType.OBJECT$.create(fixedProjections, TypeUtils.makeNullable(fixedProjections)); + return LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.create(fixedProjections, TypeUtils.makeNullable(fixedProjections)); } return TypeUtils.makeNullableAsSpecified(fixedProjections, !isSamConstructor && samType.isNullable()); diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializationGlobalContextForJava.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializationGlobalContextForJava.kt index 400bb97136f..8b62c4a56c7 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializationGlobalContextForJava.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/DeserializationGlobalContextForJava.kt @@ -30,4 +30,4 @@ public class DeserializationGlobalContextForJava( constantLoader: ConstantDescriptorLoader, packageFragmentProvider: LazyJavaPackageFragmentProvider ) : DeserializationGlobalContext(storageManager, moduleDescriptor, classDataFinder, annotationLoader, - constantLoader, packageFragmentProvider) \ No newline at end of file + constantLoader, packageFragmentProvider, JavaFlexibleTypeCapabilitiesDeserializer) \ No newline at end of file diff --git a/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt new file mode 100644 index 00000000000..b50fac0319a --- /dev/null +++ b/core/descriptor.loader.java/src/org/jetbrains/jet/lang/resolve/kotlin/JavaFlexibleTypeCapabilitiesDeserializer.kt @@ -0,0 +1,32 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.lang.resolve.kotlin + +import org.jetbrains.jet.descriptors.serialization.FlexibleTypeCapabilitiesDeserializer +import org.jetbrains.jet.lang.resolve.name.FqName +import org.jetbrains.jet.lang.resolve.java.lazy.types.LazyJavaTypeResolver +import org.jetbrains.jet.lang.types.FlexibleTypeCapabilities +import org.jetbrains.jet.lang.types + +object JavaFlexibleTypeCapabilitiesDeserializer : FlexibleTypeCapabilitiesDeserializer { + override fun capabilitiesById(id: String): FlexibleTypeCapabilities? { + return if (id == LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities.id) + LazyJavaTypeResolver.FlexibleJavaClassifierTypeCapabilities + else null + } + +} \ No newline at end of file diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/CommonSupertypes.java b/core/descriptors/src/org/jetbrains/jet/lang/types/CommonSupertypes.java index d0208d8c735..eab862db50e 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/CommonSupertypes.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/CommonSupertypes.java @@ -80,11 +80,14 @@ public class CommonSupertypes { boolean hasFlexible = false; List upper = new ArrayList(types.size()); List lower = new ArrayList(types.size()); + Set capabilities = new LinkedHashSet(); for (JetType type : types) { if (TypesPackage.isFlexible(type)) { hasFlexible = true; - upper.add(TypesPackage.flexibility(type).getUpperBound()); - lower.add(TypesPackage.flexibility(type).getLowerBound()); + Flexibility flexibility = TypesPackage.flexibility(type); + upper.add(flexibility.getUpperBound()); + lower.add(flexibility.getLowerBound()); + capabilities.add(flexibility.getExtraCapabilities()); } else { upper.add(type); @@ -95,7 +98,8 @@ public class CommonSupertypes { if (!hasFlexible) return commonSuperTypeForInflexible(types, recursionDepth, maxDepth); return DelegatingFlexibleType.OBJECT$.create( commonSuperTypeForInflexible(lower, recursionDepth, maxDepth), - commonSuperTypeForInflexible(upper, recursionDepth, maxDepth) + commonSuperTypeForInflexible(upper, recursionDepth, maxDepth), + KotlinPackage.single(capabilities) // mixing different capabilities is not supported ); } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java b/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java index 9bdf3bab518..0b5e34bf860 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/JetType.java @@ -16,6 +16,7 @@ package org.jetbrains.jet.lang.types; +import kotlin.jvm.KotlinSignature; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.ReadOnly; @@ -45,6 +46,7 @@ public interface JetType extends Annotated { @Override boolean equals(Object other); + @KotlinSignature("fun getCapability(capabilityClass: Class): T?") @Nullable T getCapability(@NotNull Class capabilityClass); } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeSubstitutor.java b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeSubstitutor.java index a8e16bd9cc0..eb7c39f4c22 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/TypeSubstitutor.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/TypeSubstitutor.java @@ -156,15 +156,17 @@ public class TypeSubstitutor { JetType type = originalProjection.getType(); Variance originalProjectionKind = originalProjection.getProjectionKind(); if (TypesPackage.isFlexible(type) && !TypesPackage.isCustomTypeVariable(type)) { + Flexibility flexibility = TypesPackage.flexibility(type); TypeProjection substitutedLower = - unsafeSubstitute(new TypeProjectionImpl(originalProjectionKind, TypesPackage.flexibility(type).getLowerBound()), recursionDepth + 1); + unsafeSubstitute(new TypeProjectionImpl(originalProjectionKind, flexibility.getLowerBound()), recursionDepth + 1); TypeProjection substitutedUpper = - unsafeSubstitute(new TypeProjectionImpl(originalProjectionKind, TypesPackage.flexibility(type).getUpperBound()), recursionDepth + 1); + unsafeSubstitute(new TypeProjectionImpl(originalProjectionKind, flexibility.getUpperBound()), recursionDepth + 1); // todo: projection kind is neglected return new TypeProjectionImpl(originalProjectionKind, DelegatingFlexibleType.OBJECT$.create( substitutedLower.getType(), - substitutedUpper.getType() + substitutedUpper.getType(), + flexibility.getExtraCapabilities() ) ); } diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/flexibleTypes.kt b/core/descriptors/src/org/jetbrains/jet/lang/types/flexibleTypes.kt index 93d90326a0e..8c77b88ef03 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/flexibleTypes.kt +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/flexibleTypes.kt @@ -18,13 +18,25 @@ package org.jetbrains.jet.lang.types import org.jetbrains.jet.lang.types.checker.JetTypeChecker import org.jetbrains.jet.lang.types.Approximation.DataFlowExtras -import org.jetbrains.kotlin.util.printAndReturn +import org.jetbrains.jet.lang.resolve.name.FqName + +public trait FlexibleTypeCapabilities { + fun getCapability(capabilityClass: Class, jetType: JetType, flexibility: Flexibility): T? + val id: String + + object NONE : FlexibleTypeCapabilities { + override fun getCapability(capabilityClass: Class, jetType: JetType, flexibility: Flexibility): T? = null + override val id: String get() = "NONE" + } +} public trait Flexibility : TypeCapability { // lowerBound is a subtype of upperBound public fun getUpperBound(): JetType public fun getLowerBound(): JetType + + public fun getExtraCapabilities(): FlexibleTypeCapabilities } public fun JetType.isFlexible(): Boolean = this.getCapability(javaClass()) != null @@ -104,12 +116,13 @@ public fun JetType.getApproximationTo( public open class DelegatingFlexibleType protected ( private val _lowerBound: JetType, - private val _upperBound: JetType + private val _upperBound: JetType, + private val _extraCapabilities: FlexibleTypeCapabilities ) : DelegatingType(), NullAwareness, Flexibility, Approximation { class object { - public fun create(lowerBound: JetType, upperBound: JetType): JetType { + fun create(lowerBound: JetType, upperBound: JetType, extraCapabilities: FlexibleTypeCapabilities): JetType { if (lowerBound == upperBound) return lowerBound - return DelegatingFlexibleType(lowerBound, upperBound) + return DelegatingFlexibleType(lowerBound, upperBound, extraCapabilities) } } @@ -125,12 +138,17 @@ public open class DelegatingFlexibleType protected ( override fun getUpperBound(): JetType = _upperBound override fun getLowerBound(): JetType = _lowerBound - protected open fun create(lowerBound: JetType, upperBound: JetType): JetType { - return DelegatingFlexibleType.create(lowerBound, upperBound) + override fun getExtraCapabilities() = _extraCapabilities + + override fun getCapability(capabilityClass: Class): T? { + return getExtraCapabilities().getCapability(capabilityClass, this, this) ?: super.getCapability(capabilityClass) } override fun makeNullableAsSpecified(nullable: Boolean): JetType { - return create(TypeUtils.makeNullableAsSpecified(_lowerBound, nullable), TypeUtils.makeNullableAsSpecified(_upperBound, nullable)) + return create( + TypeUtils.makeNullableAsSpecified(_lowerBound, nullable), + TypeUtils.makeNullableAsSpecified(_upperBound, nullable), + getExtraCapabilities()) } override fun approximateToExpectedType(expectedType: JetType, dataFlowExtras: Approximation.DataFlowExtras): Approximation.Info? { diff --git a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/BuiltinsPackageFragment.java b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/BuiltinsPackageFragment.java index fc6f647a48c..93df9d3e18c 100644 --- a/core/descriptors/src/org/jetbrains/jet/lang/types/lang/BuiltinsPackageFragment.java +++ b/core/descriptors/src/org/jetbrains/jet/lang/types/lang/BuiltinsPackageFragment.java @@ -84,6 +84,7 @@ class BuiltinsPackageFragment extends PackageFragmentDescriptorImpl { storageManager, module, builtInsClassDataFinder, // TODO: support annotations AnnotationLoader.UNSUPPORTED, ConstantLoader.UNSUPPORTED, packageFragmentProvider, + FlexibleTypeCapabilitiesDeserializer.ThrowException.INSTANCE$, new ClassDeserializer(storageManager, builtInsClassDataFinder), nameResolver ); members = new DeserializedPackageMemberScope(this, loadPackage(), deserializationContext, classNames); diff --git a/core/serialization/src/descriptors.proto b/core/serialization/src/descriptors.proto index ae214e9b7f0..1de20c77499 100644 --- a/core/serialization/src/descriptors.proto +++ b/core/serialization/src/descriptors.proto @@ -20,14 +20,15 @@ option java_outer_classname = "ProtoBuf"; option optimize_for = LITE_RUNTIME; // Smaller runtime option java_generic_services = false; // Less code -message SimpleNameTable { - repeated string name = 1; +message StringTable { + repeated string string = 1; } message QualifiedNameTable { message QualifiedName { optional int32 parent_qualified_name = 1 [default = -1]; + // Id in the StringTable required int32 short_name = 2; optional Kind kind = 3 [default = PACKAGE]; @@ -68,10 +69,21 @@ message Type { repeated Argument argument = 2; optional bool nullable = 3 [default = false]; + + // Id in the StringTable + // If this field is set, the type is flexible. + // All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound. + optional int32 flexible_type_capabilities_id = 4; + + // While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format, + // we use it mainly to save space: having a special mandatory tag on each an every type just to have an option + // to represent flexible types is too many wasted bytes. + optional Type flexible_upper_bound = 5; } message TypeParameter { required int32 id = 1; + // Id in the StringTable required int32 name = 2; optional bool reified = 3 [default = false]; @@ -188,6 +200,7 @@ message Callable { optional Type receiver_type = 5; + // Id in the StringTable required int32 name = 6; message ValueParameter { @@ -196,6 +209,8 @@ message Callable { has_annotations */ optional int32 flags = 1; + + // Id in the StringTable required int32 name = 2; required Type type = 3; optional Type vararg_element_type = 4; diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java index 6c71c41e961..303f55fbd66 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/DescriptorSerializer.java @@ -20,10 +20,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.descriptors.*; import org.jetbrains.jet.lang.descriptors.annotations.Annotated; import org.jetbrains.jet.lang.resolve.DescriptorFactory; -import org.jetbrains.jet.lang.types.JetType; -import org.jetbrains.jet.lang.types.TypeConstructor; -import org.jetbrains.jet.lang.types.TypeProjection; -import org.jetbrains.jet.lang.types.Variance; +import org.jetbrains.jet.lang.types.*; import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns; import org.jetbrains.jet.renderer.DescriptorRenderer; @@ -343,6 +340,8 @@ public class DescriptorSerializer { public ProtoBuf.Type.Builder type(@NotNull JetType type) { assert !type.isError() : "Can't serialize error types: " + type; // TODO + if (TypesPackage.isFlexible(type)) return flexibleType(type); + ProtoBuf.Type.Builder builder = ProtoBuf.Type.newBuilder(); builder.setConstructor(typeConstructor(type.getConstructor())); @@ -359,6 +358,18 @@ public class DescriptorSerializer { return builder; } + private ProtoBuf.Type.Builder flexibleType(@NotNull JetType type) { + Flexibility flexibility = TypesPackage.flexibility(type); + + ProtoBuf.Type.Builder builder = type(flexibility.getLowerBound()); + + builder.setFlexibleTypeCapabilitiesId(nameTable.getStringIndex(flexibility.getExtraCapabilities().getId())); + + builder.setFlexibleUpperBound(type(flexibility.getUpperBound())); + + return builder; + } + @NotNull private ProtoBuf.Type.Argument.Builder typeArgument(@NotNull TypeProjection typeProjection) { ProtoBuf.Type.Argument.Builder builder = ProtoBuf.Type.Argument.newBuilder(); diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/FlexibleTypeCapabilitiesDeserializer.kt b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/FlexibleTypeCapabilitiesDeserializer.kt new file mode 100644 index 00000000000..18df5732a60 --- /dev/null +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/FlexibleTypeCapabilitiesDeserializer.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.descriptors.serialization + +import org.jetbrains.jet.lang.resolve.name.FqName +import org.jetbrains.jet.lang.types.FlexibleTypeCapabilities + +trait FlexibleTypeCapabilitiesDeserializer { + object ThrowException : FlexibleTypeCapabilitiesDeserializer { + override fun capabilitiesById(id: String): FlexibleTypeCapabilities? { + throw IllegalArgumentException("Capabilities not found by ThrowException manager: $id") + } + } + + fun capabilitiesById(id: String): FlexibleTypeCapabilities? +} \ No newline at end of file diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameResolver.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameResolver.java index 6cb0f4f722b..7d1cf3ad15f 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameResolver.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameResolver.java @@ -26,20 +26,20 @@ import org.jetbrains.jet.lang.resolve.name.Name; import static org.jetbrains.jet.descriptors.serialization.ProtoBuf.QualifiedNameTable.QualifiedName; public class NameResolver { - private final ProtoBuf.SimpleNameTable simpleNames; + private final ProtoBuf.StringTable strings; private final ProtoBuf.QualifiedNameTable qualifiedNames; public NameResolver( - @NotNull ProtoBuf.SimpleNameTable simpleNames, + @NotNull ProtoBuf.StringTable strings, @NotNull ProtoBuf.QualifiedNameTable qualifiedNames ) { - this.simpleNames = simpleNames; + this.strings = strings; this.qualifiedNames = qualifiedNames; } @NotNull - public ProtoBuf.SimpleNameTable getSimpleNameTable() { - return simpleNames; + public ProtoBuf.StringTable getStringTable() { + return strings; } @NotNull @@ -47,9 +47,14 @@ public class NameResolver { return qualifiedNames; } + @NotNull + public String getString(int index) { + return strings.getString(index); + } + @NotNull public Name getName(int index) { - String name = simpleNames.getName(index); + String name = strings.getString(index); return Name.guess(name); } @@ -89,7 +94,7 @@ public class NameResolver { result = parentProto; } } - sb.append(simpleNames.getName(fqNameProto.getShortName())); + sb.append(strings.getString(fqNameProto.getShortName())); return result; } diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameSerializationUtil.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameSerializationUtil.java index 5072b70ced5..b6935947b6c 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameSerializationUtil.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameSerializationUtil.java @@ -30,7 +30,7 @@ public class NameSerializationUtil { @NotNull public static NameResolver deserializeNameResolver(@NotNull InputStream in) { try { - ProtoBuf.SimpleNameTable simpleNames = ProtoBuf.SimpleNameTable.parseDelimitedFrom(in); + ProtoBuf.StringTable simpleNames = ProtoBuf.StringTable.parseDelimitedFrom(in); ProtoBuf.QualifiedNameTable qualifiedNames = ProtoBuf.QualifiedNameTable.parseDelimitedFrom(in); return new NameResolver(simpleNames, qualifiedNames); } @@ -40,20 +40,20 @@ public class NameSerializationUtil { } public static void serializeNameResolver(@NotNull OutputStream out, @NotNull NameResolver nameResolver) { - serializeNameTable(out, nameResolver.getSimpleNameTable(), nameResolver.getQualifiedNameTable()); + serializeNameTable(out, nameResolver.getStringTable(), nameResolver.getQualifiedNameTable()); } public static void serializeNameTable(@NotNull OutputStream out, @NotNull NameTable nameTable) { - serializeNameTable(out, toSimpleNameTable(nameTable), toQualifiedNameTable(nameTable)); + serializeNameTable(out, toStringTable(nameTable), toQualifiedNameTable(nameTable)); } private static void serializeNameTable( @NotNull OutputStream out, - @NotNull ProtoBuf.SimpleNameTable simpleNameTable, + @NotNull ProtoBuf.StringTable stringTable, @NotNull ProtoBuf.QualifiedNameTable qualifiedNameTable ) { try { - simpleNameTable.writeDelimitedTo(out); + stringTable.writeDelimitedTo(out); qualifiedNameTable.writeDelimitedTo(out); } catch (IOException e) { @@ -62,10 +62,10 @@ public class NameSerializationUtil { } @NotNull - public static ProtoBuf.SimpleNameTable toSimpleNameTable(@NotNull NameTable nameTable) { - ProtoBuf.SimpleNameTable.Builder simpleNames = ProtoBuf.SimpleNameTable.newBuilder(); - for (String simpleName : nameTable.getSimpleNames()) { - simpleNames.addName(simpleName); + public static ProtoBuf.StringTable toStringTable(@NotNull NameTable nameTable) { + ProtoBuf.StringTable.Builder simpleNames = ProtoBuf.StringTable.newBuilder(); + for (String simpleName : nameTable.getStrings()) { + simpleNames.addString(simpleName); } return simpleNames.build(); } @@ -81,6 +81,6 @@ public class NameSerializationUtil { @NotNull public static NameResolver createNameResolver(@NotNull NameTable table) { - return new NameResolver(toSimpleNameTable(table), toQualifiedNameTable(table)); + return new NameResolver(toStringTable(table), toQualifiedNameTable(table)); } } diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameTable.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameTable.java index 30a2c7181fa..dea2e3f18e5 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameTable.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/NameTable.java @@ -46,15 +46,15 @@ public class NameTable { } }; - private final Interner simpleNames = new Interner(); + private final Interner strings = new Interner(); private final Interner qualifiedNames = new Interner(QUALIFIED_NAME_BUILDER_HASHING); public NameTable() { } @NotNull - public List getSimpleNames() { - return simpleNames.getAllInternedObjects(); + public List getStrings() { + return strings.getAllInternedObjects(); } @NotNull @@ -63,7 +63,11 @@ public class NameTable { } public int getSimpleNameIndex(@NotNull Name name) { - return simpleNames.intern(name.asString()); + return getStringIndex(name.asString()); + } + + public int getStringIndex(@NotNull String string) { + return strings.intern(string); } public int getFqNameIndex(@NotNull ClassOrPackageFragmentDescriptor descriptor) { diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java index f2b70d29826..d2580bafb5b 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/ProtoBuf.java @@ -180,52 +180,52 @@ public final class ProtoBuf { // @@protoc_insertion_point(enum_scope:org.jetbrains.jet.descriptors.serialization.Visibility) } - public interface SimpleNameTableOrBuilder + public interface StringTableOrBuilder extends com.google.protobuf.MessageLiteOrBuilder { - // repeated string name = 1; + // repeated string string = 1; /** - * repeated string name = 1; + * repeated string string = 1; */ java.util.List - getNameList(); + getStringList(); /** - * repeated string name = 1; + * repeated string string = 1; */ - int getNameCount(); + int getStringCount(); /** - * repeated string name = 1; + * repeated string string = 1; */ - java.lang.String getName(int index); + java.lang.String getString(int index); /** - * repeated string name = 1; + * repeated string string = 1; */ com.google.protobuf.ByteString - getNameBytes(int index); + getStringBytes(int index); } /** - * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.SimpleNameTable} + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.StringTable} */ - public static final class SimpleNameTable extends + public static final class StringTable extends com.google.protobuf.GeneratedMessageLite - implements SimpleNameTableOrBuilder { - // Use SimpleNameTable.newBuilder() to construct. - private SimpleNameTable(com.google.protobuf.GeneratedMessageLite.Builder builder) { + implements StringTableOrBuilder { + // Use StringTable.newBuilder() to construct. + private StringTable(com.google.protobuf.GeneratedMessageLite.Builder builder) { super(builder); } - private SimpleNameTable(boolean noInit) {} + private StringTable(boolean noInit) {} - private static final SimpleNameTable defaultInstance; - public static SimpleNameTable getDefaultInstance() { + private static final StringTable defaultInstance; + public static StringTable getDefaultInstance() { return defaultInstance; } - public SimpleNameTable getDefaultInstanceForType() { + public StringTable getDefaultInstanceForType() { return defaultInstance; } - private SimpleNameTable( + private StringTable( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { @@ -248,10 +248,10 @@ public final class ProtoBuf { } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.LazyStringArrayList(); + string_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000001; } - name_.add(input.readBytes()); + string_.add(input.readBytes()); break; } } @@ -263,58 +263,58 @@ public final class ProtoBuf { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.UnmodifiableLazyStringList(name_); + string_ = new com.google.protobuf.UnmodifiableLazyStringList(string_); } makeExtensionsImmutable(); } } - public static com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - public SimpleNameTable parsePartialFrom( + public static com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + public StringTable parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { - return new SimpleNameTable(input, extensionRegistry); + return new StringTable(input, extensionRegistry); } }; @java.lang.Override - public com.google.protobuf.Parser getParserForType() { + public com.google.protobuf.Parser getParserForType() { return PARSER; } - // repeated string name = 1; - public static final int NAME_FIELD_NUMBER = 1; - private com.google.protobuf.LazyStringList name_; + // repeated string string = 1; + public static final int STRING_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList string_; /** - * repeated string name = 1; + * repeated string string = 1; */ public java.util.List - getNameList() { - return name_; + getStringList() { + return string_; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public int getNameCount() { - return name_.size(); + public int getStringCount() { + return string_.size(); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public java.lang.String getName(int index) { - return name_.get(index); + public java.lang.String getString(int index) { + return string_.get(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ public com.google.protobuf.ByteString - getNameBytes(int index) { - return name_.getByteString(index); + getStringBytes(int index) { + return string_.getByteString(index); } private void initFields() { - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -328,8 +328,8 @@ public final class ProtoBuf { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - for (int i = 0; i < name_.size(); i++) { - output.writeBytes(1, name_.getByteString(i)); + for (int i = 0; i < string_.size(); i++) { + output.writeBytes(1, string_.getByteString(i)); } } @@ -341,12 +341,12 @@ public final class ProtoBuf { size = 0; { int dataSize = 0; - for (int i = 0; i < name_.size(); i++) { + for (int i = 0; i < string_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream - .computeBytesSizeNoTag(name_.getByteString(i)); + .computeBytesSizeNoTag(string_.getByteString(i)); } size += dataSize; - size += 1 * getNameList().size(); + size += 1 * getStringList().size(); } memoizedSerializedSize = size; return size; @@ -359,53 +359,53 @@ public final class ProtoBuf { return super.writeReplace(); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable 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.SimpleNameTable parseFrom(byte[] data) + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable 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.SimpleNameTable parseFrom(java.io.InputStream input) + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable 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.SimpleNameTable parseDelimitedFrom(java.io.InputStream input) + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseDelimitedFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable 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.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } - public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parseFrom( + public static org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -414,19 +414,19 @@ public final class ProtoBuf { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable prototype) { + public static Builder newBuilder(org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } /** - * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.SimpleNameTable} + * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.StringTable} */ public static final class Builder extends com.google.protobuf.GeneratedMessageLite.Builder< - org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable, Builder> - implements org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTableOrBuilder { - // Construct using org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable.newBuilder() + org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable, Builder> + implements org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTableOrBuilder { + // Construct using org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -439,7 +439,7 @@ public final class ProtoBuf { public Builder clear() { super.clear(); - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); return this; } @@ -448,39 +448,39 @@ public final class ProtoBuf { return create().mergeFrom(buildPartial()); } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable getDefaultInstanceForType() { - return org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable.getDefaultInstance(); + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable getDefaultInstanceForType() { + return org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable.getDefaultInstance(); } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable build() { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable result = buildPartial(); + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable build() { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - public org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable buildPartial() { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable result = new org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable(this); + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable buildPartial() { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable result = new org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.UnmodifiableLazyStringList( - name_); + string_ = new com.google.protobuf.UnmodifiableLazyStringList( + string_); bitField0_ = (bitField0_ & ~0x00000001); } - result.name_ = name_; + result.string_ = string_; return result; } - public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable other) { - if (other == org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable.getDefaultInstance()) return this; - if (!other.name_.isEmpty()) { - if (name_.isEmpty()) { - name_ = other.name_; + public Builder mergeFrom(org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable other) { + if (other == org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable.getDefaultInstance()) return this; + if (!other.string_.isEmpty()) { + if (string_.isEmpty()) { + string_ = other.string_; bitField0_ = (bitField0_ & ~0x00000001); } else { - ensureNameIsMutable(); - name_.addAll(other.name_); + ensureStringIsMutable(); + string_.addAll(other.string_); } } @@ -495,11 +495,11 @@ public final class ProtoBuf { com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { - org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable parsedMessage = null; + org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { - parsedMessage = (org.jetbrains.jet.descriptors.serialization.ProtoBuf.SimpleNameTable) e.getUnfinishedMessage(); + parsedMessage = (org.jetbrains.jet.descriptors.serialization.ProtoBuf.StringTable) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { @@ -510,108 +510,108 @@ public final class ProtoBuf { } private int bitField0_; - // repeated string name = 1; - private com.google.protobuf.LazyStringList name_ = com.google.protobuf.LazyStringArrayList.EMPTY; - private void ensureNameIsMutable() { + // repeated string string = 1; + private com.google.protobuf.LazyStringList string_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureStringIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { - name_ = new com.google.protobuf.LazyStringArrayList(name_); + string_ = new com.google.protobuf.LazyStringArrayList(string_); bitField0_ |= 0x00000001; } } /** - * repeated string name = 1; + * repeated string string = 1; */ public java.util.List - getNameList() { - return java.util.Collections.unmodifiableList(name_); + getStringList() { + return java.util.Collections.unmodifiableList(string_); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public int getNameCount() { - return name_.size(); + public int getStringCount() { + return string_.size(); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public java.lang.String getName(int index) { - return name_.get(index); + public java.lang.String getString(int index) { + return string_.get(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ public com.google.protobuf.ByteString - getNameBytes(int index) { - return name_.getByteString(index); + getStringBytes(int index) { + return string_.getByteString(index); } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder setName( + public Builder setString( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.set(index, value); + ensureStringIsMutable(); + string_.set(index, value); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addName( + public Builder addString( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.add(value); + ensureStringIsMutable(); + string_.add(value); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addAllName( + public Builder addAllString( java.lang.Iterable values) { - ensureNameIsMutable(); - super.addAll(values, name_); + ensureStringIsMutable(); + super.addAll(values, string_); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder clearName() { - name_ = com.google.protobuf.LazyStringArrayList.EMPTY; + public Builder clearString() { + string_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); return this; } /** - * repeated string name = 1; + * repeated string string = 1; */ - public Builder addNameBytes( + public Builder addStringBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureNameIsMutable(); - name_.add(value); + ensureStringIsMutable(); + string_.add(value); return this; } - // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.SimpleNameTable) + // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.StringTable) } static { - defaultInstance = new SimpleNameTable(true); + defaultInstance = new StringTable(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.SimpleNameTable) + // @@protoc_insertion_point(class_scope:org.jetbrains.jet.descriptors.serialization.StringTable) } public interface QualifiedNameTableOrBuilder @@ -728,10 +728,18 @@ public final class ProtoBuf { // required int32 short_name = 2; /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ boolean hasShortName(); /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ int getShortName(); @@ -911,12 +919,20 @@ public final class ProtoBuf { private int shortName_; /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasShortName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 short_name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getShortName() { return shortName_; @@ -1202,18 +1218,30 @@ public final class ProtoBuf { private int shortName_ ; /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public boolean hasShortName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public int getShortName() { return shortName_; } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder setShortName(int value) { bitField0_ |= 0x00000002; @@ -1223,6 +1251,10 @@ public final class ProtoBuf { } /** * required int32 short_name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder clearShortName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -1690,6 +1722,50 @@ public final class ProtoBuf { * optional bool nullable = 3 [default = false]; */ boolean getNullable(); + + // optional int32 flexible_type_capabilities_id = 4; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + boolean hasFlexibleTypeCapabilitiesId(); + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + int getFlexibleTypeCapabilitiesId(); + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + boolean hasFlexibleUpperBound(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getFlexibleUpperBound(); } /** * Protobuf type {@code org.jetbrains.jet.descriptors.serialization.Type} @@ -1760,6 +1836,24 @@ public final class ProtoBuf { nullable_ = input.readBool(); break; } + case 32: { + bitField0_ |= 0x00000004; + flexibleTypeCapabilitiesId_ = input.readInt32(); + break; + } + case 42: { + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder subBuilder = null; + if (((bitField0_ & 0x00000008) == 0x00000008)) { + subBuilder = flexibleUpperBound_.toBuilder(); + } + flexibleUpperBound_ = input.readMessage(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.PARSER, extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(flexibleUpperBound_); + flexibleUpperBound_ = subBuilder.buildPartial(); + } + bitField0_ |= 0x00000008; + break; + } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { @@ -2913,10 +3007,68 @@ public final class ProtoBuf { return nullable_; } + // optional int32 flexible_type_capabilities_id = 4; + public static final int FLEXIBLE_TYPE_CAPABILITIES_ID_FIELD_NUMBER = 4; + private int flexibleTypeCapabilitiesId_; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + public boolean hasFlexibleTypeCapabilitiesId() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+     * Id in the StringTable
+     * If this field is set, the type is flexible.
+     * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+     * 
+ */ + public int getFlexibleTypeCapabilitiesId() { + return flexibleTypeCapabilitiesId_; + } + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + public static final int FLEXIBLE_UPPER_BOUND_FIELD_NUMBER = 5; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type flexibleUpperBound_; + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + public boolean hasFlexibleUpperBound() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+     * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+     * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+     * to represent flexible types is too many wasted bytes.
+     * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getFlexibleUpperBound() { + return flexibleUpperBound_; + } + private void initFields() { constructor_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Constructor.getDefaultInstance(); argument_ = java.util.Collections.emptyList(); nullable_ = false; + flexibleTypeCapabilitiesId_ = 0; + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -2937,6 +3089,12 @@ public final class ProtoBuf { return false; } } + if (hasFlexibleUpperBound()) { + if (!getFlexibleUpperBound().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + } memoizedIsInitialized = 1; return true; } @@ -2953,6 +3111,12 @@ public final class ProtoBuf { if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBool(3, nullable_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeInt32(4, flexibleTypeCapabilitiesId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(5, flexibleUpperBound_); + } } private int memoizedSerializedSize = -1; @@ -2973,6 +3137,14 @@ public final class ProtoBuf { size += com.google.protobuf.CodedOutputStream .computeBoolSize(3, nullable_); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(4, flexibleTypeCapabilitiesId_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(5, flexibleUpperBound_); + } memoizedSerializedSize = size; return size; } @@ -3070,6 +3242,10 @@ public final class ProtoBuf { bitField0_ = (bitField0_ & ~0x00000002); nullable_ = false; bitField0_ = (bitField0_ & ~0x00000004); + flexibleTypeCapabilitiesId_ = 0; + bitField0_ = (bitField0_ & ~0x00000008); + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + bitField0_ = (bitField0_ & ~0x00000010); return this; } @@ -3106,6 +3282,14 @@ public final class ProtoBuf { to_bitField0_ |= 0x00000002; } result.nullable_ = nullable_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000004; + } + result.flexibleTypeCapabilitiesId_ = flexibleTypeCapabilitiesId_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000008; + } + result.flexibleUpperBound_ = flexibleUpperBound_; result.bitField0_ = to_bitField0_; return result; } @@ -3128,6 +3312,12 @@ public final class ProtoBuf { if (other.hasNullable()) { setNullable(other.getNullable()); } + if (other.hasFlexibleTypeCapabilitiesId()) { + setFlexibleTypeCapabilitiesId(other.getFlexibleTypeCapabilitiesId()); + } + if (other.hasFlexibleUpperBound()) { + mergeFlexibleUpperBound(other.getFlexibleUpperBound()); + } return this; } @@ -3146,6 +3336,12 @@ public final class ProtoBuf { return false; } } + if (hasFlexibleUpperBound()) { + if (!getFlexibleUpperBound().isInitialized()) { + + return false; + } + } return true; } @@ -3387,6 +3583,160 @@ public final class ProtoBuf { return this; } + // optional int32 flexible_type_capabilities_id = 4; + private int flexibleTypeCapabilitiesId_ ; + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public boolean hasFlexibleTypeCapabilitiesId() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public int getFlexibleTypeCapabilitiesId() { + return flexibleTypeCapabilitiesId_; + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public Builder setFlexibleTypeCapabilitiesId(int value) { + bitField0_ |= 0x00000008; + flexibleTypeCapabilitiesId_ = value; + + return this; + } + /** + * optional int32 flexible_type_capabilities_id = 4; + * + *
+       * Id in the StringTable
+       * If this field is set, the type is flexible.
+       * All the fields above represent its lower bound, and flexible_upper_bound must be set and represents its upper bound.
+       * 
+ */ + public Builder clearFlexibleTypeCapabilitiesId() { + bitField0_ = (bitField0_ & ~0x00000008); + flexibleTypeCapabilitiesId_ = 0; + + return this; + } + + // optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + private org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public boolean hasFlexibleUpperBound() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type getFlexibleUpperBound() { + return flexibleUpperBound_; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder setFlexibleUpperBound(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { + if (value == null) { + throw new NullPointerException(); + } + flexibleUpperBound_ = value; + + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder setFlexibleUpperBound( + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.Builder builderForValue) { + flexibleUpperBound_ = builderForValue.build(); + + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder mergeFlexibleUpperBound(org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type value) { + if (((bitField0_ & 0x00000010) == 0x00000010) && + flexibleUpperBound_ != org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance()) { + flexibleUpperBound_ = + org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.newBuilder(flexibleUpperBound_).mergeFrom(value).buildPartial(); + } else { + flexibleUpperBound_ = value; + } + + bitField0_ |= 0x00000010; + return this; + } + /** + * optional .org.jetbrains.jet.descriptors.serialization.Type flexible_upper_bound = 5; + * + *
+       * While such an "indirect" encoding helps backwards compatibility with pre-flexible-types versions of this format,
+       * we use it mainly to save space: having a special mandatory tag on each an every type just to have an option
+       * to represent flexible types is too many wasted bytes.
+       * 
+ */ + public Builder clearFlexibleUpperBound() { + flexibleUpperBound_ = org.jetbrains.jet.descriptors.serialization.ProtoBuf.Type.getDefaultInstance(); + + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.jet.descriptors.serialization.Type) } @@ -3414,10 +3764,18 @@ public final class ProtoBuf { // required int32 name = 2; /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ boolean hasName(); /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ int getName(); @@ -3647,12 +4005,20 @@ public final class ProtoBuf { private int name_; /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+     * Id in the StringTable
+     * 
*/ public int getName() { return name_; @@ -4052,18 +4418,30 @@ public final class ProtoBuf { private int name_ ; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000002; @@ -4073,6 +4451,10 @@ public final class ProtoBuf { } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -7946,10 +8328,18 @@ public final class ProtoBuf { // required int32 name = 6; /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ boolean hasName(); /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ int getName(); @@ -8325,10 +8715,18 @@ public final class ProtoBuf { // required int32 name = 2; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ boolean hasName(); /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ int getName(); @@ -8491,12 +8889,20 @@ public final class ProtoBuf { private int name_; /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; @@ -8880,18 +9286,30 @@ public final class ProtoBuf { private int name_ ; /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public int getName() { return name_; } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000002; @@ -8901,6 +9319,10 @@ public final class ProtoBuf { } /** * required int32 name = 2; + * + *
+         * Id in the StringTable
+         * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); @@ -9243,12 +9665,20 @@ public final class ProtoBuf { private int name_; /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * required int32 name = 6; + * + *
+     * Id in the StringTable
+     * 
*/ public int getName() { return name_; @@ -10205,18 +10635,30 @@ public final class ProtoBuf { private int name_ ; /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public boolean hasName() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public int getName() { return name_; } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder setName(int value) { bitField0_ |= 0x00000040; @@ -10226,6 +10668,10 @@ public final class ProtoBuf { } /** * required int32 name = 6; + * + *
+       * Id in the StringTable
+       * 
*/ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000040); diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java index a7fae5349ee..61ceb725daf 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/TypeDeserializer.java @@ -100,6 +100,18 @@ public class TypeDeserializer { @NotNull public JetType type(@NotNull ProtoBuf.Type proto) { + if (proto.hasFlexibleTypeCapabilitiesId()) { + String id = context.getNameResolver().getString(proto.getFlexibleTypeCapabilitiesId()); + FlexibleTypeCapabilities capabilities = context.getFlexibleTypeCapabilitiesDeserializer().capabilitiesById(id); + + if (capabilities == null) return ErrorUtils.createErrorType(new DeserializedType(proto) + ": Capabilities not found for id " + id); + + return DelegatingFlexibleType.OBJECT$.create( + new DeserializedType(proto), + new DeserializedType(proto.getFlexibleUpperBound()), + capabilities + ); + } return new DeserializedType(proto); } diff --git a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/context/context.kt b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/context/context.kt index 01e9064edcb..9158f3e81d1 100644 --- a/core/serialization/src/org/jetbrains/jet/descriptors/serialization/context/context.kt +++ b/core/serialization/src/org/jetbrains/jet/descriptors/serialization/context/context.kt @@ -32,6 +32,7 @@ import org.jetbrains.jet.lang.descriptors.ModuleDescriptor import org.jetbrains.jet.lang.descriptors.ClassDescriptor import org.jetbrains.jet.lang.resolve.name.ClassId import org.jetbrains.jet.descriptors.serialization.ClassDeserializer +import org.jetbrains.jet.descriptors.serialization.FlexibleTypeCapabilitiesDeserializer public open class DeserializationGlobalContext( public val storageManager: StorageManager, @@ -40,6 +41,7 @@ public open class DeserializationGlobalContext( public val annotationLoader: AnnotationLoader, public val constantLoader: ConstantLoader, public val packageFragmentProvider: PackageFragmentProvider, + public val flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer, public val classDeserializer: ClassDeserializer = ClassDeserializer(storageManager, classDataFinder) ) { { @@ -48,7 +50,7 @@ public open class DeserializationGlobalContext( public fun withNameResolver(nameResolver: NameResolver): DeserializationContext { return DeserializationContext(storageManager, moduleDescriptor, classDataFinder, annotationLoader, - constantLoader, packageFragmentProvider, classDeserializer, nameResolver) + constantLoader, packageFragmentProvider, flexibleTypeCapabilitiesDeserializer, classDeserializer, nameResolver) } } @@ -60,10 +62,11 @@ public open class DeserializationContext( annotationLoader: AnnotationLoader, constantLoader: ConstantLoader, packageFragmentProvider: PackageFragmentProvider, + flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer, classDeserializer: ClassDeserializer, public val nameResolver: NameResolver ) : DeserializationGlobalContext(storageManager, moduleDescriptor, classDataFinder, annotationLoader, - constantLoader, packageFragmentProvider, classDeserializer) { + constantLoader, packageFragmentProvider, flexibleTypeCapabilitiesDeserializer, classDeserializer) { fun withTypes(containingDeclaration: DeclarationDescriptor): DeserializationContextWithTypes { val typeDeserializer = TypeDeserializer(this, null, "Deserializer for ${containingDeclaration.getName()}", TypeDeserializer.TypeParameterResolver.NONE) @@ -73,7 +76,7 @@ public open class DeserializationContext( fun withTypes(containingDeclaration: DeclarationDescriptor, typeDeserializer: TypeDeserializer): DeserializationContextWithTypes { return DeserializationContextWithTypes(storageManager, moduleDescriptor, classDataFinder, annotationLoader, constantLoader, packageFragmentProvider, classDeserializer, - nameResolver, containingDeclaration, typeDeserializer) + nameResolver, flexibleTypeCapabilitiesDeserializer, containingDeclaration, typeDeserializer) } } @@ -88,10 +91,11 @@ class DeserializationContextWithTypes( packageFragmentProvider: PackageFragmentProvider, classDeserializer: ClassDeserializer, nameResolver: NameResolver, + flexibleTypeCapabilitiesDeserializer: FlexibleTypeCapabilitiesDeserializer, val containingDeclaration: DeclarationDescriptor, val typeDeserializer: TypeDeserializer ) : DeserializationContext(storageManager, moduleDescriptor, classDataFinder, annotationLoader, - constantLoader, packageFragmentProvider, classDeserializer, nameResolver) { + constantLoader, packageFragmentProvider, flexibleTypeCapabilitiesDeserializer, classDeserializer, nameResolver) { val deserializer: MemberDeserializer = MemberDeserializer(this) public fun childContext( diff --git a/idea/idea-analysis/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt b/idea/idea-analysis/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt index 1120c32d519..b757b833b36 100644 --- a/idea/idea-analysis/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt +++ b/idea/idea-analysis/src/org/jetbrains/jet/plugin/libraries/DeserializerForDecompiler.kt @@ -145,7 +145,7 @@ public class DeserializerForDecompiler(val packageDirectory: VirtualFile, val di moduleContainingMissingDependencies.seal() } val deserializationContext = DeserializationGlobalContext(storageManager, moduleDescriptor, classDataFinder, annotationLoader, - constantLoader, packageFragmentProvider) + constantLoader, packageFragmentProvider, JavaFlexibleTypeCapabilitiesDeserializer) private fun createDummyPackageFragment(fqName: FqName): MutablePackageFragmentDescriptor { return MutablePackageFragmentDescriptor(moduleDescriptor, fqName) diff --git a/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java index bda75b6ff85..07fd504fa17 100644 --- a/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/stubs/LazyResolveByStubTestGenerated.java @@ -2823,6 +2823,12 @@ public class LazyResolveByStubTestGenerated extends AbstractLazyResolveByStubTes doTest(fileName); } + @TestMetadata("platform.kt") + public void testPlatform() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/platform.kt"); + doTest(fileName); + } + @TestMetadata("String.kt") public void testString() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/loadJava/compiledKotlin/type/String.kt");