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
@@ -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)
}