Write multifile part->facade mapping to .kotlin_module

This commit is contained in:
Alexander Udalov
2017-01-09 14:12:22 +03:00
parent 6c1cadf273
commit 69bfc5b4bb
9 changed files with 1138 additions and 80 deletions
@@ -1314,7 +1314,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -1323,7 +1324,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
int getClassNameCount();
@@ -1331,7 +1333,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
java.lang.String getClassName(int index);
@@ -1339,11 +1342,78 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
org.jetbrains.kotlin.protobuf.ByteString
getClassNameBytes(int index);
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
java.util.List<java.lang.Integer> getMultifileFacadeIdList();
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
int getMultifileFacadeIdCount();
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
int getMultifileFacadeId(int index);
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList();
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
int getMultifileFacadeNameCount();
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
java.lang.String getMultifileFacadeName(int index);
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index);
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts}
@@ -1412,6 +1482,36 @@ public final class DebugJvmPackageTable {
className_.add(bs);
break;
}
case 24: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000004;
}
multifileFacadeId_.add(input.readInt32());
break;
}
case 26: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000004;
}
while (input.getBytesUntilLimit() > 0) {
multifileFacadeId_.add(input.readInt32());
}
input.popLimit(limit);
break;
}
case 34: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000008;
}
multifileFacadeName_.add(bs);
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -1423,6 +1523,12 @@ public final class DebugJvmPackageTable {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
className_ = className_.getUnmodifiableView();
}
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_);
}
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView();
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
@@ -1503,7 +1609,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -1514,7 +1621,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public int getClassNameCount() {
@@ -1524,7 +1632,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public java.lang.String getClassName(int index) {
@@ -1534,7 +1643,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
@@ -1542,9 +1652,97 @@ public final class DebugJvmPackageTable {
return className_.getByteString(index);
}
public static final int MULTIFILE_FACADE_ID_FIELD_NUMBER = 3;
private java.util.List<java.lang.Integer> multifileFacadeId_;
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public java.util.List<java.lang.Integer>
getMultifileFacadeIdList() {
return multifileFacadeId_;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeIdCount() {
return multifileFacadeId_.size();
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeId(int index) {
return multifileFacadeId_.get(index);
}
private int multifileFacadeIdMemoizedSerializedSize = -1;
public static final int MULTIFILE_FACADE_NAME_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_;
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList() {
return multifileFacadeName_;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public int getMultifileFacadeNameCount() {
return multifileFacadeName_.size();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public java.lang.String getMultifileFacadeName(int index) {
return multifileFacadeName_.get(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index) {
return multifileFacadeName_.getByteString(index);
}
private void initFields() {
packageFqName_ = "";
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
multifileFacadeId_ = java.util.Collections.emptyList();
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -1569,6 +1767,16 @@ public final class DebugJvmPackageTable {
for (int i = 0; i < className_.size(); i++) {
output.writeBytes(2, className_.getByteString(i));
}
if (getMultifileFacadeIdList().size() > 0) {
output.writeRawVarint32(26);
output.writeRawVarint32(multifileFacadeIdMemoizedSerializedSize);
}
for (int i = 0; i < multifileFacadeId_.size(); i++) {
output.writeInt32NoTag(multifileFacadeId_.get(i));
}
for (int i = 0; i < multifileFacadeName_.size(); i++) {
output.writeBytes(4, multifileFacadeName_.getByteString(i));
}
getUnknownFields().writeTo(output);
}
@@ -1591,6 +1799,29 @@ public final class DebugJvmPackageTable {
size += dataSize;
size += 1 * getClassNameList().size();
}
{
int dataSize = 0;
for (int i = 0; i < multifileFacadeId_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(multifileFacadeId_.get(i));
}
size += dataSize;
if (!getMultifileFacadeIdList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
multifileFacadeIdMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < multifileFacadeName_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSizeNoTag(multifileFacadeName_.getByteString(i));
}
size += dataSize;
size += 1 * getMultifileFacadeNameList().size();
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -1712,6 +1943,10 @@ public final class DebugJvmPackageTable {
bitField0_ = (bitField0_ & ~0x00000001);
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
multifileFacadeId_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -1749,6 +1984,16 @@ public final class DebugJvmPackageTable {
bitField0_ = (bitField0_ & ~0x00000002);
}
result.className_ = className_;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.multifileFacadeId_ = multifileFacadeId_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000008);
}
result.multifileFacadeName_ = multifileFacadeName_;
result.bitField0_ = to_bitField0_;
onBuilt();
return result;
@@ -1780,6 +2025,26 @@ public final class DebugJvmPackageTable {
}
onChanged();
}
if (!other.multifileFacadeId_.isEmpty()) {
if (multifileFacadeId_.isEmpty()) {
multifileFacadeId_ = other.multifileFacadeId_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.addAll(other.multifileFacadeId_);
}
onChanged();
}
if (!other.multifileFacadeName_.isEmpty()) {
if (multifileFacadeName_.isEmpty()) {
multifileFacadeName_ = other.multifileFacadeName_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.addAll(other.multifileFacadeName_);
}
onChanged();
}
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -1898,7 +2163,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -1909,7 +2175,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public int getClassNameCount() {
@@ -1919,7 +2186,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public java.lang.String getClassName(int index) {
@@ -1929,7 +2197,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
@@ -1940,7 +2209,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder setClassName(
@@ -1957,7 +2227,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addClassName(
@@ -1974,7 +2245,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addAllClassName(
@@ -1989,7 +2261,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder clearClassName() {
@@ -2002,7 +2275,8 @@ public final class DebugJvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addClassNameBytes(
@@ -2016,6 +2290,243 @@ public final class DebugJvmPackageTable {
return this;
}
private java.util.List<java.lang.Integer> multifileFacadeId_ = java.util.Collections.emptyList();
private void ensureMultifileFacadeIdIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>(multifileFacadeId_);
bitField0_ |= 0x00000004;
}
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public java.util.List<java.lang.Integer>
getMultifileFacadeIdList() {
return java.util.Collections.unmodifiableList(multifileFacadeId_);
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeIdCount() {
return multifileFacadeId_.size();
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeId(int index) {
return multifileFacadeId_.get(index);
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder setMultifileFacadeId(
int index, int value) {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder addMultifileFacadeId(int value) {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.add(value);
onChanged();
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder addAllMultifileFacadeId(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureMultifileFacadeIdIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, multifileFacadeId_);
onChanged();
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder clearMultifileFacadeId() {
multifileFacadeId_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
private void ensureMultifileFacadeNameIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeName_);
bitField0_ |= 0x00000008;
}
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList() {
return multifileFacadeName_.getUnmodifiableView();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public int getMultifileFacadeNameCount() {
return multifileFacadeName_.size();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public java.lang.String getMultifileFacadeName(int index) {
return multifileFacadeName_.get(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index) {
return multifileFacadeName_.getByteString(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder setMultifileFacadeName(
int index, java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.set(index, value);
onChanged();
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addMultifileFacadeName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.add(value);
onChanged();
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addAllMultifileFacadeName(
java.lang.Iterable<java.lang.String> values) {
ensureMultifileFacadeNameIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, multifileFacadeName_);
onChanged();
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder clearMultifileFacadeName() {
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
onChanged();
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addMultifileFacadeNameBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.add(value);
onChanged();
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.PackageParts)
}
@@ -2052,9 +2563,11 @@ public final class DebugJvmPackageTable {
"\022K\n\rpackage_parts\030\001 \003(\01324.org.jetbrains." +
"kotlin.serialization.jvm.PackageParts\022L\n" +
"\016metadata_parts\030\002 \003(\01324.org.jetbrains.ko" +
"tlin.serialization.jvm.PackageParts\";\n\014P" +
"tlin.serialization.jvm.PackageParts\"{\n\014P" +
"ackageParts\022\027\n\017package_fq_name\030\001 \002(\t\022\022\n\n" +
"class_name\030\002 \003(\tB\026B\024DebugJvmPackageTable"
"class_name\030\002 \003(\t\022\037\n\023multifile_facade_id\030" +
"\003 \003(\005B\002\020\001\022\035\n\025multifile_facade_name\030\004 \003(\t",
"B\026B\024DebugJvmPackageTable"
};
org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
@@ -2079,7 +2592,7 @@ public final class DebugJvmPackageTable {
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable = new
org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor,
new java.lang.String[] { "PackageFqName", "ClassName", });
new java.lang.String[] { "PackageFqName", "ClassName", "MultifileFacadeId", "MultifileFacadeName", });
}
// @@protoc_insertion_point(outer_class_scope)
@@ -185,13 +185,13 @@ public class ClassFileFactory implements OutputFileCollection {
final String packageFqNameAsString = packageFqName.asString();
return new PackagePartRegistry() {
@Override
public void addPart(@NotNull String partShortName) {
public void addPart(@NotNull String partShortName, @Nullable String facadeShortName) {
PackageParts packageParts = partsGroupedByPackage.get(packageFqNameAsString);
if (packageParts == null) {
packageParts = new PackageParts(packageFqNameAsString);
partsGroupedByPackage.put(packageFqNameAsString, packageParts);
}
packageParts.addPart(partShortName);
packageParts.addPart(partShortName, facadeShortName);
}
};
}
@@ -215,14 +215,13 @@ class MultifileClassCodegenImpl(
if (!state.generateDeclaredClassFilter.shouldGeneratePackagePart(file) || !file.hasDeclarationsForPartClass()) return
val partInternalName = partType.internalName
packagePartRegistry.addPart(partInternalName.substring(partInternalName.lastIndexOf('/') + 1))
packagePartRegistry.addPart(partType.internalName.substringAfterLast('/'), facadeClassType.internalName.substringAfterLast('/'))
val builder = state.factory.newVisitor(MultifileClassPart(file, packageFragment), partType, file)
MultifileClassPartCodegen(
builder, file, packageFragment,
getSuperClassForPart(partInternalName),
getSuperClassForPart(partType.internalName),
shouldGeneratePartHierarchy,
partContext, state
).generate()
@@ -20,6 +20,7 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.SmartList;
import kotlin.text.StringsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.codegen.context.PackageContext;
@@ -125,7 +126,7 @@ public class PackageCodegenImpl implements PackageCodegen {
if (!generatePackagePart || !state.getGenerateDeclaredClassFilter().shouldGeneratePackagePart(file)) return;
String name = fileClassType.getInternalName();
packagePartRegistry.addPart(name.substring(name.lastIndexOf('/') + 1));
packagePartRegistry.addPart(StringsKt.substringAfterLast(name, '/', name), null);
ClassBuilder builder = state.getFactory().newVisitor(JvmDeclarationOriginKt.PackagePart(file, packageFragment), fileClassType, file);
@@ -17,5 +17,5 @@
package org.jetbrains.kotlin.codegen
interface PackagePartRegistry {
fun addPart(partShortName: String)
fun addPart(partShortName: String, facadeShortName: String?)
}
@@ -30,6 +30,15 @@ message PackageTable {
message PackageParts {
required string package_fq_name = 1;
// Short names of files, without extension, present in this package
// Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
// (multi-file facades are not present in this list, they are defined below)
repeated string class_name = 2;
// For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
// or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
// (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
repeated int32 multifile_facade_id = 3 [packed=true];
// Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
repeated string multifile_facade_name = 4;
}
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.load.kotlin
import org.jetbrains.kotlin.serialization.jvm.JvmPackageTable
import java.io.ByteArrayInputStream
import java.io.DataInputStream
import kotlin.comparisons.nullsLast
class ModuleMapping private constructor(val packageFqName2Parts: Map<String, PackageParts>, private val debugName: String) {
fun findPackageParts(packageFqName: String): PackageParts? {
@@ -43,14 +44,23 @@ class ModuleMapping private constructor(val packageFqName2Parts: Map<String, Pac
val version = JvmMetadataVersion(*IntArray(stream.readInt()) { stream.readInt() })
if (version.isCompatible()) {
val parseFrom = JvmPackageTable.PackageTable.parseFrom(stream)
if (parseFrom != null) {
val packageFqNameParts = hashMapOf<String, PackageParts>().apply {
addParts(this, parseFrom.packagePartsList, PackageParts::addPart)
addParts(this, parseFrom.metadataPartsList, PackageParts::addMetadataPart)
val table = JvmPackageTable.PackageTable.parseFrom(stream) ?: return EMPTY
val result = hashMapOf<String, PackageParts>()
for (proto in table.packagePartsList) {
val packageParts = result.getOrPut(proto.packageFqName) { PackageParts(proto.packageFqName) }
for ((index, partShortName) in proto.classNameList.withIndex()) {
val multifileFacadeId = proto.multifileFacadeIdList.getOrNull(index)?.minus(1)
packageParts.addPart(partShortName, multifileFacadeId?.let(proto.multifileFacadeNameList::getOrNull))
}
return ModuleMapping(packageFqNameParts, debugName ?: "<unknown>")
}
for (proto in table.metadataPartsList) {
val packageParts = result.getOrPut(proto.packageFqName) { PackageParts(proto.packageFqName) }
proto.classNameList.forEach(packageParts::addMetadataPart)
}
return ModuleMapping(result, debugName ?: "<unknown>")
}
else {
// TODO: consider reporting "incompatible ABI version" error for package parts
@@ -58,47 +68,52 @@ class ModuleMapping private constructor(val packageFqName2Parts: Map<String, Pac
return EMPTY
}
private inline fun addParts(
result: MutableMap<String, PackageParts>,
partsList: List<JvmPackageTable.PackageParts>,
addPartOrMetadataPart: (PackageParts, String) -> Unit
) {
for (proto in partsList) {
PackageParts(proto.packageFqName).apply {
result.put(proto.packageFqName, this)
proto.classNameList.forEach { addPartOrMetadataPart(this, it) }
}
}
}
}
}
class PackageParts(val packageFqName: String) {
// See JvmPackageTable.PackageTable.package_parts
val parts: Set<String> = linkedSetOf<String>()
// See JvmPackageTable.PackageTable.metadata_parts
val metadataParts: Set<String> = linkedSetOf<String>()
// Short name of package part -> short name of the corresponding multifile facade (or null, if it's not a multifile part)
private val packageParts = linkedMapOf<String, String?>()
fun addPart(shortName: String) {
(parts as MutableSet /* see KT-14663 */).add(shortName)
// See JvmPackageTable.PackageTable.package_parts
val parts: Set<String> get() = packageParts.keys
// See JvmPackageTable.PackageTable.metadata_parts
val metadataParts: Set<String> = linkedSetOf()
fun addPart(partShortName: String, facadeShortName: String?) {
packageParts[partShortName] = facadeShortName
}
fun removePart(shortName: String) {
(parts as MutableSet).remove(shortName)
packageParts.remove(shortName)
}
fun addMetadataPart(shortName: String) {
(metadataParts as MutableSet).add(shortName)
(metadataParts as MutableSet /* see KT-14663 */).add(shortName)
}
fun addTo(builder: JvmPackageTable.PackageTable.Builder) {
if (parts.isNotEmpty()) {
builder.addPackageParts(JvmPackageTable.PackageParts.newBuilder().apply {
packageFqName = this@PackageParts.packageFqName
addAllClassName(parts.sorted())
val facadeNameToId = mutableMapOf<String, Int>()
for ((facadeName, partNames) in parts.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) {
for (partName in partNames.sorted()) {
addClassName(partName)
if (facadeName != null) {
addMultifileFacadeId(1 + facadeNameToId.getOrPut(facadeName) { facadeNameToId.size })
}
}
}
for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair<Int, String>::first)) {
assert(facadeId == multifileFacadeNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" }
addMultifileFacadeName(facadeName)
}
})
}
if (metadataParts.isNotEmpty()) {
builder.addMetadataParts(JvmPackageTable.PackageParts.newBuilder().apply {
packageFqName = this@PackageParts.packageFqName
@@ -107,16 +122,21 @@ class PackageParts(val packageFqName: String) {
}
}
fun getMultifileFacadeName(partShortName: String): String? = packageParts[partShortName]
operator fun plusAssign(other: PackageParts) {
other.parts.forEach(this::addPart)
for ((partShortName, facadeShortName) in other.packageParts) {
addPart(partShortName, facadeShortName)
}
other.metadataParts.forEach(this::addMetadataPart)
}
override fun equals(other: Any?) =
other is PackageParts && other.packageFqName == packageFqName && other.parts == parts && other.metadataParts == metadataParts
other is PackageParts &&
other.packageFqName == packageFqName && other.packageParts == packageParts && other.metadataParts == metadataParts
override fun hashCode() =
(packageFqName.hashCode() * 31 + parts.hashCode()) * 31 + metadataParts.hashCode()
(packageFqName.hashCode() * 31 + packageParts.hashCode()) * 31 + metadataParts.hashCode()
override fun toString() =
(parts + metadataParts).toString()
@@ -905,7 +905,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -914,7 +915,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
int getClassNameCount();
@@ -922,7 +924,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
java.lang.String getClassName(int index);
@@ -930,11 +933,78 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
org.jetbrains.kotlin.protobuf.ByteString
getClassNameBytes(int index);
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
java.util.List<java.lang.Integer> getMultifileFacadeIdList();
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
int getMultifileFacadeIdCount();
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
int getMultifileFacadeId(int index);
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList();
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
int getMultifileFacadeNameCount();
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
java.lang.String getMultifileFacadeName(int index);
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index);
}
/**
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts}
@@ -1001,6 +1071,36 @@ public final class JvmPackageTable {
className_.add(bs);
break;
}
case 24: {
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000004;
}
multifileFacadeId_.add(input.readInt32());
break;
}
case 26: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>();
mutable_bitField0_ |= 0x00000004;
}
while (input.getBytesUntilLimit() > 0) {
multifileFacadeId_.add(input.readInt32());
}
input.popLimit(limit);
break;
}
case 34: {
org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes();
if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList();
mutable_bitField0_ |= 0x00000008;
}
multifileFacadeName_.add(bs);
break;
}
}
}
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
@@ -1012,6 +1112,12 @@ public final class JvmPackageTable {
if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) {
className_ = className_.getUnmodifiableView();
}
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_);
}
if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView();
}
try {
unknownFieldsCodedOutput.flush();
} catch (java.io.IOException e) {
@@ -1086,7 +1192,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -1097,7 +1204,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public int getClassNameCount() {
@@ -1107,7 +1215,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public java.lang.String getClassName(int index) {
@@ -1117,7 +1226,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
@@ -1125,9 +1235,97 @@ public final class JvmPackageTable {
return className_.getByteString(index);
}
public static final int MULTIFILE_FACADE_ID_FIELD_NUMBER = 3;
private java.util.List<java.lang.Integer> multifileFacadeId_;
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public java.util.List<java.lang.Integer>
getMultifileFacadeIdList() {
return multifileFacadeId_;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeIdCount() {
return multifileFacadeId_.size();
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeId(int index) {
return multifileFacadeId_.get(index);
}
private int multifileFacadeIdMemoizedSerializedSize = -1;
public static final int MULTIFILE_FACADE_NAME_FIELD_NUMBER = 4;
private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_;
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList() {
return multifileFacadeName_;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public int getMultifileFacadeNameCount() {
return multifileFacadeName_.size();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public java.lang.String getMultifileFacadeName(int index) {
return multifileFacadeName_.get(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index) {
return multifileFacadeName_.getByteString(index);
}
private void initFields() {
packageFqName_ = "";
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
multifileFacadeId_ = java.util.Collections.emptyList();
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
}
private byte memoizedIsInitialized = -1;
public final boolean isInitialized() {
@@ -1152,6 +1350,16 @@ public final class JvmPackageTable {
for (int i = 0; i < className_.size(); i++) {
output.writeBytes(2, className_.getByteString(i));
}
if (getMultifileFacadeIdList().size() > 0) {
output.writeRawVarint32(26);
output.writeRawVarint32(multifileFacadeIdMemoizedSerializedSize);
}
for (int i = 0; i < multifileFacadeId_.size(); i++) {
output.writeInt32NoTag(multifileFacadeId_.get(i));
}
for (int i = 0; i < multifileFacadeName_.size(); i++) {
output.writeBytes(4, multifileFacadeName_.getByteString(i));
}
output.writeRawBytes(unknownFields);
}
@@ -1174,6 +1382,29 @@ public final class JvmPackageTable {
size += dataSize;
size += 1 * getClassNameList().size();
}
{
int dataSize = 0;
for (int i = 0; i < multifileFacadeId_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(multifileFacadeId_.get(i));
}
size += dataSize;
if (!getMultifileFacadeIdList().isEmpty()) {
size += 1;
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
multifileFacadeIdMemoizedSerializedSize = dataSize;
}
{
int dataSize = 0;
for (int i = 0; i < multifileFacadeName_.size(); i++) {
dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream
.computeBytesSizeNoTag(multifileFacadeName_.getByteString(i));
}
size += dataSize;
size += 1 * getMultifileFacadeNameList().size();
}
size += unknownFields.size();
memoizedSerializedSize = size;
return size;
@@ -1272,6 +1503,10 @@ public final class JvmPackageTable {
bitField0_ = (bitField0_ & ~0x00000001);
className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000002);
multifileFacadeId_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
@@ -1304,6 +1539,16 @@ public final class JvmPackageTable {
bitField0_ = (bitField0_ & ~0x00000002);
}
result.className_ = className_;
if (((bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_);
bitField0_ = (bitField0_ & ~0x00000004);
}
result.multifileFacadeId_ = multifileFacadeId_;
if (((bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView();
bitField0_ = (bitField0_ & ~0x00000008);
}
result.multifileFacadeName_ = multifileFacadeName_;
result.bitField0_ = to_bitField0_;
return result;
}
@@ -1324,6 +1569,26 @@ public final class JvmPackageTable {
className_.addAll(other.className_);
}
}
if (!other.multifileFacadeId_.isEmpty()) {
if (multifileFacadeId_.isEmpty()) {
multifileFacadeId_ = other.multifileFacadeId_;
bitField0_ = (bitField0_ & ~0x00000004);
} else {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.addAll(other.multifileFacadeId_);
}
}
if (!other.multifileFacadeName_.isEmpty()) {
if (multifileFacadeName_.isEmpty()) {
multifileFacadeName_ = other.multifileFacadeName_;
bitField0_ = (bitField0_ & ~0x00000008);
} else {
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.addAll(other.multifileFacadeName_);
}
}
setUnknownFields(
getUnknownFields().concat(other.unknownFields));
@@ -1444,7 +1709,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
@@ -1455,7 +1721,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public int getClassNameCount() {
@@ -1465,7 +1732,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public java.lang.String getClassName(int index) {
@@ -1475,7 +1743,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
@@ -1486,7 +1755,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder setClassName(
@@ -1503,7 +1773,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addClassName(
@@ -1520,7 +1791,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addAllClassName(
@@ -1535,7 +1807,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder clearClassName() {
@@ -1548,7 +1821,8 @@ public final class JvmPackageTable {
* <code>repeated string class_name = 2;</code>
*
* <pre>
* Short names of files, without extension, present in this package
* Short names of files, without extension, present in this package. Only single file facades and multi-file _parts_ are listed here
* (multi-file facades are not present in this list, they are defined below)
* </pre>
*/
public Builder addClassNameBytes(
@@ -1562,6 +1836,243 @@ public final class JvmPackageTable {
return this;
}
private java.util.List<java.lang.Integer> multifileFacadeId_ = java.util.Collections.emptyList();
private void ensureMultifileFacadeIdIsMutable() {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
multifileFacadeId_ = new java.util.ArrayList<java.lang.Integer>(multifileFacadeId_);
bitField0_ |= 0x00000004;
}
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public java.util.List<java.lang.Integer>
getMultifileFacadeIdList() {
return java.util.Collections.unmodifiableList(multifileFacadeId_);
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeIdCount() {
return multifileFacadeId_.size();
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public int getMultifileFacadeId(int index) {
return multifileFacadeId_.get(index);
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder setMultifileFacadeId(
int index, int value) {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.set(index, value);
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder addMultifileFacadeId(int value) {
ensureMultifileFacadeIdIsMutable();
multifileFacadeId_.add(value);
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder addAllMultifileFacadeId(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureMultifileFacadeIdIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, multifileFacadeId_);
return this;
}
/**
* <code>repeated int32 multifile_facade_id = 3 [packed = true];</code>
*
* <pre>
* For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
* or 0 if the class is not a multi-file part. If there's no value in this list at some index, the value is assumed to be 0.
* (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
* </pre>
*/
public Builder clearMultifileFacadeId() {
multifileFacadeId_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000004);
return this;
}
private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
private void ensureMultifileFacadeNameIsMutable() {
if (!((bitField0_ & 0x00000008) == 0x00000008)) {
multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeName_);
bitField0_ |= 0x00000008;
}
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ProtocolStringList
getMultifileFacadeNameList() {
return multifileFacadeName_.getUnmodifiableView();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public int getMultifileFacadeNameCount() {
return multifileFacadeName_.size();
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public java.lang.String getMultifileFacadeName(int index) {
return multifileFacadeName_.get(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public org.jetbrains.kotlin.protobuf.ByteString
getMultifileFacadeNameBytes(int index) {
return multifileFacadeName_.getByteString(index);
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder setMultifileFacadeName(
int index, java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.set(index, value);
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addMultifileFacadeName(
java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.add(value);
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addAllMultifileFacadeName(
java.lang.Iterable<java.lang.String> values) {
ensureMultifileFacadeNameIsMutable();
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
values, multifileFacadeName_);
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder clearMultifileFacadeName() {
multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
bitField0_ = (bitField0_ & ~0x00000008);
return this;
}
/**
* <code>repeated string multifile_facade_name = 4;</code>
*
* <pre>
* Short names of multi-file facades, used in multifile_facade_id to store the part -&gt; facade mapping.
* </pre>
*/
public Builder addMultifileFacadeNameBytes(
org.jetbrains.kotlin.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
ensureMultifileFacadeNameIsMutable();
multifileFacadeName_.add(value);
return this;
}
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.PackageParts)
}
@@ -42,13 +42,18 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>(
private val VALUE_EXTERNALIZER = object : DataExternalizer<PackageParts> {
override fun read(input: DataInput): PackageParts? =
PackageParts(IOUtil.readUTF(input)).apply {
IOUtil.readStringList(input).forEach(this::addPart)
val shortPartNames = IOUtil.readStringList(input)
val shortFacadeNames = IOUtil.readStringList(input)
for ((partName, facadeName) in shortPartNames zip shortFacadeNames) {
addPart(partName, if (facadeName.isNotEmpty()) facadeName else null)
}
IOUtil.readStringList(input).forEach(this::addMetadataPart)
}
override fun save(out: DataOutput, value: PackageParts?) {
IOUtil.writeUTF(out, value!!.packageFqName)
override fun save(out: DataOutput, value: PackageParts) {
IOUtil.writeUTF(out, value.packageFqName)
IOUtil.writeStringList(out, value.parts)
IOUtil.writeStringList(out, value.parts.map { value.getMultifileFacadeName(it).orEmpty() })
IOUtil.writeStringList(out, value.metadataParts)
}
}
@@ -65,7 +70,7 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension<String, PackageParts>(
return FileBasedIndex.InputFilter { file -> file.extension == ModuleMapping.MAPPING_FILE_EXT }
}
override fun getVersion(): Int = 3
override fun getVersion(): Int = 4
override fun getIndexer(): DataIndexer<String, PackageParts, FileContent> {
return DataIndexer<String, PackageParts, FileContent> { inputData ->