diff --git a/build-common/test/org/jetbrains/kotlin/metadata/jvm/DebugJvmModuleProtoBuf.java b/build-common/test/org/jetbrains/kotlin/metadata/jvm/DebugJvmModuleProtoBuf.java index c0e8eb6b4b9..25f5cfc3965 100644 --- a/build-common/test/org/jetbrains/kotlin/metadata/jvm/DebugJvmModuleProtoBuf.java +++ b/build-common/test/org/jetbrains/kotlin/metadata/jvm/DebugJvmModuleProtoBuf.java @@ -2443,14 +2443,26 @@ public final class DebugJvmModuleProtoBuf { /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ boolean hasPackageFqName(); /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ java.lang.String getPackageFqName(); /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes(); @@ -2461,7 +2473,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2472,7 +2485,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ int getShortClassNameCount(); @@ -2482,7 +2496,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ java.lang.String getShortClassName(int index); @@ -2492,7 +2507,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString @@ -2534,6 +2550,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2543,6 +2562,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ int getMultifileFacadeShortNameCount(); @@ -2551,6 +2573,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ java.lang.String getMultifileFacadeShortName(int index); @@ -2559,6 +2584,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString @@ -2568,8 +2596,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2578,8 +2606,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ int getClassWithJvmPackageNameShortNameCount(); @@ -2587,8 +2615,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ java.lang.String getClassWithJvmPackageNameShortName(int index); @@ -2596,13 +2624,50 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString getClassWithJvmPackageNameShortNameBytes(int index); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + java.util.List getClassWithJvmPackageNameMultifileFacadeShortNameIdList(); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount(); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index); + /** * repeated int32 class_with_jvm_package_name_package_id = 6 [packed = true]; * @@ -2747,9 +2812,9 @@ public final class DebugJvmModuleProtoBuf { break; } case 48: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } classWithJvmPackageNamePackageId_.add(input.readInt32()); break; @@ -2757,9 +2822,9 @@ public final class DebugJvmModuleProtoBuf { case 50: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } while (input.getBytesUntilLimit() > 0) { classWithJvmPackageNamePackageId_.add(input.readInt32()); @@ -2767,6 +2832,27 @@ public final class DebugJvmModuleProtoBuf { input.popLimit(limit); break; } + case 56: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32()); + break; + } + case 58: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + while (input.getBytesUntilLimit() > 0) { + classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32()); + } + input.popLimit(limit); + break; + } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -2787,9 +2873,12 @@ public final class DebugJvmModuleProtoBuf { if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -2826,12 +2915,20 @@ public final class DebugJvmModuleProtoBuf { private java.lang.Object packageFqName_; /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public boolean hasPackageFqName() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public java.lang.String getPackageFqName() { java.lang.Object ref = packageFqName_; @@ -2849,6 +2946,10 @@ public final class DebugJvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes() { @@ -2872,7 +2973,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2885,7 +2987,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public int getShortClassNameCount() { @@ -2897,7 +3000,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public java.lang.String getShortClassName(int index) { @@ -2909,7 +3013,8 @@ public final class DebugJvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -2965,6 +3070,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2976,6 +3084,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public int getMultifileFacadeShortNameCount() { @@ -2986,6 +3097,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public java.lang.String getMultifileFacadeShortName(int index) { @@ -2996,6 +3110,9 @@ public final class DebugJvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3009,8 +3126,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3021,8 +3138,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public int getClassWithJvmPackageNameShortNameCount() { @@ -3032,8 +3149,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public java.lang.String getClassWithJvmPackageNameShortName(int index) { @@ -3043,8 +3160,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3052,6 +3169,53 @@ public final class DebugJvmModuleProtoBuf { return classWithJvmPackageNameShortName_.getByteString(index); } + public static final int CLASS_WITH_JVM_PACKAGE_NAME_MULTIFILE_FACADE_SHORT_NAME_ID_FIELD_NUMBER = 7; + private java.util.List classWithJvmPackageNameMultifileFacadeShortNameId_; + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public java.util.List + getClassWithJvmPackageNameMultifileFacadeShortNameIdList() { + return classWithJvmPackageNameMultifileFacadeShortNameId_; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() { + return classWithJvmPackageNameMultifileFacadeShortNameId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) { + return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index); + } + private int classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = -1; + public static final int CLASS_WITH_JVM_PACKAGE_NAME_PACKAGE_ID_FIELD_NUMBER = 6; private java.util.List classWithJvmPackageNamePackageId_; /** @@ -3105,6 +3269,7 @@ public final class DebugJvmModuleProtoBuf { multifileFacadeShortNameId_ = java.util.Collections.emptyList(); multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; @@ -3150,6 +3315,13 @@ public final class DebugJvmModuleProtoBuf { for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { output.writeInt32NoTag(classWithJvmPackageNamePackageId_.get(i)); } + if (getClassWithJvmPackageNameMultifileFacadeShortNameIdList().size() > 0) { + output.writeRawVarint32(58); + output.writeRawVarint32(classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize); + } + for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) { + output.writeInt32NoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i)); + } getUnknownFields().writeTo(output); } @@ -3218,6 +3390,20 @@ public final class DebugJvmModuleProtoBuf { } classWithJvmPackageNamePackageIdMemoizedSerializedSize = dataSize; } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i)); + } + size += dataSize; + if (!getClassWithJvmPackageNameMultifileFacadeShortNameIdList().isEmpty()) { + size += 1; + size += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = dataSize; + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -3345,8 +3531,10 @@ public final class DebugJvmModuleProtoBuf { bitField0_ = (bitField0_ & ~0x00000008); classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); - classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000020); + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -3400,9 +3588,14 @@ public final class DebugJvmModuleProtoBuf { } result.classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_; if (((bitField0_ & 0x00000020) == 0x00000020)) { - classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); bitField0_ = (bitField0_ & ~0x00000020); } + result.classWithJvmPackageNameMultifileFacadeShortNameId_ = classWithJvmPackageNameMultifileFacadeShortNameId_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + bitField0_ = (bitField0_ & ~0x00000040); + } result.classWithJvmPackageNamePackageId_ = classWithJvmPackageNamePackageId_; result.bitField0_ = to_bitField0_; onBuilt(); @@ -3465,10 +3658,20 @@ public final class DebugJvmModuleProtoBuf { } onChanged(); } + if (!other.classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) { + if (classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = other.classWithJvmPackageNameMultifileFacadeShortNameId_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.addAll(other.classWithJvmPackageNameMultifileFacadeShortNameId_); + } + onChanged(); + } if (!other.classWithJvmPackageNamePackageId_.isEmpty()) { if (classWithJvmPackageNamePackageId_.isEmpty()) { classWithJvmPackageNamePackageId_ = other.classWithJvmPackageNamePackageId_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); } else { ensureClassWithJvmPackageNamePackageIdIsMutable(); classWithJvmPackageNamePackageId_.addAll(other.classWithJvmPackageNamePackageId_); @@ -3509,12 +3712,20 @@ public final class DebugJvmModuleProtoBuf { private java.lang.Object packageFqName_ = ""; /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public boolean hasPackageFqName() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public java.lang.String getPackageFqName() { java.lang.Object ref = packageFqName_; @@ -3532,6 +3743,10 @@ public final class DebugJvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes() { @@ -3548,6 +3763,10 @@ public final class DebugJvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder setPackageFqName( java.lang.String value) { @@ -3561,6 +3780,10 @@ public final class DebugJvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder clearPackageFqName() { bitField0_ = (bitField0_ & ~0x00000001); @@ -3570,6 +3793,10 @@ public final class DebugJvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder setPackageFqNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { @@ -3595,7 +3822,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3608,7 +3836,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public int getShortClassNameCount() { @@ -3620,7 +3849,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public java.lang.String getShortClassName(int index) { @@ -3632,7 +3862,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3645,7 +3876,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder setShortClassName( @@ -3664,7 +3896,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addShortClassName( @@ -3683,7 +3916,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addAllShortClassName( @@ -3700,7 +3934,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder clearShortClassName() { @@ -3715,7 +3950,8 @@ public final class DebugJvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addShortClassNameBytes( @@ -3849,6 +4085,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3860,6 +4099,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public int getMultifileFacadeShortNameCount() { @@ -3870,6 +4112,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public java.lang.String getMultifileFacadeShortName(int index) { @@ -3880,6 +4125,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3891,6 +4139,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder setMultifileFacadeShortName( @@ -3908,6 +4159,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addMultifileFacadeShortName( @@ -3925,6 +4179,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addAllMultifileFacadeShortName( @@ -3940,6 +4197,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder clearMultifileFacadeShortName() { @@ -3953,6 +4213,9 @@ public final class DebugJvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addMultifileFacadeShortNameBytes( @@ -3977,8 +4240,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3989,8 +4252,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public int getClassWithJvmPackageNameShortNameCount() { @@ -4000,8 +4263,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public java.lang.String getClassWithJvmPackageNameShortName(int index) { @@ -4011,8 +4274,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -4023,8 +4286,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder setClassWithJvmPackageNameShortName( @@ -4041,8 +4304,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addClassWithJvmPackageNameShortName( @@ -4059,8 +4322,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addAllClassWithJvmPackageNameShortName( @@ -4075,8 +4338,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder clearClassWithJvmPackageNameShortName() { @@ -4089,8 +4352,8 @@ public final class DebugJvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addClassWithJvmPackageNameShortNameBytes( @@ -4104,11 +4367,133 @@ public final class DebugJvmModuleProtoBuf { return this; } + private java.util.List classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); + private void ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(classWithJvmPackageNameMultifileFacadeShortNameId_); + bitField0_ |= 0x00000020; + } + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public java.util.List + getClassWithJvmPackageNameMultifileFacadeShortNameIdList() { + return java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() { + return classWithJvmPackageNameMultifileFacadeShortNameId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) { + return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder setClassWithJvmPackageNameMultifileFacadeShortNameId( + int index, int value) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.set(index, value); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder addClassWithJvmPackageNameMultifileFacadeShortNameId(int value) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.add(value); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNameMultifileFacadeShortNameId( + java.lang.Iterable values) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNameMultifileFacadeShortNameId_); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder clearClassWithJvmPackageNameMultifileFacadeShortNameId() { + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + return this; + } + private java.util.List classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); private void ensureClassWithJvmPackageNamePackageIdIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(classWithJvmPackageNamePackageId_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; } } /** @@ -4221,7 +4606,7 @@ public final class DebugJvmModuleProtoBuf { */ public Builder clearClassWithJvmPackageNamePackageId() { classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); onChanged(); return this; } @@ -4268,14 +4653,16 @@ public final class DebugJvmModuleProtoBuf { "ringTable\022O\n\024qualified_name_table\030\005 \001(\0132", "1.org.jetbrains.kotlin.metadata.Qualifie" + "dNameTable\022=\n\nannotation\030\006 \003(\0132).org.jet" + - "brains.kotlin.metadata.Annotation\"\366\001\n\014Pa" + + "brains.kotlin.metadata.Annotation\"\276\002\n\014Pa" + "ckageParts\022\027\n\017package_fq_name\030\001 \002(\t\022\030\n\020s" + "hort_class_name\030\002 \003(\t\022*\n\036multifile_facad" + "e_short_name_id\030\003 \003(\005B\002\020\001\022#\n\033multifile_f" + "acade_short_name\030\004 \003(\t\022.\n&class_with_jvm" + - "_package_name_short_name\030\005 \003(\t\0222\n&class_" + - "with_jvm_package_name_package_id\030\006 \003(\005B\002" + - "\020\001B\030B\026DebugJvmModuleProtoBuf" + "_package_name_short_name\030\005 \003(\t\022F\n:class_" + + "with_jvm_package_name_multifile_facade_s" + + "hort_name_id\030\007 \003(\005B\002\020\001\0222\n&class_with_jvm", + "_package_name_package_id\030\006 \003(\005B\002\020\001B\030B\026De" + + "bugJvmModuleProtoBuf" }; org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -4301,7 +4688,7 @@ public final class DebugJvmModuleProtoBuf { internal_static_org_jetbrains_kotlin_metadata_jvm_PackageParts_fieldAccessorTable = new org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_kotlin_metadata_jvm_PackageParts_descriptor, - new java.lang.String[] { "PackageFqName", "ShortClassName", "MultifileFacadeShortNameId", "MultifileFacadeShortName", "ClassWithJvmPackageNameShortName", "ClassWithJvmPackageNamePackageId", }); + new java.lang.String[] { "PackageFqName", "ShortClassName", "MultifileFacadeShortNameId", "MultifileFacadeShortName", "ClassWithJvmPackageNameShortName", "ClassWithJvmPackageNameMultifileFacadeShortNameId", "ClassWithJvmPackageNamePackageId", }); org.jetbrains.kotlin.metadata.DebugProtoBuf.getDescriptor(); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt index 3ede01d0a04..1cc91a73237 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt @@ -39,6 +39,7 @@ import org.jetbrains.kotlin.psi.KtTypeAlias import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.MemberComparator import org.jetbrains.kotlin.resolve.jvm.AsmTypes +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClass import org.jetbrains.kotlin.resolve.jvm.diagnostics.MultifileClassPart import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin @@ -49,7 +50,6 @@ import org.jetbrains.kotlin.resolve.scopes.MemberScope import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedPropertyDescriptor import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedSimpleFunctionDescriptor -import org.jetbrains.kotlin.utils.SmartList import org.jetbrains.org.objectweb.asm.MethodVisitor import org.jetbrains.org.objectweb.asm.Opcodes import org.jetbrains.org.objectweb.asm.Type @@ -66,7 +66,7 @@ class MultifileClassCodegenImpl( ) : MultifileClassCodegen { private val facadeClassType = AsmUtil.asmTypeByFqNameWithoutInnerClasses(facadeFqName) - private val packageFragment = getOnlyPackageFragment(facadeFqName.parent(), files, state.module) + private val packageFragment = getOnlyPackageFragment(files, state.module) private val compiledPackageFragment = getCompiledPackageFragment(facadeFqName, state) @@ -329,6 +329,20 @@ class MultifileClassCodegenImpl( arv.visit(null, internalName) } arv.visitEnd() + + val kotlinPackageFqName = + packageFragment?.fqName ?: compiledPackageFragment?.fqName + ?: error("Either source package or compiled package should not be null: $facadeClassType ($files)") + + if (files.any { it.packageFqName != kotlinPackageFqName }) + throw UnsupportedOperationException( + "Multi-file parts of a facade with JvmPackageName should all lie in the same Kotlin package:\n " + + files.joinToString("\n ") { file -> "$file: package ${file.packageFqName}" } + ) + + if (kotlinPackageFqName != JvmClassName.byInternalName(facadeClassType.internalName).packageFqName) { + av.visit(JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString()) + } } } @@ -350,21 +364,10 @@ class MultifileClassCodegenImpl( private val J_L_OBJECT = AsmTypes.OBJECT_TYPE.internalName private const val FACADE_CLASS_ATTRIBUTES = Opcodes.ACC_PUBLIC or Opcodes.ACC_FINAL or Opcodes.ACC_SUPER - private fun getOnlyPackageFragment( - packageFqName: FqName, - files: Collection, - moduleDescriptor: ModuleDescriptor - ): PackageFragmentDescriptor? { - val fragments = SmartList() - for (file in files) { - val fragment = moduleDescriptor.findPackageFragmentForFile(file) + private fun getOnlyPackageFragment(files: Collection, moduleDescriptor: ModuleDescriptor): PackageFragmentDescriptor? { + val fragments = files.mapTo(linkedSetOf()) { file -> + moduleDescriptor.findPackageFragmentForFile(file) ?: throw AssertionError("package fragment is null for " + file + "\n" + file.text) - - assert(packageFqName == fragment.fqName) { "expected package fq name: " + packageFqName + ", actual: " + fragment.fqName } - - if (!fragments.contains(fragment)) { - fragments.add(fragment) - } } if (fragments.size > 1) { throw IllegalStateException("More than one package fragment, files: $files | fragments: $fragments") diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassPartCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassPartCodegen.kt index 0cbb5695355..2435f6086a0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassPartCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassPartCodegen.kt @@ -22,9 +22,11 @@ import org.jetbrains.kotlin.codegen.context.MultifileClassPartContext import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.load.java.JvmAnnotationNames +import org.jetbrains.kotlin.load.java.JvmAnnotationNames.METADATA_PACKAGE_NAME_FIELD_NAME import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtProperty +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.resolve.jvm.diagnostics.OtherOrigin import org.jetbrains.org.objectweb.asm.Opcodes @@ -97,6 +99,11 @@ class MultifileClassPartCodegen( writeKotlinMetadata(v, state, KotlinClassHeader.Kind.MULTIFILE_CLASS_PART, extraFlags) { av -> AsmUtil.writeAnnotationData(av, serializer, packageProto) av.visit(JvmAnnotationNames.METADATA_MULTIFILE_CLASS_NAME_FIELD_NAME, facadeClassType.internalName) + + val kotlinPackageFqName = element.packageFqName + if (kotlinPackageFqName != JvmClassName.byInternalName(partType.internalName).packageFqName) { + av.visit(METADATA_PACKAGE_NAME_FIELD_NAME, kotlinPackageFqName.asString()) + } } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/annotationCheckers.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/annotationCheckers.kt index cb1007eff58..4537c7e393a 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/annotationCheckers.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/checkers/annotationCheckers.kt @@ -28,7 +28,10 @@ import org.jetbrains.kotlin.resolve.AdditionalAnnotationChecker import org.jetbrains.kotlin.resolve.AnnotationChecker import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingTrace -import org.jetbrains.kotlin.resolve.descriptorUtil.* +import org.jetbrains.kotlin.resolve.descriptorUtil.annotationClass +import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe +import org.jetbrains.kotlin.resolve.descriptorUtil.getAnnotationRetention +import org.jetbrains.kotlin.resolve.descriptorUtil.isRepeatableAnnotation import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm object RepeatableAnnotationChecker: AdditionalAnnotationChecker { @@ -81,12 +84,8 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker { if (classDescriptor.getAnnotationRetention() != KotlinRetention.SOURCE) { trace.report(ErrorsJvm.ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES.on(entry, classFqName)) } - if (classFqName == JvmFileClassUtil.JVM_PACKAGE_NAME) { - trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES.on(entry)) - } } - } - else { + } else { for ((entry, classDescriptor) in fileAnnotationsToCheck) { if (classDescriptor.fqNameSafe != JvmFileClassUtil.JVM_PACKAGE_NAME) continue @@ -97,13 +96,11 @@ object FileClassAnnotationsChecker: AdditionalAnnotationChecker { val value = (stringTemplateEntries.singleOrNull() as? KtLiteralStringTemplateEntry)?.text if (value == null) { trace.report(ErrorsJvm.JVM_PACKAGE_NAME_CANNOT_BE_EMPTY.on(entry)) - } - else if (!isValidJavaFqName(value)) { + } else if (!isValidJavaFqName(value)) { trace.report(ErrorsJvm.JVM_PACKAGE_NAME_MUST_BE_VALID_NAME.on(entry)) - } - else if (entry.containingKtFile.declarations.any { - it !is KtFunction && it !is KtProperty && it !is KtTypeAlias - }) { + } else if (entry.containingKtFile.declarations.any { + it !is KtFunction && it !is KtProperty && it !is KtTypeAlias + }) { trace.report(ErrorsJvm.JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES.on(entry)) } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java index a1a2a0612bf..2e697dde6cb 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/DefaultErrorMessagesJvm.java @@ -67,7 +67,6 @@ public class DefaultErrorMessagesJvm implements DefaultErrorMessages.Extension { MAP.put(NON_SOURCE_REPEATED_ANNOTATION, "Repeatable annotations with non-SOURCE retention are not yet supported"); MAP.put(ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES, "Annotation ''@{0}'' is not applicable to the multi-file classes", TO_STRING); - MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES, "''@JvmPackageName'' annotation is not supported in multi-file classes"); MAP.put(JVM_PACKAGE_NAME_CANNOT_BE_EMPTY, "''@JvmPackageName'' annotation value cannot be empty"); MAP.put(JVM_PACKAGE_NAME_MUST_BE_VALID_NAME, "''@JvmPackageName'' annotation value must be a valid dot-qualified name of a package"); MAP.put(JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES, "''@JvmPackageName'' annotation is not supported for files with class declarations"); diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java index 7e85338c78c..136fe8376c1 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/diagnostics/ErrorsJvm.java @@ -68,7 +68,6 @@ public interface ErrorsJvm { DiagnosticFactory0 NON_SOURCE_REPEATED_ANNOTATION = DiagnosticFactory0.create(ERROR); DiagnosticFactory1 ANNOTATION_IS_NOT_APPLICABLE_TO_MULTIFILE_CLASSES = DiagnosticFactory1.create(ERROR); - DiagnosticFactory0 JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_MULTIFILE_CLASSES = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_PACKAGE_NAME_CANNOT_BE_EMPTY = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_PACKAGE_NAME_MUST_BE_VALID_NAME = DiagnosticFactory0.create(ERROR); DiagnosticFactory0 JVM_PACKAGE_NAME_NOT_SUPPORTED_IN_FILES_WITH_CLASSES = DiagnosticFactory0.create(ERROR); diff --git a/compiler/testData/codegen/box/jvmPackageName/multifileClass.kt b/compiler/testData/codegen/box/jvmPackageName/multifileClass.kt new file mode 100644 index 00000000000..e4cfab4a5c7 --- /dev/null +++ b/compiler/testData/codegen/box/jvmPackageName/multifileClass.kt @@ -0,0 +1,41 @@ +// IGNORE_BACKEND: JVM_IR +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: A1.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("baz.foo.quux.bar") +@file:JvmName("Facade") +@file:JvmMultifileClass +package foo.bar + +val g: S? get() = f().substring(0, 0) + "K" + +// FILE: A2.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("baz.foo.quux.bar") +@file:JvmName("Facade") +@file:JvmMultifileClass +package foo.bar + +inline fun i(block: () -> T): T = block() + +// FILE: A3.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("baz.foo.quux.bar") +@file:JvmName("Facade") +@file:JvmMultifileClass +package foo.bar + +typealias S = String + +fun f(): String = "O" + +// FILE: B.kt + +import foo.bar.* + +fun box(): S = i { f() + g } diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt new file mode 100644 index 00000000000..ef4e1b36d98 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt @@ -0,0 +1,25 @@ +// IGNORE_BACKEND: JVM_IR +// TARGET_BACKEND: JVM +// WITH_RUNTIME + +// FILE: A.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("baz.foo.quux.bar") +@file:JvmName("Facade") +@file:JvmMultifileClass +package foo.bar + +typealias S = String + +fun f(): String = "O" + +val g: S? get() = f().substring(0, 0) + "K" + +inline fun i(block: () -> T): T = block() + +// FILE: B.kt + +import foo.bar.* + +fun box(): S = i { f() + g } diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.kt index 7baab2cc1b6..219d2f2eb6c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.kt @@ -1,11 +1,5 @@ // !DIAGNOSTICS: -INVISIBLE_MEMBER -INVISIBLE_REFERENCE -// FILE: a.kt -@file:JvmPackageName("a") -@file:JvmMultifileClass -package a -fun a() {} - // FILE: b.kt @file:JvmPackageName("") package b diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.txt b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.txt index 628e6376875..87bc64f0bc3 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/jvmPackageName/incorrectJvmPackageName.txt @@ -1,9 +1,5 @@ package -package a { - public fun a(): kotlin.Unit -} - package b { public fun b(): kotlin.Unit } diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_A.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_A.kt new file mode 100644 index 00000000000..66d09da6df8 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_A.kt @@ -0,0 +1,7 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j1") +@file:JvmName("K1") +@file:JvmMultifileClass +package k1 + +fun f1() {} diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_B.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_B.kt new file mode 100644 index 00000000000..9a8302131b1 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_B.kt @@ -0,0 +1,7 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j1") +@file:JvmName("K1") +@file:JvmMultifileClass +package k1 + +val v2 = Unit diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_C.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_C.kt new file mode 100644 index 00000000000..c3ba8a56c5c --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K1_C.kt @@ -0,0 +1,7 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j1") +@file:JvmName("K1") +@file:JvmMultifileClass +package k1 + +typealias T3 = List diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_A.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_A.kt new file mode 100644 index 00000000000..f4998083414 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_A.kt @@ -0,0 +1,7 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j2") +@file:JvmName("K2") +@file:JvmMultifileClass +package k2 + +fun f1() {} diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_B.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_B.kt new file mode 100644 index 00000000000..90f4e99ca23 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_B.kt @@ -0,0 +1,7 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j3") +@file:JvmName("K2") +@file:JvmMultifileClass +package k2 + +val v2 = Unit diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_C.kt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_C.kt new file mode 100644 index 00000000000..01e1d9233e8 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/K2_C.kt @@ -0,0 +1,5 @@ +@file:JvmName("K2") +@file:JvmMultifileClass +package k2 + +typealias T3 = List diff --git a/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/module-proto.txt b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/module-proto.txt new file mode 100644 index 00000000000..7eb0e181c53 --- /dev/null +++ b/compiler/testData/moduleProtoBuf/jvmPackageNameMultifileClass/module-proto.txt @@ -0,0 +1,8 @@ +k1 + j1/K1__K1_AKt (j1/K1) + j1/K1__K1_BKt (j1/K1) + j1/K1__K1_CKt (j1/K1) +k2 + k2/K2__K2_CKt (k2/K2) + j2/K2__K2_AKt (j2/K2) + j3/K2__K2_BKt (j3/K2) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index fa645a33d90..63e7346d7d8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -14655,6 +14655,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt"); + } + @TestMetadata("rootPackage.kt") public void testRootPackage() throws Exception { runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 683a2c03ddd..8c82c91bdbd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -188,6 +188,11 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt"); } + @TestMetadata("jvmPackageNameMultifileClass.kt") + public void testJvmPackageNameMultifileClass() throws Exception { + runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameMultifileClass.kt"); + } + @TestMetadata("jvmPackageNameWithJvmName.kt") public void testJvmPackageNameWithJvmName() throws Exception { runTest("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt index ae4d0b561ba..b7930431019 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/JvmModuleProtoBufTest.kt @@ -18,7 +18,6 @@ package org.jetbrains.kotlin.codegen import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler import org.jetbrains.kotlin.config.ApiVersion -import org.jetbrains.kotlin.config.KotlinCompilerVersion import org.jetbrains.kotlin.config.LanguageVersion import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.load.kotlin.loadModuleMapping @@ -31,28 +30,28 @@ import java.io.File class JvmModuleProtoBufTest : KtUsefulTestCase() { private fun doTest( - relativeDirectory: String, - compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE, - loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE, - extraOptions: List = emptyList() + relativeDirectory: String, + compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE, + loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE, + extraOptions: List = emptyList() ) { val directory = KotlinTestUtils.getTestDataPathBase() + relativeDirectory val tmpdir = KotlinTestUtils.tmpDir(this::class.simpleName) val moduleName = "main" - CompilerTestUtil.executeCompilerAssertSuccessful(K2JVMCompiler(), listOf( + CompilerTestUtil.executeCompilerAssertSuccessful( + K2JVMCompiler(), listOf( directory, "-d", tmpdir.path, "-module-name", moduleName, "-language-version", compileWith.versionString - ) + extraOptions) + ) + extraOptions + ) val mapping = ModuleMapping.loadModuleMapping( - File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test", - CompilerDeserializationConfiguration( - LanguageVersionSettingsImpl(loadWith, ApiVersion.createByLanguageVersion(loadWith)) - ), - ::error + File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test", + CompilerDeserializationConfiguration(LanguageVersionSettingsImpl(loadWith, ApiVersion.createByLanguageVersion(loadWith))), + ::error ) val result = buildString { for (annotationClassId in mapping.moduleData.annotations) { @@ -82,18 +81,19 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() { } fun testJvmPackageName() { - doTest("/moduleProtoBuf/jvmPackageName", - compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2) + doTest("/moduleProtoBuf/jvmPackageName") } fun testJvmPackageNameManyParts() { - doTest("/moduleProtoBuf/jvmPackageNameManyParts", - compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2) + doTest("/moduleProtoBuf/jvmPackageNameManyParts") } fun testJvmPackageNameLanguageVersion11() { - doTest("/moduleProtoBuf/jvmPackageNameLanguageVersion11", - compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_1) + doTest("/moduleProtoBuf/jvmPackageNameLanguageVersion11", loadWith = LanguageVersion.KOTLIN_1_1) + } + + fun testJvmPackageNameMultifileClass() { + doTest("/moduleProtoBuf/jvmPackageNameMultifileClass") } fun testExperimental() { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 0f76d16ba53..da212f0c48d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -14655,6 +14655,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt"); + } + @TestMetadata("rootPackage.kt") public void testRootPackage() throws Exception { runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 8fffcfb1e1a..44d76521bb1 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -14660,6 +14660,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/jvmPackageName/metadataField.kt"); } + @TestMetadata("multifileClass.kt") + public void testMultifileClass() throws Exception { + runTest("compiler/testData/codegen/box/jvmPackageName/multifileClass.kt"); + } + @TestMetadata("rootPackage.kt") public void testRootPackage() throws Exception { runTest("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); diff --git a/core/metadata.jvm/src/jvm_module.proto b/core/metadata.jvm/src/jvm_module.proto index 0ebabc7ff87..aae14760aa1 100644 --- a/core/metadata.jvm/src/jvm_module.proto +++ b/core/metadata.jvm/src/jvm_module.proto @@ -41,11 +41,13 @@ message Module { } message PackageParts { + // Dot-separated Kotlin FQ name of the package. required string package_fq_name = 1; // 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). Only files whose JVM package name is equal to the - // Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here. + // Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in + // class_with_jvm_package_name_short_name. repeated string short_class_name = 2; // For each name in short_class_name, index of the name of the corresponding multi-file facade class in multifile_facade_short_name + 1, @@ -54,12 +56,24 @@ message PackageParts { repeated int32 multifile_facade_short_name_id = 3 [packed = true]; // Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping. + // + // The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName, + // and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name, + // otherwise behavior is unspecified. repeated string multifile_facade_short_name = 4; - // Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName. - // The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id. + // Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of + // @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id. repeated string class_with_jvm_package_name_short_name = 5; + // This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as + // multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal + // names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName. + // + // For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in + // multifile_facade_short_name + 1, or 0 if the class is not a multi-file part. + repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + // For each name in class_with_jvm_package_name_short_name, the index (into PackageTable#jvm_package_name) of the JVM package name. // This list should have at least one element, otherwise classes with JVM package names are going to be ignored completely. // diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/JvmModuleProtoBuf.java b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/JvmModuleProtoBuf.java index 0c616242fa7..29ac15f44d4 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/JvmModuleProtoBuf.java +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/JvmModuleProtoBuf.java @@ -1702,14 +1702,26 @@ public final class JvmModuleProtoBuf { /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ boolean hasPackageFqName(); /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ java.lang.String getPackageFqName(); /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes(); @@ -1720,7 +1732,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -1731,7 +1744,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ int getShortClassNameCount(); @@ -1741,7 +1755,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ java.lang.String getShortClassName(int index); @@ -1751,7 +1766,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString @@ -1793,6 +1809,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -1802,6 +1821,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ int getMultifileFacadeShortNameCount(); @@ -1810,6 +1832,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ java.lang.String getMultifileFacadeShortName(int index); @@ -1818,6 +1843,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString @@ -1827,8 +1855,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -1837,8 +1865,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ int getClassWithJvmPackageNameShortNameCount(); @@ -1846,8 +1874,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ java.lang.String getClassWithJvmPackageNameShortName(int index); @@ -1855,13 +1883,50 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString getClassWithJvmPackageNameShortNameBytes(int index); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + java.util.List getClassWithJvmPackageNameMultifileFacadeShortNameIdList(); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount(); + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index); + /** * repeated int32 class_with_jvm_package_name_package_id = 6 [packed = true]; * @@ -2004,9 +2069,9 @@ public final class JvmModuleProtoBuf { break; } case 48: { - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } classWithJvmPackageNamePackageId_.add(input.readInt32()); break; @@ -2014,9 +2079,9 @@ public final class JvmModuleProtoBuf { case 50: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); - if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + if (!((mutable_bitField0_ & 0x00000040) == 0x00000040) && input.getBytesUntilLimit() > 0) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); - mutable_bitField0_ |= 0x00000020; + mutable_bitField0_ |= 0x00000040; } while (input.getBytesUntilLimit() > 0) { classWithJvmPackageNamePackageId_.add(input.readInt32()); @@ -2024,6 +2089,27 @@ public final class JvmModuleProtoBuf { input.popLimit(limit); break; } + case 56: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32()); + break; + } + case 58: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + while (input.getBytesUntilLimit() > 0) { + classWithJvmPackageNameMultifileFacadeShortNameId_.add(input.readInt32()); + } + input.popLimit(limit); + break; + } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -2044,9 +2130,12 @@ public final class JvmModuleProtoBuf { if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); } - if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); + } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -2077,12 +2166,20 @@ public final class JvmModuleProtoBuf { private java.lang.Object packageFqName_; /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public boolean hasPackageFqName() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public java.lang.String getPackageFqName() { java.lang.Object ref = packageFqName_; @@ -2100,6 +2197,10 @@ public final class JvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+     * Dot-separated Kotlin FQ name of the package.
+     * 
*/ public org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes() { @@ -2123,7 +2224,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2136,7 +2238,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public int getShortClassNameCount() { @@ -2148,7 +2251,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public java.lang.String getShortClassName(int index) { @@ -2160,7 +2264,8 @@ public final class JvmModuleProtoBuf { *
      * 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). Only files whose JVM package name is equal to the
-     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+     * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+     * class_with_jvm_package_name_short_name.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -2216,6 +2321,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2227,6 +2335,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public int getMultifileFacadeShortNameCount() { @@ -2237,6 +2348,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public java.lang.String getMultifileFacadeShortName(int index) { @@ -2247,6 +2361,9 @@ public final class JvmModuleProtoBuf { * *
      * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+     * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+     * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+     * otherwise behavior is unspecified.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -2260,8 +2377,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2272,8 +2389,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public int getClassWithJvmPackageNameShortNameCount() { @@ -2283,8 +2400,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public java.lang.String getClassWithJvmPackageNameShortName(int index) { @@ -2294,8 +2411,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-     * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-     * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+     * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+     * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -2303,6 +2420,53 @@ public final class JvmModuleProtoBuf { return classWithJvmPackageNameShortName_.getByteString(index); } + public static final int CLASS_WITH_JVM_PACKAGE_NAME_MULTIFILE_FACADE_SHORT_NAME_ID_FIELD_NUMBER = 7; + private java.util.List classWithJvmPackageNameMultifileFacadeShortNameId_; + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public java.util.List + getClassWithJvmPackageNameMultifileFacadeShortNameIdList() { + return classWithJvmPackageNameMultifileFacadeShortNameId_; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() { + return classWithJvmPackageNameMultifileFacadeShortNameId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+     * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+     * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+     * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+     * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+     * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+     * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) { + return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index); + } + private int classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = -1; + public static final int CLASS_WITH_JVM_PACKAGE_NAME_PACKAGE_ID_FIELD_NUMBER = 6; private java.util.List classWithJvmPackageNamePackageId_; /** @@ -2356,6 +2520,7 @@ public final class JvmModuleProtoBuf { multifileFacadeShortNameId_ = java.util.Collections.emptyList(); multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; @@ -2401,6 +2566,13 @@ public final class JvmModuleProtoBuf { for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { output.writeInt32NoTag(classWithJvmPackageNamePackageId_.get(i)); } + if (getClassWithJvmPackageNameMultifileFacadeShortNameIdList().size() > 0) { + output.writeRawVarint32(58); + output.writeRawVarint32(classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize); + } + for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) { + output.writeInt32NoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i)); + } output.writeRawBytes(unknownFields); } @@ -2469,6 +2641,20 @@ public final class JvmModuleProtoBuf { } classWithJvmPackageNamePackageIdMemoizedSerializedSize = dataSize; } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNameMultifileFacadeShortNameId_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(classWithJvmPackageNameMultifileFacadeShortNameId_.get(i)); + } + size += dataSize; + if (!getClassWithJvmPackageNameMultifileFacadeShortNameIdList().isEmpty()) { + size += 1; + size += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + classWithJvmPackageNameMultifileFacadeShortNameIdMemoizedSerializedSize = dataSize; + } size += unknownFields.size(); memoizedSerializedSize = size; return size; @@ -2573,8 +2759,10 @@ public final class JvmModuleProtoBuf { bitField0_ = (bitField0_ & ~0x00000008); classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); - classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000020); + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000040); return this; } @@ -2623,9 +2811,14 @@ public final class JvmModuleProtoBuf { } result.classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_; if (((bitField0_ & 0x00000020) == 0x00000020)) { - classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); bitField0_ = (bitField0_ & ~0x00000020); } + result.classWithJvmPackageNameMultifileFacadeShortNameId_ = classWithJvmPackageNameMultifileFacadeShortNameId_; + if (((bitField0_ & 0x00000040) == 0x00000040)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + bitField0_ = (bitField0_ & ~0x00000040); + } result.classWithJvmPackageNamePackageId_ = classWithJvmPackageNamePackageId_; result.bitField0_ = to_bitField0_; return result; @@ -2677,11 +2870,21 @@ public final class JvmModuleProtoBuf { classWithJvmPackageNameShortName_.addAll(other.classWithJvmPackageNameShortName_); } + } + if (!other.classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) { + if (classWithJvmPackageNameMultifileFacadeShortNameId_.isEmpty()) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = other.classWithJvmPackageNameMultifileFacadeShortNameId_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.addAll(other.classWithJvmPackageNameMultifileFacadeShortNameId_); + } + } if (!other.classWithJvmPackageNamePackageId_.isEmpty()) { if (classWithJvmPackageNamePackageId_.isEmpty()) { classWithJvmPackageNamePackageId_ = other.classWithJvmPackageNamePackageId_; - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); } else { ensureClassWithJvmPackageNamePackageIdIsMutable(); classWithJvmPackageNamePackageId_.addAll(other.classWithJvmPackageNamePackageId_); @@ -2723,12 +2926,20 @@ public final class JvmModuleProtoBuf { private java.lang.Object packageFqName_ = ""; /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public boolean hasPackageFqName() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public java.lang.String getPackageFqName() { java.lang.Object ref = packageFqName_; @@ -2746,6 +2957,10 @@ public final class JvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public org.jetbrains.kotlin.protobuf.ByteString getPackageFqNameBytes() { @@ -2762,6 +2977,10 @@ public final class JvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder setPackageFqName( java.lang.String value) { @@ -2775,6 +2994,10 @@ public final class JvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder clearPackageFqName() { bitField0_ = (bitField0_ & ~0x00000001); @@ -2784,6 +3007,10 @@ public final class JvmModuleProtoBuf { } /** * required string package_fq_name = 1; + * + *
+       * Dot-separated Kotlin FQ name of the package.
+       * 
*/ public Builder setPackageFqNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { @@ -2809,7 +3036,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -2822,7 +3050,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public int getShortClassNameCount() { @@ -2834,7 +3063,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public java.lang.String getShortClassName(int index) { @@ -2846,7 +3076,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -2859,7 +3090,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder setShortClassName( @@ -2878,7 +3110,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addShortClassName( @@ -2897,7 +3130,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addAllShortClassName( @@ -2914,7 +3148,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder clearShortClassName() { @@ -2929,7 +3164,8 @@ public final class JvmModuleProtoBuf { *
        * 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). Only files whose JVM package name is equal to the
-       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here.
+       * Kotlin package name (i.e. it has not been changed with @JvmPackageName) are listed here, the rest are listed in
+       * class_with_jvm_package_name_short_name.
        * 
*/ public Builder addShortClassNameBytes( @@ -3063,6 +3299,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3074,6 +3313,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public int getMultifileFacadeShortNameCount() { @@ -3084,6 +3326,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public java.lang.String getMultifileFacadeShortName(int index) { @@ -3094,6 +3339,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3105,6 +3353,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder setMultifileFacadeShortName( @@ -3122,6 +3373,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addMultifileFacadeShortName( @@ -3139,6 +3393,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addAllMultifileFacadeShortName( @@ -3154,6 +3411,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder clearMultifileFacadeShortName() { @@ -3167,6 +3427,9 @@ public final class JvmModuleProtoBuf { * *
        * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
+       * The package name of the multi-file facade is package_fq_name if this multi-file facade is not affected by @JvmPackageName,
+       * and the JVM package name of any multi-file part otherwise. Note that in the latter case, all parts must have the same JVM package name,
+       * otherwise behavior is unspecified.
        * 
*/ public Builder addMultifileFacadeShortNameBytes( @@ -3191,8 +3454,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList @@ -3203,8 +3466,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public int getClassWithJvmPackageNameShortNameCount() { @@ -3214,8 +3477,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public java.lang.String getClassWithJvmPackageNameShortName(int index) { @@ -3225,8 +3488,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString @@ -3237,8 +3500,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder setClassWithJvmPackageNameShortName( @@ -3255,8 +3518,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addClassWithJvmPackageNameShortName( @@ -3273,8 +3536,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addAllClassWithJvmPackageNameShortName( @@ -3289,8 +3552,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder clearClassWithJvmPackageNameShortName() { @@ -3303,8 +3566,8 @@ public final class JvmModuleProtoBuf { * repeated string class_with_jvm_package_name_short_name = 5; * *
-       * Short names of files (single file facades), whose JVM package differs from the Kotlin package because of @JvmPackageName.
-       * The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
+       * Short names of files (single file facades and multi-file _parts_), whose JVM package differs from the Kotlin package because of
+       * @JvmPackageName. The JVM package name of each file is stored at the same index in class_with_jvm_package_name_package_id.
        * 
*/ public Builder addClassWithJvmPackageNameShortNameBytes( @@ -3318,11 +3581,133 @@ public final class JvmModuleProtoBuf { return this; } + private java.util.List classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); + private void ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNameMultifileFacadeShortNameId_ = new java.util.ArrayList(classWithJvmPackageNameMultifileFacadeShortNameId_); + bitField0_ |= 0x00000020; + } + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public java.util.List + getClassWithJvmPackageNameMultifileFacadeShortNameIdList() { + return java.util.Collections.unmodifiableList(classWithJvmPackageNameMultifileFacadeShortNameId_); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameIdCount() { + return classWithJvmPackageNameMultifileFacadeShortNameId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public int getClassWithJvmPackageNameMultifileFacadeShortNameId(int index) { + return classWithJvmPackageNameMultifileFacadeShortNameId_.get(index); + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder setClassWithJvmPackageNameMultifileFacadeShortNameId( + int index, int value) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.set(index, value); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder addClassWithJvmPackageNameMultifileFacadeShortNameId(int value) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + classWithJvmPackageNameMultifileFacadeShortNameId_.add(value); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNameMultifileFacadeShortNameId( + java.lang.Iterable values) { + ensureClassWithJvmPackageNameMultifileFacadeShortNameIdIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNameMultifileFacadeShortNameId_); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_multifile_facade_short_name_id = 7 [packed = true]; + * + *
+       * This list is an addition to class_with_jvm_package_name_short_name exactly almost in the same way as
+       * multifile_facade_short_name_id is an addition to short_class_name. The only difference is that this list contains _full_ internal
+       * names of multi-file facades whose JVM package differs from the Kotlin package because of @JvmPackageName.
+       * For each name in class_with_jvm_package_name_short_name, index of the name of the corresponding multi-file facade class in
+       * multifile_facade_short_name + 1, or 0 if the class is not a multi-file part.
+       * 
+ */ + public Builder clearClassWithJvmPackageNameMultifileFacadeShortNameId() { + classWithJvmPackageNameMultifileFacadeShortNameId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + + return this; + } + private java.util.List classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); private void ensureClassWithJvmPackageNamePackageIdIsMutable() { - if (!((bitField0_ & 0x00000020) == 0x00000020)) { + if (!((bitField0_ & 0x00000040) == 0x00000040)) { classWithJvmPackageNamePackageId_ = new java.util.ArrayList(classWithJvmPackageNamePackageId_); - bitField0_ |= 0x00000020; + bitField0_ |= 0x00000040; } } /** @@ -3435,7 +3820,7 @@ public final class JvmModuleProtoBuf { */ public Builder clearClassWithJvmPackageNamePackageId() { classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000020); + bitField0_ = (bitField0_ & ~0x00000040); return this; } diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt index a0b5eeac011..b1cefb1c4c8 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/JvmMetadataVersion.kt @@ -27,7 +27,7 @@ class JvmMetadataVersion(versionArray: IntArray, val isStrictSemantics: Boolean) companion object { @JvmField - val INSTANCE = JvmMetadataVersion(1, 1, 14) + val INSTANCE = JvmMetadataVersion(1, 1, 15) @JvmField val INVALID_VERSION = JvmMetadataVersion() diff --git a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/ModuleMapping.kt b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/ModuleMapping.kt index eacaa7b8222..d1964a9c26b 100644 --- a/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/ModuleMapping.kt +++ b/core/metadata.jvm/src/org/jetbrains/kotlin/metadata/jvm/deserialization/ModuleMapping.kt @@ -75,10 +75,12 @@ class ModuleMapping private constructor( val packageParts = result.getOrPut(packageFqName) { PackageParts(packageFqName) } for ((index, partShortName) in proto.shortClassNameList.withIndex()) { - val multifileFacadeId = proto.multifileFacadeShortNameIdList.getOrNull(index)?.minus(1) - val facadeShortName = multifileFacadeId?.let(proto.multifileFacadeShortNameList::getOrNull) - val facadeInternalName = facadeShortName?.let { internalNameOf(packageFqName, it) } - packageParts.addPart(internalNameOf(packageFqName, partShortName), facadeInternalName) + packageParts.addPart( + internalNameOf(packageFqName, partShortName), + loadMultiFileFacadeInternalName( + proto.multifileFacadeShortNameIdList, proto.multifileFacadeShortNameList, index, packageFqName + ) + ) } if (isJvmPackageNameSupported) { @@ -87,7 +89,16 @@ class ModuleMapping private constructor( ?: proto.classWithJvmPackageNamePackageIdList.lastOrNull() ?: continue val jvmPackageName = moduleProto.jvmPackageNameList.getOrNull(packageId) ?: continue - packageParts.addPart(internalNameOf(jvmPackageName, partShortName), null) + + packageParts.addPart( + internalNameOf(jvmPackageName, partShortName), + loadMultiFileFacadeInternalName( + proto.classWithJvmPackageNameMultifileFacadeShortNameIdList, + proto.multifileFacadeShortNameList, + index, + jvmPackageName + ) + ) } } } @@ -103,6 +114,17 @@ class ModuleMapping private constructor( return ModuleMapping(result, BinaryModuleData(annotations), debugName) } + + private fun loadMultiFileFacadeInternalName( + multifileFacadeIds: List, + multifileFacadeShortNames: List, + index: Int, + packageFqName: String + ): String? { + val multifileFacadeId = multifileFacadeIds.getOrNull(index)?.minus(1) + val facadeShortName = multifileFacadeId?.let(multifileFacadeShortNames::getOrNull) + return facadeShortName?.let { internalNameOf(packageFqName, it) } + } } } @@ -140,9 +162,10 @@ class PackageParts(val packageFqName: String) { partInternalName.packageName == packageInternalName } - writePartsWithinPackage(partsWithinPackage) - - writePartsOutsidePackage(partsOutsidePackage, builder) + val facadeNameToId = mutableMapOf() + writePartsWithinPackage(partsWithinPackage, facadeNameToId) + writePartsOutsidePackage(partsOutsidePackage, facadeNameToId, builder) + writeMultifileFacadeNames(facadeNameToId) }) } @@ -154,26 +177,24 @@ class PackageParts(val packageFqName: String) { } } - private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsWithinPackage(parts: List) { - val facadeNameToId = mutableMapOf() + private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsWithinPackage( + parts: List, + facadeNameToId: MutableMap + ) { for ((facadeInternalName, partInternalNames) in parts.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) { for (partInternalName in partInternalNames.sorted()) { addShortClassName(partInternalName.className) if (facadeInternalName != null) { - addMultifileFacadeShortNameId(1 + facadeNameToId.getOrPut(facadeInternalName.className) { facadeNameToId.size }) + addMultifileFacadeShortNameId(getMultifileFacadeShortNameId(facadeInternalName, facadeNameToId)) } } } - - for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair::first)) { - assert(facadeId == multifileFacadeShortNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" } - addMultifileFacadeShortName(facadeName) - } } // Writes information about package parts which have a different JVM package from the Kotlin package (with the help of @JvmPackageName) private fun JvmModuleProtoBuf.PackageParts.Builder.writePartsOutsidePackage( parts: List, + facadeNameToId: MutableMap, packageTableBuilder: JvmModuleProtoBuf.Module.Builder ) { val packageIds = mutableListOf() @@ -183,9 +204,16 @@ class PackageParts(val packageFqName: String) { packageTableBuilder.addJvmPackageName(packageFqName) } val packageId = packageTableBuilder.jvmPackageNameList.indexOf(packageFqName) - for (part in partsInPackage.map { it.className }.sorted()) { - addClassWithJvmPackageNameShortName(part) - packageIds.add(packageId) + for ((facadeInternalName, partInternalNames) in partsInPackage.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) { + for (partInternalName in partInternalNames.sorted()) { + addClassWithJvmPackageNameShortName(partInternalName.className) + if (facadeInternalName != null) { + addClassWithJvmPackageNameMultifileFacadeShortNameId( + getMultifileFacadeShortNameId(facadeInternalName, facadeNameToId) + ) + } + packageIds.add(packageId) + } } } @@ -197,6 +225,17 @@ class PackageParts(val packageFqName: String) { addAllClassWithJvmPackageNamePackageId(packageIds) } + private fun getMultifileFacadeShortNameId(facadeInternalName: String, facadeNameToId: MutableMap): Int { + return 1 + facadeNameToId.getOrPut(facadeInternalName.className) { facadeNameToId.size } + } + + private fun JvmModuleProtoBuf.PackageParts.Builder.writeMultifileFacadeNames(facadeNameToId: Map) { + for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair::first)) { + assert(facadeId == multifileFacadeShortNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" } + addMultifileFacadeShortName(facadeName) + } + } + private val String.packageName: String get() = substringBeforeLast('/', "") private val String.className: String get() = substringAfterLast('/')