From 70ae1596fb67ec354fb37333f003373a6e500e01 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 6 Sep 2017 15:14:47 +0300 Subject: [PATCH] Support JvmPackageName annotation in binary format The main changes are in jvm_package_table.proto and ModuleMapping.kt. With JvmPackageName, package parts can now have a JVM package name that differs from their Kotlin name. So, in addition to the old package parts which were stored as short names + short name of multifile facade (we can't change this because of compatibility with old compilers), we now store separately those package parts, which have a different JVM package name. The format is optimized to avoid storing any package name more than once as a string. Another notable change is in KotlinCliJavaFileManagerImpl, where we now load .kotlin_module files when determining whether or not a package exists. Before this change, no PsiPackage (and thus, no JavaPackage and eventually, no LazyJavaPackageFragment) was created unless there was at least one file in the corresponding directory. Now we also create packages if they are "mapped" to other JVM packages, i.e. if all package parts in them have been annotated with JvmPackageName. Most of the other changes are refactorings to allow internal names of package parts/multifile classes where previously there were only short names. --- .../jvm/DebugJvmPackageTable.java | 1362 +++++++++++++---- .../kotlin/codegen/ClassFileFactory.java | 4 +- .../kotlin/codegen/MultifileClassCodegen.kt | 2 +- .../kotlin/codegen/PackageCodegenImpl.java | 4 +- .../kotlin/codegen/PackagePartRegistry.kt | 2 +- .../kotlin/codegen/classFileUtils.kt | 6 +- .../codegen/state/KotlinTypeMapper.java | 26 +- .../compiler/KotlinCliJavaFileManagerImpl.kt | 12 +- .../cli/jvm/compiler/KotlinCoreEnvironment.kt | 1 + .../kotlin/fileClasses/JvmFileClassUtil.kt | 8 +- .../IncrementalPackageFragmentProvider.kt | 30 +- .../kotlin/resolve/jvm/JvmOverloadFilter.kt | 12 +- .../codegen/box/jvmPackageName/rootPackage.kt | 18 + .../codegen/box/jvmPackageName/withJvmName.kt | 19 + .../jvmPackageName.kt | 25 + .../jvmPackageNameInRootPackage.kt | 18 + .../jvmPackageNameWithJvmName.kt | 22 + .../jvmPackageTable/jvmPackageName/BarAsJ.kt | 5 + .../jvmPackageTable/jvmPackageName/BarAsJJ.kt | 6 + .../jvmPackageTable/jvmPackageName/Foo.kt | 3 + .../jvmPackageName/FooAsJJJ.kt | 5 + .../jvmPackageName/FooMultiFile.kt | 5 + .../jvmPackageName/jvm-package-table.txt | 7 + .../jvmPackageNameManyParts/Foo1.kt | 5 + .../jvmPackageNameManyParts/Foo2.kt | 5 + .../jvmPackageNameManyParts/Foo3.kt | 5 + .../jvm-package-table.txt | 4 + .../simple/jvm-package-table.txt | 16 +- .../ir/IrBlackBoxCodegenTestGenerated.java | 12 + .../cli/jvm/KotlinCliJavaFileManagerTest.kt | 1 + .../codegen/BlackBoxCodegenTestGenerated.java | 12 + ...mpileKotlinAgainstKotlinTestGenerated.java | 18 + .../kotlin/codegen/JvmPackageTableTest.kt | 28 +- .../LightAnalysisModeTestGenerated.java | 12 + .../src/jvm_package_table.proto | 29 +- .../kotlin/load/java/descriptors/util.kt | 7 +- .../descriptors/LazyJavaPackageFragment.kt | 14 +- .../kotlin/load/kotlin/JvmMetadataVersion.kt | 2 +- .../KotlinJvmBinaryPackageSourceElement.kt | 2 +- .../kotlin/load/kotlin/ModuleMapping.kt | 117 +- .../kotlin/resolve/jvm/JvmClassName.java | 20 +- .../serialization/jvm/JvmPackageTable.java | 1342 ++++++++++++---- .../kotlin/descriptors/PackagePartProvider.kt | 5 +- .../vfilefinder/KotlinModuleMappingIndex.kt | 13 +- 44 files changed, 2614 insertions(+), 657 deletions(-) create mode 100644 compiler/testData/codegen/box/jvmPackageName/rootPackage.kt create mode 100644 compiler/testData/codegen/box/jvmPackageName/withJvmName.kt create mode 100644 compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt create mode 100644 compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt create mode 100644 compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/BarAsJ.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/BarAsJJ.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/Foo.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/FooAsJJJ.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/FooMultiFile.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageName/jvm-package-table.txt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo1.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo2.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo3.kt create mode 100644 compiler/testData/jvmPackageTable/jvmPackageNameManyParts/jvm-package-table.txt diff --git a/build-common/test/org/jetbrains/kotlin/serialization/jvm/DebugJvmPackageTable.java b/build-common/test/org/jetbrains/kotlin/serialization/jvm/DebugJvmPackageTable.java index 15992f048c0..27ca33c1153 100644 --- a/build-common/test/org/jetbrains/kotlin/serialization/jvm/DebugJvmPackageTable.java +++ b/build-common/test/org/jetbrains/kotlin/serialization/jvm/DebugJvmPackageTable.java @@ -99,6 +99,45 @@ public final class DebugJvmPackageTable { */ org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackagePartsOrBuilder getMetadataPartsOrBuilder( int index); + + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList(); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + int getJvmPackageNameCount(); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + java.lang.String getJvmPackageName(int index); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageTable} @@ -168,6 +207,15 @@ public final class DebugJvmPackageTable { metadataParts_.add(input.readMessage(org.jetbrains.kotlin.serialization.jvm.DebugJvmPackageTable.PackageParts.PARSER, extensionRegistry)); break; } + case 26: { + org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + jvmPackageName_.add(bs); + break; + } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -182,6 +230,9 @@ public final class DebugJvmPackageTable { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { metadataParts_ = java.util.Collections.unmodifiableList(metadataParts_); } + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = jvmPackageName_.getUnmodifiableView(); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -323,9 +374,59 @@ public final class DebugJvmPackageTable { return metadataParts_.get(index); } + public static final int JVM_PACKAGE_NAME_FIELD_NUMBER = 3; + private org.jetbrains.kotlin.protobuf.LazyStringList jvmPackageName_; + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList() { + return jvmPackageName_; + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public int getJvmPackageNameCount() { + return jvmPackageName_.size(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public java.lang.String getJvmPackageName(int index) { + return jvmPackageName_.get(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index) { + return jvmPackageName_.getByteString(index); + } + private void initFields() { packageParts_ = java.util.Collections.emptyList(); metadataParts_ = java.util.Collections.emptyList(); + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -358,6 +459,9 @@ public final class DebugJvmPackageTable { for (int i = 0; i < metadataParts_.size(); i++) { output.writeMessage(2, metadataParts_.get(i)); } + for (int i = 0; i < jvmPackageName_.size(); i++) { + output.writeBytes(3, jvmPackageName_.getByteString(i)); + } getUnknownFields().writeTo(output); } @@ -375,6 +479,15 @@ public final class DebugJvmPackageTable { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(2, metadataParts_.get(i)); } + { + int dataSize = 0; + for (int i = 0; i < jvmPackageName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeBytesSizeNoTag(jvmPackageName_.getByteString(i)); + } + size += dataSize; + size += 1 * getJvmPackageNameList().size(); + } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; @@ -506,6 +619,8 @@ public final class DebugJvmPackageTable { } else { metadataPartsBuilder_.clear(); } + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -551,6 +666,11 @@ public final class DebugJvmPackageTable { } else { result.metadataParts_ = metadataPartsBuilder_.build(); } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = jvmPackageName_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.jvmPackageName_ = jvmPackageName_; onBuilt(); return result; } @@ -618,6 +738,16 @@ public final class DebugJvmPackageTable { } } } + if (!other.jvmPackageName_.isEmpty()) { + if (jvmPackageName_.isEmpty()) { + jvmPackageName_ = other.jvmPackageName_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureJvmPackageNameIsMutable(); + jvmPackageName_.addAll(other.jvmPackageName_); + } + onChanged(); + } this.mergeUnknownFields(other.getUnknownFields()); return this; } @@ -1281,6 +1411,144 @@ public final class DebugJvmPackageTable { return metadataPartsBuilder_; } + private org.jetbrains.kotlin.protobuf.LazyStringList jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureJvmPackageNameIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(jvmPackageName_); + bitField0_ |= 0x00000004; + } + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList() { + return jvmPackageName_.getUnmodifiableView(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public int getJvmPackageNameCount() { + return jvmPackageName_.size(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public java.lang.String getJvmPackageName(int index) { + return jvmPackageName_.get(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index) { + return jvmPackageName_.getByteString(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder setJvmPackageName( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addJvmPackageName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.add(value); + onChanged(); + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addAllJvmPackageName( + java.lang.Iterable values) { + ensureJvmPackageNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, jvmPackageName_); + onChanged(); + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder clearJvmPackageName() { + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addJvmPackageNameBytes( + org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.add(value); + onChanged(); + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.PackageTable) } @@ -1311,109 +1579,189 @@ public final class DebugJvmPackageTable { getPackageFqNameBytes(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList(); + getShortClassNameList(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - int getClassNameCount(); + int getShortClassNameCount(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - java.lang.String getClassName(int index); + java.lang.String getShortClassName(int index); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index); + getShortClassNameBytes(int index); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - java.util.List getMultifileFacadeIdList(); + java.util.List getMultifileFacadeShortNameIdList(); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - int getMultifileFacadeIdCount(); + int getMultifileFacadeShortNameIdCount(); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - int getMultifileFacadeId(int index); + int getMultifileFacadeShortNameId(int index); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList(); + getMultifileFacadeShortNameList(); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - int getMultifileFacadeNameCount(); + int getMultifileFacadeShortNameCount(); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - java.lang.String getMultifileFacadeName(int index); + java.lang.String getMultifileFacadeShortName(int index); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index); + getMultifileFacadeShortNameBytes(int index); + + /** + * 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.
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList(); + /** + * 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.
+     * 
+ */ + int getClassWithJvmPackageNameShortNameCount(); + /** + * 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.
+     * 
+ */ + java.lang.String getClassWithJvmPackageNameShortName(int index); + /** + * 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.
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index); + + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + java.util.List getClassWithJvmPackageNamePackageIdList(); + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + int getClassWithJvmPackageNamePackageIdCount(); + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + int getClassWithJvmPackageNamePackageId(int index); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts} @@ -1476,29 +1824,29 @@ public final class DebugJvmPackageTable { case 18: { org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + shortClassName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000002; } - className_.add(bs); + shortClassName_.add(bs); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = new java.util.ArrayList(); + multifileFacadeShortNameId_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } - multifileFacadeId_.add(input.readInt32()); + multifileFacadeShortNameId_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { - multifileFacadeId_ = new java.util.ArrayList(); + multifileFacadeShortNameId_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { - multifileFacadeId_.add(input.readInt32()); + multifileFacadeShortNameId_.add(input.readInt32()); } input.popLimit(limit); break; @@ -1506,10 +1854,40 @@ public final class DebugJvmPackageTable { case 34: { org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + multifileFacadeShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000008; } - multifileFacadeName_.add(bs); + multifileFacadeShortName_.add(bs); + break; + } + case 42: { + org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000010; + } + classWithJvmPackageNameShortName_.add(bs); + break; + } + case 48: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + classWithJvmPackageNamePackageId_.add(input.readInt32()); + break; + } + case 50: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + while (input.getBytesUntilLimit() > 0) { + classWithJvmPackageNamePackageId_.add(input.readInt32()); + } + input.popLimit(limit); break; } } @@ -1521,13 +1899,19 @@ public final class DebugJvmPackageTable { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - className_ = className_.getUnmodifiableView(); + shortClassName_ = shortClassName_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_); + multifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); } if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView(); + multifileFacadeShortName_ = multifileFacadeShortName_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); @@ -1603,146 +1987,248 @@ public final class DebugJvmPackageTable { } } - public static final int CLASS_NAME_FIELD_NUMBER = 2; - private org.jetbrains.kotlin.protobuf.LazyStringList className_; + public static final int SHORT_CLASS_NAME_FIELD_NUMBER = 2; + private org.jetbrains.kotlin.protobuf.LazyStringList shortClassName_; /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList() { - return className_; + getShortClassNameList() { + return shortClassName_; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - public int getClassNameCount() { - return className_.size(); + public int getShortClassNameCount() { + return shortClassName_.size(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - public java.lang.String getClassName(int index) { - return className_.get(index); + public java.lang.String getShortClassName(int index) { + return shortClassName_.get(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index) { - return className_.getByteString(index); + getShortClassNameBytes(int index) { + return shortClassName_.getByteString(index); } - public static final int MULTIFILE_FACADE_ID_FIELD_NUMBER = 3; - private java.util.List multifileFacadeId_; + public static final int MULTIFILE_FACADE_SHORT_NAME_ID_FIELD_NUMBER = 3; + private java.util.List multifileFacadeShortNameId_; /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ public java.util.List - getMultifileFacadeIdList() { - return multifileFacadeId_; + getMultifileFacadeShortNameIdList() { + return multifileFacadeShortNameId_; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - public int getMultifileFacadeIdCount() { - return multifileFacadeId_.size(); + public int getMultifileFacadeShortNameIdCount() { + return multifileFacadeShortNameId_.size(); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - public int getMultifileFacadeId(int index) { - return multifileFacadeId_.get(index); + public int getMultifileFacadeShortNameId(int index) { + return multifileFacadeShortNameId_.get(index); } - private int multifileFacadeIdMemoizedSerializedSize = -1; + private int multifileFacadeShortNameIdMemoizedSerializedSize = -1; - public static final int MULTIFILE_FACADE_NAME_FIELD_NUMBER = 4; - private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_; + public static final int MULTIFILE_FACADE_SHORT_NAME_FIELD_NUMBER = 4; + private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeShortName_; /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList() { - return multifileFacadeName_; + getMultifileFacadeShortNameList() { + return multifileFacadeShortName_; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - public int getMultifileFacadeNameCount() { - return multifileFacadeName_.size(); + public int getMultifileFacadeShortNameCount() { + return multifileFacadeShortName_.size(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - public java.lang.String getMultifileFacadeName(int index) { - return multifileFacadeName_.get(index); + public java.lang.String getMultifileFacadeShortName(int index) { + return multifileFacadeShortName_.get(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index) { - return multifileFacadeName_.getByteString(index); + getMultifileFacadeShortNameBytes(int index) { + return multifileFacadeShortName_.getByteString(index); } + public static final int CLASS_WITH_JVM_PACKAGE_NAME_SHORT_NAME_FIELD_NUMBER = 5; + private org.jetbrains.kotlin.protobuf.LazyStringList classWithJvmPackageNameShortName_; + /** + * 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.
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList() { + return classWithJvmPackageNameShortName_; + } + /** + * 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.
+     * 
+ */ + public int getClassWithJvmPackageNameShortNameCount() { + return classWithJvmPackageNameShortName_.size(); + } + /** + * 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.
+     * 
+ */ + public java.lang.String getClassWithJvmPackageNameShortName(int index) { + return classWithJvmPackageNameShortName_.get(index); + } + /** + * 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.
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index) { + return classWithJvmPackageNameShortName_.getByteString(index); + } + + public static final int CLASS_WITH_JVM_PACKAGE_NAME_PACKAGE_ID_FIELD_NUMBER = 6; + private java.util.List classWithJvmPackageNamePackageId_; + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public java.util.List + getClassWithJvmPackageNamePackageIdList() { + return classWithJvmPackageNamePackageId_; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public int getClassWithJvmPackageNamePackageIdCount() { + return classWithJvmPackageNamePackageId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public int getClassWithJvmPackageNamePackageId(int index) { + return classWithJvmPackageNamePackageId_.get(index); + } + private int classWithJvmPackageNamePackageIdMemoizedSerializedSize = -1; + private void initFields() { packageFqName_ = ""; - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - multifileFacadeId_ = java.util.Collections.emptyList(); - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -1764,18 +2250,28 @@ public final class DebugJvmPackageTable { if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getPackageFqNameBytes()); } - for (int i = 0; i < className_.size(); i++) { - output.writeBytes(2, className_.getByteString(i)); + for (int i = 0; i < shortClassName_.size(); i++) { + output.writeBytes(2, shortClassName_.getByteString(i)); } - if (getMultifileFacadeIdList().size() > 0) { + if (getMultifileFacadeShortNameIdList().size() > 0) { output.writeRawVarint32(26); - output.writeRawVarint32(multifileFacadeIdMemoizedSerializedSize); + output.writeRawVarint32(multifileFacadeShortNameIdMemoizedSerializedSize); } - for (int i = 0; i < multifileFacadeId_.size(); i++) { - output.writeInt32NoTag(multifileFacadeId_.get(i)); + for (int i = 0; i < multifileFacadeShortNameId_.size(); i++) { + output.writeInt32NoTag(multifileFacadeShortNameId_.get(i)); } - for (int i = 0; i < multifileFacadeName_.size(); i++) { - output.writeBytes(4, multifileFacadeName_.getByteString(i)); + for (int i = 0; i < multifileFacadeShortName_.size(); i++) { + output.writeBytes(4, multifileFacadeShortName_.getByteString(i)); + } + for (int i = 0; i < classWithJvmPackageNameShortName_.size(); i++) { + output.writeBytes(5, classWithJvmPackageNameShortName_.getByteString(i)); + } + if (getClassWithJvmPackageNamePackageIdList().size() > 0) { + output.writeRawVarint32(50); + output.writeRawVarint32(classWithJvmPackageNamePackageIdMemoizedSerializedSize); + } + for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { + output.writeInt32NoTag(classWithJvmPackageNamePackageId_.get(i)); } getUnknownFields().writeTo(output); } @@ -1792,35 +2288,58 @@ public final class DebugJvmPackageTable { } { int dataSize = 0; - for (int i = 0; i < className_.size(); i++) { + for (int i = 0; i < shortClassName_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeBytesSizeNoTag(className_.getByteString(i)); + .computeBytesSizeNoTag(shortClassName_.getByteString(i)); } size += dataSize; - size += 1 * getClassNameList().size(); + size += 1 * getShortClassNameList().size(); } { int dataSize = 0; - for (int i = 0; i < multifileFacadeId_.size(); i++) { + for (int i = 0; i < multifileFacadeShortNameId_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeInt32SizeNoTag(multifileFacadeId_.get(i)); + .computeInt32SizeNoTag(multifileFacadeShortNameId_.get(i)); } size += dataSize; - if (!getMultifileFacadeIdList().isEmpty()) { + if (!getMultifileFacadeShortNameIdList().isEmpty()) { size += 1; size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeInt32SizeNoTag(dataSize); } - multifileFacadeIdMemoizedSerializedSize = dataSize; + multifileFacadeShortNameIdMemoizedSerializedSize = dataSize; } { int dataSize = 0; - for (int i = 0; i < multifileFacadeName_.size(); i++) { + for (int i = 0; i < multifileFacadeShortName_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeBytesSizeNoTag(multifileFacadeName_.getByteString(i)); + .computeBytesSizeNoTag(multifileFacadeShortName_.getByteString(i)); } size += dataSize; - size += 1 * getMultifileFacadeNameList().size(); + size += 1 * getMultifileFacadeShortNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNameShortName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeBytesSizeNoTag(classWithJvmPackageNameShortName_.getByteString(i)); + } + size += dataSize; + size += 1 * getClassWithJvmPackageNameShortNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(classWithJvmPackageNamePackageId_.get(i)); + } + size += dataSize; + if (!getClassWithJvmPackageNamePackageIdList().isEmpty()) { + size += 1; + size += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + classWithJvmPackageNamePackageIdMemoizedSerializedSize = dataSize; } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -1941,12 +2460,16 @@ public final class DebugJvmPackageTable { super.clear(); packageFqName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); - multifileFacadeId_ = java.util.Collections.emptyList(); + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -1980,20 +2503,30 @@ public final class DebugJvmPackageTable { } result.packageFqName_ = packageFqName_; if (((bitField0_ & 0x00000002) == 0x00000002)) { - className_ = className_.getUnmodifiableView(); + shortClassName_ = shortClassName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000002); } - result.className_ = className_; + result.shortClassName_ = shortClassName_; if (((bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_); + multifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); bitField0_ = (bitField0_ & ~0x00000004); } - result.multifileFacadeId_ = multifileFacadeId_; + result.multifileFacadeShortNameId_ = multifileFacadeShortNameId_; if (((bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView(); + multifileFacadeShortName_ = multifileFacadeShortName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000008); } - result.multifileFacadeName_ = multifileFacadeName_; + result.multifileFacadeShortName_ = multifileFacadeShortName_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.classWithJvmPackageNamePackageId_ = classWithJvmPackageNamePackageId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; @@ -2015,33 +2548,53 @@ public final class DebugJvmPackageTable { packageFqName_ = other.packageFqName_; onChanged(); } - if (!other.className_.isEmpty()) { - if (className_.isEmpty()) { - className_ = other.className_; + if (!other.shortClassName_.isEmpty()) { + if (shortClassName_.isEmpty()) { + shortClassName_ = other.shortClassName_; bitField0_ = (bitField0_ & ~0x00000002); } else { - ensureClassNameIsMutable(); - className_.addAll(other.className_); + ensureShortClassNameIsMutable(); + shortClassName_.addAll(other.shortClassName_); } onChanged(); } - if (!other.multifileFacadeId_.isEmpty()) { - if (multifileFacadeId_.isEmpty()) { - multifileFacadeId_ = other.multifileFacadeId_; + if (!other.multifileFacadeShortNameId_.isEmpty()) { + if (multifileFacadeShortNameId_.isEmpty()) { + multifileFacadeShortNameId_ = other.multifileFacadeShortNameId_; bitField0_ = (bitField0_ & ~0x00000004); } else { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.addAll(other.multifileFacadeId_); + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.addAll(other.multifileFacadeShortNameId_); } onChanged(); } - if (!other.multifileFacadeName_.isEmpty()) { - if (multifileFacadeName_.isEmpty()) { - multifileFacadeName_ = other.multifileFacadeName_; + if (!other.multifileFacadeShortName_.isEmpty()) { + if (multifileFacadeShortName_.isEmpty()) { + multifileFacadeShortName_ = other.multifileFacadeShortName_; bitField0_ = (bitField0_ & ~0x00000008); } else { - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.addAll(other.multifileFacadeName_); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.addAll(other.multifileFacadeShortName_); + } + onChanged(); + } + if (!other.classWithJvmPackageNameShortName_.isEmpty()) { + if (classWithJvmPackageNameShortName_.isEmpty()) { + classWithJvmPackageNameShortName_ = other.classWithJvmPackageNameShortName_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.addAll(other.classWithJvmPackageNameShortName_); + } + onChanged(); + } + if (!other.classWithJvmPackageNamePackageId_.isEmpty()) { + if (classWithJvmPackageNamePackageId_.isEmpty()) { + classWithJvmPackageNamePackageId_ = other.classWithJvmPackageNamePackageId_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.addAll(other.classWithJvmPackageNamePackageId_); } onChanged(); } @@ -2152,377 +2705,646 @@ public final class DebugJvmPackageTable { return this; } - private org.jetbrains.kotlin.protobuf.LazyStringList className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - private void ensureClassNameIsMutable() { + private org.jetbrains.kotlin.protobuf.LazyStringList shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureShortClassNameIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { - className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(className_); + shortClassName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(shortClassName_); bitField0_ |= 0x00000002; } } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList() { - return className_.getUnmodifiableView(); + getShortClassNameList() { + return shortClassName_.getUnmodifiableView(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public int getClassNameCount() { - return className_.size(); + public int getShortClassNameCount() { + return shortClassName_.size(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public java.lang.String getClassName(int index) { - return className_.get(index); + public java.lang.String getShortClassName(int index) { + return shortClassName_.get(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index) { - return className_.getByteString(index); + getShortClassNameBytes(int index) { + return shortClassName_.getByteString(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder setClassName( + public Builder setShortClassName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.set(index, value); + ensureShortClassNameIsMutable(); + shortClassName_.set(index, value); onChanged(); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addClassName( + public Builder addShortClassName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.add(value); + ensureShortClassNameIsMutable(); + shortClassName_.add(value); onChanged(); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addAllClassName( + public Builder addAllShortClassName( java.lang.Iterable values) { - ensureClassNameIsMutable(); + ensureShortClassNameIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, className_); + values, shortClassName_); onChanged(); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder clearClassName() { - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + public Builder clearShortClassName() { + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addClassNameBytes( + public Builder addShortClassNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.add(value); + ensureShortClassNameIsMutable(); + shortClassName_.add(value); onChanged(); return this; } - private java.util.List multifileFacadeId_ = java.util.Collections.emptyList(); - private void ensureMultifileFacadeIdIsMutable() { + private java.util.List multifileFacadeShortNameId_ = java.util.Collections.emptyList(); + private void ensureMultifileFacadeShortNameIdIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = new java.util.ArrayList(multifileFacadeId_); + multifileFacadeShortNameId_ = new java.util.ArrayList(multifileFacadeShortNameId_); bitField0_ |= 0x00000004; } } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ public java.util.List - getMultifileFacadeIdList() { - return java.util.Collections.unmodifiableList(multifileFacadeId_); + getMultifileFacadeShortNameIdList() { + return java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public int getMultifileFacadeIdCount() { - return multifileFacadeId_.size(); + public int getMultifileFacadeShortNameIdCount() { + return multifileFacadeShortNameId_.size(); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public int getMultifileFacadeId(int index) { - return multifileFacadeId_.get(index); + public int getMultifileFacadeShortNameId(int index) { + return multifileFacadeShortNameId_.get(index); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder setMultifileFacadeId( + public Builder setMultifileFacadeShortNameId( int index, int value) { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.set(index, value); + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.set(index, value); onChanged(); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder addMultifileFacadeId(int value) { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.add(value); + public Builder addMultifileFacadeShortNameId(int value) { + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.add(value); onChanged(); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder addAllMultifileFacadeId( + public Builder addAllMultifileFacadeShortNameId( java.lang.Iterable values) { - ensureMultifileFacadeIdIsMutable(); + ensureMultifileFacadeShortNameIdIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, multifileFacadeId_); + values, multifileFacadeShortNameId_); onChanged(); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder clearMultifileFacadeId() { - multifileFacadeId_ = java.util.Collections.emptyList(); + public Builder clearMultifileFacadeShortNameId() { + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } - private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - private void ensureMultifileFacadeNameIsMutable() { + private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureMultifileFacadeShortNameIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeName_); + multifileFacadeShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeShortName_); bitField0_ |= 0x00000008; } } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList() { - return multifileFacadeName_.getUnmodifiableView(); + getMultifileFacadeShortNameList() { + return multifileFacadeShortName_.getUnmodifiableView(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public int getMultifileFacadeNameCount() { - return multifileFacadeName_.size(); + public int getMultifileFacadeShortNameCount() { + return multifileFacadeShortName_.size(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public java.lang.String getMultifileFacadeName(int index) { - return multifileFacadeName_.get(index); + public java.lang.String getMultifileFacadeShortName(int index) { + return multifileFacadeShortName_.get(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index) { - return multifileFacadeName_.getByteString(index); + getMultifileFacadeShortNameBytes(int index) { + return multifileFacadeShortName_.getByteString(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder setMultifileFacadeName( + public Builder setMultifileFacadeShortName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.set(index, value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.set(index, value); onChanged(); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addMultifileFacadeName( + public Builder addMultifileFacadeShortName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.add(value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.add(value); onChanged(); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addAllMultifileFacadeName( + public Builder addAllMultifileFacadeShortName( java.lang.Iterable values) { - ensureMultifileFacadeNameIsMutable(); + ensureMultifileFacadeShortNameIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, multifileFacadeName_); + values, multifileFacadeShortName_); onChanged(); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder clearMultifileFacadeName() { - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + public Builder clearMultifileFacadeShortName() { + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addMultifileFacadeNameBytes( + public Builder addMultifileFacadeShortNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.add(value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.add(value); + onChanged(); + return this; + } + + private org.jetbrains.kotlin.protobuf.LazyStringList classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureClassWithJvmPackageNameShortNameIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(classWithJvmPackageNameShortName_); + bitField0_ |= 0x00000010; + } + } + /** + * 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.
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList() { + return classWithJvmPackageNameShortName_.getUnmodifiableView(); + } + /** + * 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.
+       * 
+ */ + public int getClassWithJvmPackageNameShortNameCount() { + return classWithJvmPackageNameShortName_.size(); + } + /** + * 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.
+       * 
+ */ + public java.lang.String getClassWithJvmPackageNameShortName(int index) { + return classWithJvmPackageNameShortName_.get(index); + } + /** + * 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.
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index) { + return classWithJvmPackageNameShortName_.getByteString(index); + } + /** + * 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.
+       * 
+ */ + public Builder setClassWithJvmPackageNameShortName( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.set(index, value); + onChanged(); + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addClassWithJvmPackageNameShortName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.add(value); + onChanged(); + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNameShortName( + java.lang.Iterable values) { + ensureClassWithJvmPackageNameShortNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNameShortName_); + onChanged(); + return this; + } + /** + * 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.
+       * 
+ */ + public Builder clearClassWithJvmPackageNameShortName() { + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addClassWithJvmPackageNameShortNameBytes( + org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.add(value); + onChanged(); + return this; + } + + private java.util.List classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + private void ensureClassWithJvmPackageNamePackageIdIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(classWithJvmPackageNamePackageId_); + bitField0_ |= 0x00000020; + } + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public java.util.List + getClassWithJvmPackageNamePackageIdList() { + return java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public int getClassWithJvmPackageNamePackageIdCount() { + return classWithJvmPackageNamePackageId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public int getClassWithJvmPackageNamePackageId(int index) { + return classWithJvmPackageNamePackageId_.get(index); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder setClassWithJvmPackageNamePackageId( + int index, int value) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.set(index, value); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder addClassWithJvmPackageNamePackageId(int value) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.add(value); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNamePackageId( + java.lang.Iterable values) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNamePackageId_); + onChanged(); + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder clearClassWithJvmPackageNamePackageId() { + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); onChanged(); return this; } @@ -2559,15 +3381,19 @@ public final class DebugJvmPackageTable { java.lang.String[] descriptorData = { "\n=core/descriptor.loader.java/src/jvm_pa" + "ckage_table.debug.proto\022&org.jetbrains.k" + - "otlin.serialization.jvm\"\251\001\n\014PackageTable" + + "otlin.serialization.jvm\"\303\001\n\014PackageTable" + "\022K\n\rpackage_parts\030\001 \003(\01324.org.jetbrains." + "kotlin.serialization.jvm.PackageParts\022L\n" + "\016metadata_parts\030\002 \003(\01324.org.jetbrains.ko" + - "tlin.serialization.jvm.PackageParts\"{\n\014P" + - "ackageParts\022\027\n\017package_fq_name\030\001 \002(\t\022\022\n\n" + - "class_name\030\002 \003(\t\022\037\n\023multifile_facade_id\030" + - "\003 \003(\005B\002\020\001\022\035\n\025multifile_facade_name\030\004 \003(\t", - "B\026B\024DebugJvmPackageTable" + "tlin.serialization.jvm.PackageParts\022\030\n\020j" + + "vm_package_name\030\003 \003(\t\"\366\001\n\014PackageParts\022\027" + + "\n\017package_fq_name\030\001 \002(\t\022\030\n\020short_class_n" + + "ame\030\002 \003(\t\022*\n\036multifile_facade_short_name", + "_id\030\003 \003(\005B\002\020\001\022#\n\033multifile_facade_short_" + + "name\030\004 \003(\t\022.\n&class_with_jvm_package_nam" + + "e_short_name\030\005 \003(\t\0222\n&class_with_jvm_pac" + + "kage_name_package_id\030\006 \003(\005B\002\020\001B\026B\024DebugJ" + + "vmPackageTable" }; org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new org.jetbrains.kotlin.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() { @@ -2586,13 +3412,13 @@ public final class DebugJvmPackageTable { internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_fieldAccessorTable = new org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_kotlin_serialization_jvm_PackageTable_descriptor, - new java.lang.String[] { "PackageParts", "MetadataParts", }); + new java.lang.String[] { "PackageParts", "MetadataParts", "JvmPackageName", }); internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_fieldAccessorTable = new org.jetbrains.kotlin.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_org_jetbrains_kotlin_serialization_jvm_PackageParts_descriptor, - new java.lang.String[] { "PackageFqName", "ClassName", "MultifileFacadeId", "MultifileFacadeName", }); + new java.lang.String[] { "PackageFqName", "ShortClassName", "MultifileFacadeShortNameId", "MultifileFacadeShortName", "ClassWithJvmPackageNameShortName", "ClassWithJvmPackageNamePackageId", }); } // @@protoc_insertion_point(outer_class_scope) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java index 00cb81608b9..559c8bc7281 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java @@ -197,9 +197,9 @@ public class ClassFileFactory implements OutputFileCollection { private PackagePartRegistry buildNewPackagePartRegistry(@NotNull FqName packageFqName) { String packageFqNameAsString = packageFqName.asString(); - return (partShortName, facadeShortName) -> { + return (partInternalName, facadeInternalName) -> { PackageParts packageParts = partsGroupedByPackage.computeIfAbsent(packageFqNameAsString, PackageParts::new); - packageParts.addPart(partShortName, facadeShortName); + packageParts.addPart(partInternalName, facadeInternalName); }; } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt index 939db10c883..3b0474ebd89 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MultifileClassCodegen.kt @@ -209,7 +209,7 @@ class MultifileClassCodegenImpl( if (!state.generateDeclaredClassFilter.shouldGeneratePackagePart(file) || !file.hasDeclarationsForPartClass()) return - packagePartRegistry.addPart(partType.internalName.substringAfterLast('/'), facadeClassType.internalName.substringAfterLast('/')) + packagePartRegistry.addPart(partType.internalName, facadeClassType.internalName) val builder = state.factory.newVisitor(MultifileClassPart(file, packageFragment), partType, file) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegenImpl.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegenImpl.java index b2e912240f3..e20d0e84bb8 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegenImpl.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegenImpl.java @@ -20,7 +20,6 @@ import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.SmartList; -import kotlin.text.StringsKt; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.kotlin.codegen.context.PackageContext; @@ -123,8 +122,7 @@ public class PackageCodegenImpl implements PackageCodegen { if (!generatePackagePart || !state.getGenerateDeclaredClassFilter().shouldGeneratePackagePart(file)) return; - String name = fileClassType.getInternalName(); - packagePartRegistry.addPart(StringsKt.substringAfterLast(name, '/', name), null); + packagePartRegistry.addPart(fileClassType.getInternalName(), null); ClassBuilder builder = state.getFactory().newVisitor(JvmDeclarationOriginKt.PackagePart(file, packageFragment), fileClassType, file); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackagePartRegistry.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackagePartRegistry.kt index 453fa63bafe..5cd23ad1299 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackagePartRegistry.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackagePartRegistry.kt @@ -17,5 +17,5 @@ package org.jetbrains.kotlin.codegen interface PackagePartRegistry { - fun addPart(partShortName: String, facadeShortName: String?) + fun addPart(partInternalName: String, facadeInternalName: String?) } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/classFileUtils.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/classFileUtils.kt index 2192bcdc4f8..fca92b66ba0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/classFileUtils.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/classFileUtils.kt @@ -22,6 +22,7 @@ import org.jetbrains.kotlin.codegen.state.GenerationState import org.jetbrains.kotlin.load.kotlin.JvmMetadataVersion import org.jetbrains.kotlin.load.kotlin.ModuleMapping import org.jetbrains.kotlin.load.kotlin.PackageParts +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.serialization.jvm.JvmPackageTable import java.io.ByteArrayOutputStream @@ -43,9 +44,8 @@ private fun Iterable.addCompiledParts(state: GenerationState): Lis val mapping = ModuleMapping.create(moduleMappingData, "", state.deserializationConfiguration) incrementalCache.getObsoletePackageParts().forEach { internalName -> - val qualifier = internalName.substringBeforeLast('/', "").replace('/', '.') - val name = internalName.substringAfterLast('/') - mapping.findPackageParts(qualifier)?.removePart(name) + val qualifier = JvmClassName.byInternalName(internalName).packageFqName.asString() + mapping.findPackageParts(qualifier)?.removePart(internalName) } return (this + mapping.packageFqName2Parts.values) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java index 1e7cb6eac0a..9f941e06e52 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/KotlinTypeMapper.java @@ -253,12 +253,13 @@ public class KotlinTypeMapper { @NotNull private static ContainingClassesInfo forPackageMember( - @NotNull FqName packageFqName, - @NotNull String facadeClassName, - @NotNull String implClassName + @NotNull JvmClassName facadeName, + @NotNull JvmClassName partName ) { - return new ContainingClassesInfo(ClassId.topLevel(packageFqName.child(Name.identifier(facadeClassName))), - ClassId.topLevel(packageFqName.child(Name.identifier(implClassName)))); + return new ContainingClassesInfo( + ClassId.topLevel(facadeName.getFqNameForTopLevelClassMaybeWithDollars()), + ClassId.topLevel(partName.getFqNameForTopLevelClassMaybeWithDollars()) + ); } @NotNull @@ -326,27 +327,24 @@ public class KotlinTypeMapper { return new ContainingClassesInfo(FAKE_CLASS_ID_FOR_BUILTINS, FAKE_CLASS_ID_FOR_BUILTINS); } - Name implClassName = UtilKt.getImplClassNameForDeserialized(descriptor); + JvmClassName implClassName = UtilKt.getImplClassNameForDeserialized(descriptor); assert implClassName != null : "No implClassName for " + descriptor; - String implSimpleName = implClassName.asString(); - String facadeSimpleName; + JvmClassName facadeName; if (containingDeclaration instanceof LazyJavaPackageFragment) { - facadeSimpleName = ((LazyJavaPackageFragment) containingDeclaration).getFacadeSimpleNameForPartSimpleName(implSimpleName); - if (facadeSimpleName == null) return null; + facadeName = ((LazyJavaPackageFragment) containingDeclaration).getFacadeNameForPartName(implClassName); + if (facadeName == null) return null; } else if (containingDeclaration instanceof IncrementalMultifileClassPackageFragment) { - facadeSimpleName = ((IncrementalMultifileClassPackageFragment) containingDeclaration).getMultifileClassName().asString(); + facadeName = ((IncrementalMultifileClassPackageFragment) containingDeclaration).getFacadeName(); } else { throw new AssertionError("Unexpected package fragment for " + descriptor + ": " + containingDeclaration + " (" + containingDeclaration.getClass().getSimpleName() + ")"); } - return ContainingClassesInfo.forPackageMember( - ((PackageFragmentDescriptor) containingDeclaration).getFqName(), facadeSimpleName, implSimpleName - ); + return ContainingClassesInfo.forPackageMember(facadeName, implClassName); } @NotNull diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt index ced18ed184f..f59b14fe75b 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCliJavaFileManagerImpl.kt @@ -47,12 +47,19 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ private val perfCounter = PerformanceCounter.create("Find Java class") private lateinit var index: JvmDependenciesIndex private lateinit var singleJavaFileRootsIndex: SingleJavaFileRootsIndex + private lateinit var packagePartProviders: List private val topLevelClassesCache: MutableMap = THashMap() private val allScope = GlobalSearchScope.allScope(myPsiManager.project) private var useFastClassFilesReading = false - fun initialize(index: JvmDependenciesIndex, singleJavaFileRootsIndex: SingleJavaFileRootsIndex, useFastClassFilesReading: Boolean) { + fun initialize( + index: JvmDependenciesIndex, + packagePartProviders: List, + singleJavaFileRootsIndex: SingleJavaFileRootsIndex, + useFastClassFilesReading: Boolean + ) { this.index = index + this.packagePartProviders = packagePartProviders this.singleJavaFileRootsIndex = singleJavaFileRootsIndex this.useFastClassFilesReading = useFastClassFilesReading } @@ -180,6 +187,9 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ //abort on first found false } + if (!found) { + found = packagePartProviders.any { it.findPackageParts(packageName).isNotEmpty() } + } if (!found) { found = singleJavaFileRootsIndex.findJavaSourceClasses(packageFqName).isNotEmpty() } diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt index 78e46601130..0d08b2263f5 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/jvm/compiler/KotlinCoreEnvironment.kt @@ -234,6 +234,7 @@ class KotlinCoreEnvironment private constructor( (ServiceManager.getService(project, CoreJavaFileManager::class.java) as KotlinCliJavaFileManagerImpl).initialize( rootsIndex, + packagePartProviders, SingleJavaFileRootsIndex(singleJavaFileRoots), configuration.getBoolean(JVMConfigurationKeys.USE_FAST_CLASS_FILES_READING) ) diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt index 90194479a45..9613f3f2e38 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/fileClasses/JvmFileClassUtil.kt @@ -18,7 +18,6 @@ package org.jetbrains.kotlin.fileClasses import com.intellij.psi.util.CachedValueProvider import com.intellij.psi.util.CachedValuesManager -import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.load.java.descriptors.getImplClassNameForDeserialized import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils import org.jetbrains.kotlin.name.FqName @@ -39,10 +38,9 @@ object JvmFileClassUtil { private const val MULTIFILE_PART_NAME_DELIMITER = "__" - fun getPartFqNameForDeserialized(descriptor: DeserializedMemberDescriptor): FqName { - val implClassName = descriptor.getImplClassNameForDeserialized() ?: error("No implClassName for $descriptor") - return (descriptor.containingDeclaration as PackageFragmentDescriptor).fqName.child(implClassName) - } + fun getPartFqNameForDeserialized(descriptor: DeserializedMemberDescriptor): FqName = + descriptor.getImplClassNameForDeserialized()?.fqNameForTopLevelClassMaybeWithDollars + ?: error("No implClassName for $descriptor") @JvmStatic fun getFileClassInternalName(file: KtFile): String = diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt index 8273f90c2cd..bd8f241bc31 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/kotlin/incremental/IncrementalPackageFragmentProvider.kt @@ -64,36 +64,33 @@ class IncrementalPackageFragmentProvider( get() = this@IncrementalPackageFragmentProvider.target fun getPackageFragmentForMultifileClass(multifileClassFqName: FqName): IncrementalMultifileClassPackageFragment? { - val facadeInternalName = JvmClassName.byFqNameWithoutInnerClasses(multifileClassFqName).internalName - val partsNames = incrementalCache.getStableMultifileFacadeParts(facadeInternalName) ?: return null - return IncrementalMultifileClassPackageFragment(multifileClassFqName, partsNames) + val facadeName = JvmClassName.byFqNameWithoutInnerClasses(multifileClassFqName) + val partsNames = incrementalCache.getStableMultifileFacadeParts(facadeName.internalName) ?: return null + return IncrementalMultifileClassPackageFragment(facadeName, partsNames, multifileClassFqName.parent()) } override fun getMemberScope(): MemberScope = MemberScope.Empty } inner class IncrementalMultifileClassPackageFragment( - private val multifileClassFqName: FqName, - val partsInternalNames: Collection - ) : PackageFragmentDescriptorImpl(moduleDescriptor, multifileClassFqName.parent()) { + val facadeName: JvmClassName, + val partsInternalNames: Collection, + packageFqName: FqName + ) : PackageFragmentDescriptorImpl(moduleDescriptor, packageFqName) { private val memberScope = storageManager.createLazyValue { ChainedMemberScope.create( - "Member scope for incremental compilation: union of multifile class parts data for $multifileClassFqName", + "Member scope for incremental compilation: union of multifile class parts data for $facadeName", partsInternalNames.mapNotNull { internalName -> incrementalCache.getPackagePartData(internalName)?.let { (data, strings) -> val (nameResolver, packageProto) = JvmProtoBufUtil.readPackageDataFrom(data, strings) - val jvmBinaryClass = kotlinClassFinder.findKotlinClass( - ClassId.topLevel(FqName(internalName.replace('/', '.'))) - ) + val partName = JvmClassName.byInternalName(internalName) + val jvmBinaryClass = + kotlinClassFinder.findKotlinClass(ClassId.topLevel(partName.fqNameForTopLevelClassMaybeWithDollars)) DeserializedPackageMemberScope( this, packageProto, nameResolver, - JvmPackagePartSource( - JvmClassName.byInternalName(internalName), - JvmClassName.byFqNameWithoutInnerClasses(multifileClassFqName.asString()), - knownJvmBinaryClass = jvmBinaryClass - ), + JvmPackagePartSource(partName, facadeName, knownJvmBinaryClass = jvmBinaryClass), deserializationComponents, classNames = { emptyList() } ) } @@ -101,9 +98,6 @@ class IncrementalPackageFragmentProvider( ) } - val multifileClassName: Name - get() = multifileClassFqName.shortName() - override fun getMemberScope() = memberScope() } } diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmOverloadFilter.kt b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmOverloadFilter.kt index 103069b21b2..104fd606ee2 100644 --- a/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmOverloadFilter.kt +++ b/compiler/frontend.java/src/org/jetbrains/kotlin/resolve/jvm/JvmOverloadFilter.kt @@ -18,9 +18,7 @@ package org.jetbrains.kotlin.resolve.jvm import org.jetbrains.kotlin.descriptors.ConstructorDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptorNonRoot -import org.jetbrains.kotlin.descriptors.PackageFragmentDescriptor import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil -import org.jetbrains.kotlin.load.java.descriptors.getImplClassNameForDeserialized import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils import org.jetbrains.kotlin.resolve.OverloadFilter @@ -42,14 +40,8 @@ object JvmOverloadFilter : OverloadFilter { if (overload is ConstructorDescriptor) continue if (overload !is DeserializedCallableMemberDescriptor) continue - val containingDeclaration = overload.containingDeclaration - if (containingDeclaration !is PackageFragmentDescriptor) { - throw AssertionError("Package member expected; got $overload with containing declaration $containingDeclaration") - } - - val implClassName = overload.getImplClassNameForDeserialized() ?: throw AssertionError("No implClassName: $overload") - val implClassFQN = containingDeclaration.fqName.child(implClassName) - if (!sourceClassesFQNs.contains(implClassFQN)) { + val implClassFQN = JvmFileClassUtil.getPartFqNameForDeserialized(overload) + if (implClassFQN !in sourceClassesFQNs) { result.add(overload) } } diff --git a/compiler/testData/codegen/box/jvmPackageName/rootPackage.kt b/compiler/testData/codegen/box/jvmPackageName/rootPackage.kt new file mode 100644 index 00000000000..475834f0ee7 --- /dev/null +++ b/compiler/testData/codegen/box/jvmPackageName/rootPackage.kt @@ -0,0 +1,18 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// LANGUAGE_VERSION: 1.2 + +// FILE: foo.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("jjj") + +fun f(): String = "O" + +val g: String? get() = "K" + +inline fun i(block: () -> String) = block() + +// FILE: bar.kt + +fun box(): String = i { f() + g } diff --git a/compiler/testData/codegen/box/jvmPackageName/withJvmName.kt b/compiler/testData/codegen/box/jvmPackageName/withJvmName.kt new file mode 100644 index 00000000000..df2917bef0e --- /dev/null +++ b/compiler/testData/codegen/box/jvmPackageName/withJvmName.kt @@ -0,0 +1,19 @@ +// TARGET_BACKEND: JVM +// WITH_RUNTIME +// LANGUAGE_VERSION: 1.2 + +// FILE: foo.kt + +@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@file:JvmPackageName("jjj") +@file:JvmName("Foooo") + +fun f(): String = "O" + +val g: String? get() = "K" + +inline fun i(block: () -> String) = block() + +// FILE: bar.kt + +fun box(): String = i { f() + g } diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt new file mode 100644 index 00000000000..60d806b1a79 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt @@ -0,0 +1,25 @@ +// IGNORE_BACKEND: NATIVE +// FILE: A.kt +// LANGUAGE_VERSION: 1.2 + +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("bar") +package foo + +fun f() = "OK" + +var v: Int = 1 + +inline fun i(block: () -> Unit) = block() + +// FILE: B.kt + +import foo.* + +fun box(): String { + v = 2 + if (v != 2) return "Fail" + i { v = 3 } + if (v != 3) return "Fail" + return f() +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt new file mode 100644 index 00000000000..4f144899965 --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt @@ -0,0 +1,18 @@ +// IGNORE_BACKEND: NATIVE +// FILE: A.kt +// LANGUAGE_VERSION: 1.2 + +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("bar") + +fun f() = "OK" + +var v: Int = 1 + +// FILE: B.kt + +fun box(): String { + v = 2 + if (v != 2) return "Fail" + return f() +} diff --git a/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt new file mode 100644 index 00000000000..a696b26ec0c --- /dev/null +++ b/compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt @@ -0,0 +1,22 @@ +// IGNORE_BACKEND: NATIVE +// FILE: A.kt +// LANGUAGE_VERSION: 1.2 + +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("bar") +@file:JvmName("Baz") +package foo + +fun f() = "OK" + +var v: Int = 1 + +// FILE: B.kt + +import foo.* + +fun box(): String { + v = 2 + if (v != 2) return "Fail" + return f() +} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJ.kt b/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJ.kt new file mode 100644 index 00000000000..e314ca02610 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJ.kt @@ -0,0 +1,5 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("j") +package bar + +fun file0() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJJ.kt b/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJJ.kt new file mode 100644 index 00000000000..1332d265269 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/BarAsJJ.kt @@ -0,0 +1,6 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmName("JJ") +@file:JvmPackageName("jj") +package bar + +fun jj() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/Foo.kt b/compiler/testData/jvmPackageTable/jvmPackageName/Foo.kt new file mode 100644 index 00000000000..ffa0ca17992 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/Foo.kt @@ -0,0 +1,3 @@ +package foo + +fun file1() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/FooAsJJJ.kt b/compiler/testData/jvmPackageTable/jvmPackageName/FooAsJJJ.kt new file mode 100644 index 00000000000..4bb55187bca --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/FooAsJJJ.kt @@ -0,0 +1,5 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("jjj") +package foo + +fun file2() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/FooMultiFile.kt b/compiler/testData/jvmPackageTable/jvmPackageName/FooMultiFile.kt new file mode 100644 index 00000000000..7c7268d5381 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/FooMultiFile.kt @@ -0,0 +1,5 @@ +@file:JvmMultifileClass +@file:JvmName("MultiFoo") +package foo + +fun multiFile1() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageName/jvm-package-table.txt b/compiler/testData/jvmPackageTable/jvmPackageName/jvm-package-table.txt new file mode 100644 index 00000000000..0390ef39c28 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageName/jvm-package-table.txt @@ -0,0 +1,7 @@ +bar + j/BarAsJKt + jj/JJ +foo + foo/MultiFoo__FooMultiFileKt (foo/MultiFoo) + foo/FooKt + jjj/FooAsJJJKt diff --git a/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo1.kt b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo1.kt new file mode 100644 index 00000000000..55ca8bc833e --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo1.kt @@ -0,0 +1,5 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("foo.jvm") +package foo + +fun foo1() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo2.kt b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo2.kt new file mode 100644 index 00000000000..f7e3ccea95b --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo2.kt @@ -0,0 +1,5 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("foo.jvm") +package foo + +fun foo2() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo3.kt b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo3.kt new file mode 100644 index 00000000000..ac492382822 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/Foo3.kt @@ -0,0 +1,5 @@ +@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@file:JvmPackageName("foo.jvm") +package foo + +fun foo3() {} diff --git a/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/jvm-package-table.txt b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/jvm-package-table.txt new file mode 100644 index 00000000000..5500612a972 --- /dev/null +++ b/compiler/testData/jvmPackageTable/jvmPackageNameManyParts/jvm-package-table.txt @@ -0,0 +1,4 @@ +foo + foo/jvm/Foo1Kt + foo/jvm/Foo2Kt + foo/jvm/Foo3Kt diff --git a/compiler/testData/jvmPackageTable/simple/jvm-package-table.txt b/compiler/testData/jvmPackageTable/simple/jvm-package-table.txt index d240da53c10..80f5ecaa578 100644 --- a/compiler/testData/jvmPackageTable/simple/jvm-package-table.txt +++ b/compiler/testData/jvmPackageTable/simple/jvm-package-table.txt @@ -1,10 +1,10 @@ bar - MultiBar__BarMultiFilePart1Kt (MultiBar) - MultiBar__BarMultiFilePart2Kt (MultiBar) - BarFileFacade1Kt + bar/MultiBar__BarMultiFilePart1Kt (bar/MultiBar) + bar/MultiBar__BarMultiFilePart2Kt (bar/MultiBar) + bar/BarFileFacade1Kt foo - AnotherMultiFoo__AnotherFooMultiFilePart1Kt (AnotherMultiFoo) - MultiFoo__FooMultiFilePart1Kt (MultiFoo) - MultiFoo__FooMultiFilePart2Kt (MultiFoo) - FooFileFacade1Kt - FooFileFacade2Kt + foo/AnotherMultiFoo__AnotherFooMultiFilePart1Kt (foo/AnotherMultiFoo) + foo/MultiFoo__FooMultiFilePart1Kt (foo/MultiFoo) + foo/MultiFoo__FooMultiFilePart2Kt (foo/MultiFoo) + foo/FooFileFacade1Kt + foo/FooFileFacade2Kt diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 7a8a67ae4ac..6aeea46ce43 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -10409,11 +10409,23 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/jvmPackageName"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("rootPackage.kt") + public void testRootPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); + doTest(fileName); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/simple.kt"); doTest(fileName); } + + @TestMetadata("withJvmName.kt") + public void testWithJvmName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/withJvmName.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/jvmStatic") diff --git a/compiler/tests/org/jetbrains/kotlin/cli/jvm/KotlinCliJavaFileManagerTest.kt b/compiler/tests/org/jetbrains/kotlin/cli/jvm/KotlinCliJavaFileManagerTest.kt index d31943755ae..4e3ebb03651 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/jvm/KotlinCliJavaFileManagerTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/cli/jvm/KotlinCliJavaFileManagerTest.kt @@ -204,6 +204,7 @@ class KotlinCliJavaFileManagerTest : KotlinTestWithEnvironment() { val root = StandardFileSystems.local().findFileByPath(javaFilesDir.path)!! coreJavaFileManager.initialize( JvmDependenciesIndexImpl(listOf(JavaRoot(root, JavaRoot.RootType.SOURCE))), + emptyList(), SingleJavaFileRootsIndex(emptyList()), useFastClassFilesReading = true ) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index c10c5db8ab7..bc50609cb6c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -10409,11 +10409,23 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/jvmPackageName"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("rootPackage.kt") + public void testRootPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); + doTest(fileName); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/simple.kt"); doTest(fileName); } + + @TestMetadata("withJvmName.kt") + public void testWithJvmName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/withJvmName.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/jvmStatic") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java index 73cf7c74e51..9749ca8fb27 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstKotlinTestGenerated.java @@ -138,6 +138,24 @@ public class CompileKotlinAgainstKotlinTestGenerated extends AbstractCompileKotl doTest(fileName); } + @TestMetadata("jvmPackageName.kt") + public void testJvmPackageName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmPackageName.kt"); + doTest(fileName); + } + + @TestMetadata("jvmPackageNameInRootPackage.kt") + public void testJvmPackageNameInRootPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameInRootPackage.kt"); + doTest(fileName); + } + + @TestMetadata("jvmPackageNameWithJvmName.kt") + public void testJvmPackageNameWithJvmName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmPackageNameWithJvmName.kt"); + doTest(fileName); + } + @TestMetadata("jvmStaticInObject.kt") public void testJvmStaticInObject() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/compileKotlinAgainstKotlin/jvmStaticInObject.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/JvmPackageTableTest.kt b/compiler/tests/org/jetbrains/kotlin/codegen/JvmPackageTableTest.kt index 9bcc6fd758a..12d5752cf82 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/JvmPackageTableTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/codegen/JvmPackageTableTest.kt @@ -19,14 +19,21 @@ package org.jetbrains.kotlin.codegen import org.jetbrains.kotlin.cli.AbstractCliTest import org.jetbrains.kotlin.cli.common.ExitCode import org.jetbrains.kotlin.cli.jvm.K2JVMCompiler +import org.jetbrains.kotlin.config.ApiVersion +import org.jetbrains.kotlin.config.LanguageVersion +import org.jetbrains.kotlin.config.LanguageVersionSettingsImpl import org.jetbrains.kotlin.load.kotlin.ModuleMapping -import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration +import org.jetbrains.kotlin.resolve.CompilerDeserializationConfiguration import org.jetbrains.kotlin.test.KotlinTestUtils import org.jetbrains.kotlin.test.testFramework.KtUsefulTestCase import java.io.File class JvmPackageTableTest : KtUsefulTestCase() { - private fun doTest(relativeDirectory: String) { + private fun doTest( + relativeDirectory: String, + compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE, + loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE + ) { val directory = KotlinTestUtils.getTestDataPathBase() + relativeDirectory val tmpdir = KotlinTestUtils.tmpDir(this::class.simpleName) @@ -34,14 +41,17 @@ class JvmPackageTableTest : KtUsefulTestCase() { val (output, exitCode) = AbstractCliTest.executeCompilerGrabOutput(K2JVMCompiler(), listOf( directory, "-d", tmpdir.path, - "-module-name", moduleName + "-module-name", moduleName, + "-language-version", compileWith.versionString )) System.err.println(output) // normally output is empty assertEquals("Compilation should complete successfully", ExitCode.OK, exitCode) val mapping = ModuleMapping.create( File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test", - DeserializationConfiguration.Default + CompilerDeserializationConfiguration( + LanguageVersionSettingsImpl(loadWith, ApiVersion.createByLanguageVersion(loadWith)) + ) ) val result = buildString { for ((fqName, packageParts) in mapping.packageFqName2Parts) { @@ -66,4 +76,14 @@ class JvmPackageTableTest : KtUsefulTestCase() { fun testSimple() { doTest("/jvmPackageTable/simple") } + + fun testJvmPackageName() { + doTest("/jvmPackageTable/jvmPackageName", + compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2) + } + + fun testJvmPackageNameManyParts() { + doTest("/jvmPackageTable/jvmPackageNameManyParts", + compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_2) + } } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index def50092945..bdd067b2e93 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -10409,11 +10409,23 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/jvmPackageName"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); } + @TestMetadata("rootPackage.kt") + public void testRootPackage() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/rootPackage.kt"); + doTest(fileName); + } + @TestMetadata("simple.kt") public void testSimple() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/simple.kt"); doTest(fileName); } + + @TestMetadata("withJvmName.kt") + public void testWithJvmName() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/jvmPackageName/withJvmName.kt"); + doTest(fileName); + } } @TestMetadata("compiler/testData/codegen/box/jvmStatic") diff --git a/core/descriptor.loader.java/src/jvm_package_table.proto b/core/descriptor.loader.java/src/jvm_package_table.proto index 59f6c358d30..8cfc89e7a5f 100644 --- a/core/descriptor.loader.java/src/jvm_package_table.proto +++ b/core/descriptor.loader.java/src/jvm_package_table.proto @@ -25,20 +25,37 @@ message PackageTable { // Names of .kotlin_metadata files for each package repeated PackageParts metadata_parts = 2; + + // Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id. + // The names here are dot-separated, e.g. "org.foo.bar" + repeated string jvm_package_name = 3; } message PackageParts { 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) - repeated string class_name = 2; + // (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. + repeated string short_class_name = 2; - // For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1, + // For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0. // (e.g. if there are no multi-file classes in the module, this list is not going to exist at all) - repeated int32 multifile_facade_id = 3 [packed=true]; + repeated int32 multifile_facade_short_name_id = 3 [packed = true]; - // Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping. - repeated string multifile_facade_name = 4; + // Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping. + 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. + repeated string class_with_jvm_package_name_short_name = 5; + + // 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. + // + // If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element + // of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case + // when a bunch of files from the same Kotlin package have the same JVM package name. + repeated int32 class_with_jvm_package_name_package_id = 6 [packed = true]; } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/descriptors/util.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/descriptors/util.kt index 142e9f47e05..6e1553e8f92 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/descriptors/util.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/descriptors/util.kt @@ -22,9 +22,9 @@ import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.descriptors.impl.ValueParameterDescriptorImpl import org.jetbrains.kotlin.load.java.lazy.descriptors.LazyJavaStaticClassScope import org.jetbrains.kotlin.load.kotlin.JvmPackagePartSource -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.getSuperClassNotAny import org.jetbrains.kotlin.resolve.descriptorUtil.module +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedMemberDescriptor import org.jetbrains.kotlin.types.KotlinType @@ -66,9 +66,8 @@ fun ClassDescriptor.getParentJavaStaticClassScope(): LazyJavaStaticClassScope? { return staticScope } -fun DeserializedMemberDescriptor.getImplClassNameForDeserialized(): Name? { - return (containerSource as? JvmPackagePartSource)?.simpleName -} +fun DeserializedMemberDescriptor.getImplClassNameForDeserialized(): JvmClassName? = + (containerSource as? JvmPackagePartSource)?.className fun DeserializedMemberDescriptor.isFromJvmPackagePart(): Boolean = containerSource is JvmPackagePartSource diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageFragment.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageFragment.kt index 9c6b95fd709..cca0e342fe7 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageFragment.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/lazy/descriptors/LazyJavaPackageFragment.kt @@ -29,7 +29,7 @@ import org.jetbrains.kotlin.load.kotlin.KotlinJvmBinaryPackageSourceElement import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.storage.getValue class LazyJavaPackageFragment( @@ -40,7 +40,7 @@ class LazyJavaPackageFragment( internal val binaryClasses by c.storageManager.createLazyValue { c.components.packageMapper.findPackageParts(fqName.asString()).mapNotNull { partName -> - val classId = ClassId(fqName, Name.identifier(partName)) + val classId = ClassId.topLevel(JvmClassName.byInternalName(partName).fqNameForTopLevelClassMaybeWithDollars) c.components.kotlinClassFinder.findKotlinClass(classId)?.let { partName to it } }.toMap() } @@ -63,13 +63,13 @@ class LazyJavaPackageFragment( internal fun findClassifierByJavaClass(jClass: JavaClass): ClassDescriptor? = scope.javaScope.findClassifierByJavaClass(jClass) private val partToFacade by c.storageManager.createLazyValue { - val result = hashMapOf() - kotlinClasses@for ((partName, kotlinClass) in binaryClasses) { + val result = hashMapOf() + kotlinClasses@for ((partInternalName, kotlinClass) in binaryClasses) { + val partName = JvmClassName.byInternalName(partInternalName) val header = kotlinClass.classHeader when (header.kind) { KotlinClassHeader.Kind.MULTIFILE_CLASS_PART -> { - val facadeName = header.multifileClassName ?: continue@kotlinClasses - result[partName] = facadeName.substringAfterLast('/') + result[partName] = JvmClassName.byInternalName(header.multifileClassName ?: continue@kotlinClasses) } KotlinClassHeader.Kind.FILE_FACADE -> { result[partName] = partName @@ -80,7 +80,7 @@ class LazyJavaPackageFragment( result } - fun getFacadeSimpleNameForPartSimpleName(partName: String): String? = partToFacade[partName] + fun getFacadeNameForPartName(partName: JvmClassName): JvmClassName? = partToFacade[partName] override fun getMemberScope() = scope diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt index 0fadc8b0b49..4c5b13aeb2c 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/JvmMetadataVersion.kt @@ -29,7 +29,7 @@ class JvmMetadataVersion(vararg numbers: Int) : BinaryVersion(*numbers) { companion object { @JvmField - val INSTANCE = JvmMetadataVersion(1, 1, 7) + val INSTANCE = JvmMetadataVersion(1, 1, 8) @JvmField val INVALID_VERSION = JvmMetadataVersion() diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinaryPackageSourceElement.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinaryPackageSourceElement.kt index 655f4331d06..aa99b7e9e4c 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinaryPackageSourceElement.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/KotlinJvmBinaryPackageSourceElement.kt @@ -35,6 +35,6 @@ class KotlinJvmBinaryPackageSourceElement( fun getContainingBinaryClass(descriptor: DeserializedMemberDescriptor): KotlinJvmBinaryClass? { val name = descriptor.getImplClassNameForDeserialized() ?: return null - return packageFragment.binaryClasses[name.asString()] + return packageFragment.binaryClasses[name.internalName] } } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/ModuleMapping.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/ModuleMapping.kt index a6b55f54275..d703f09064a 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/ModuleMapping.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/kotlin/ModuleMapping.kt @@ -16,6 +16,9 @@ package org.jetbrains.kotlin.load.kotlin +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name +import org.jetbrains.kotlin.resolve.jvm.JvmClassName import org.jetbrains.kotlin.serialization.deserialization.DeserializationConfiguration import org.jetbrains.kotlin.serialization.jvm.JvmPackageTable import java.io.ByteArrayInputStream @@ -64,16 +67,28 @@ class ModuleMapping private constructor(val packageFqName2Parts: Map() for (proto in table.packagePartsList) { - val packageParts = result.getOrPut(proto.packageFqName) { PackageParts(proto.packageFqName) } - for ((index, partShortName) in proto.classNameList.withIndex()) { - val multifileFacadeId = proto.multifileFacadeIdList.getOrNull(index)?.minus(1) - packageParts.addPart(partShortName, multifileFacadeId?.let(proto.multifileFacadeNameList::getOrNull)) + val packageFqName = proto.packageFqName + 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) + } + + for ((index, partShortName) in proto.classWithJvmPackageNameShortNameList.withIndex()) { + val packageId = proto.classWithJvmPackageNamePackageIdList.getOrNull(index) + ?: proto.classWithJvmPackageNamePackageIdList.lastOrNull() + ?: continue + val jvmPackageName = table.jvmPackageNameList.getOrNull(packageId) ?: continue + packageParts.addPart(internalNameOf(jvmPackageName, partShortName), null) } } for (proto in table.metadataPartsList) { val packageParts = result.getOrPut(proto.packageFqName) { PackageParts(proto.packageFqName) } - proto.classNameList.forEach(packageParts::addMetadataPart) + proto.shortClassNameList.forEach(packageParts::addMetadataPart) } return ModuleMapping(result, debugName) @@ -87,21 +102,23 @@ class ModuleMapping private constructor(val packageFqName2Parts: Map short name of the corresponding multifile facade (or null, if it's not a multifile part) - private val packageParts = linkedMapOf() +private fun internalNameOf(packageFqName: String, className: String): String = + JvmClassName.byFqNameWithoutInnerClasses(FqName(packageFqName).child(Name.identifier(className))).internalName - // See JvmPackageTable.PackageTable.package_parts +class PackageParts(val packageFqName: String) { + // JVM internal name of package part -> JVM internal name of the corresponding multifile facade (or null, if it's not a multifile part) + private val packageParts = linkedMapOf() val parts: Set get() = packageParts.keys - // See JvmPackageTable.PackageTable.metadata_parts + + // Short names of .kotlin_metadata package parts val metadataParts: Set = linkedSetOf() - fun addPart(partShortName: String, facadeShortName: String?) { - packageParts[partShortName] = facadeShortName + fun addPart(partInternalName: String, facadeInternalName: String?) { + packageParts[partInternalName] = facadeInternalName } - fun removePart(shortName: String) { - packageParts.remove(shortName) + fun removePart(internalName: String) { + packageParts.remove(internalName) } fun addMetadataPart(shortName: String) { @@ -113,36 +130,76 @@ class PackageParts(val packageFqName: String) { builder.addPackageParts(JvmPackageTable.PackageParts.newBuilder().apply { packageFqName = this@PackageParts.packageFqName - val facadeNameToId = mutableMapOf() - for ((facadeName, partNames) in parts.groupBy { getMultifileFacadeName(it) }.toSortedMap(nullsLast())) { - for (partName in partNames.sorted()) { - addClassName(partName) - if (facadeName != null) { - addMultifileFacadeId(1 + facadeNameToId.getOrPut(facadeName) { facadeNameToId.size }) - } - } + val packageInternalName = packageFqName.replace('.', '/') + val (partsWithinPackage, partsOutsidePackage) = parts.partition { partInternalName -> + partInternalName.packageName == packageInternalName } - for ((facadeId, facadeName) in facadeNameToId.values.zip(facadeNameToId.keys).sortedBy(Pair::first)) { - assert(facadeId == multifileFacadeNameCount) { "Multifile facades are loaded incorrectly: $facadeNameToId" } - addMultifileFacadeName(facadeName) - } + writePartsWithinPackage(partsWithinPackage) + + writePartsOutsidePackage(partsOutsidePackage, builder) }) } if (metadataParts.isNotEmpty()) { builder.addMetadataParts(JvmPackageTable.PackageParts.newBuilder().apply { packageFqName = this@PackageParts.packageFqName - addAllClassName(metadataParts.sorted()) + addAllShortClassName(metadataParts.sorted()) }) } } - fun getMultifileFacadeName(partShortName: String): String? = packageParts[partShortName] + private fun JvmPackageTable.PackageParts.Builder.writePartsWithinPackage(parts: List) { + val facadeNameToId = mutableMapOf() + 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 }) + } + } + } + + 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 JvmPackageTable.PackageParts.Builder.writePartsOutsidePackage( + parts: List, + packageTableBuilder: JvmPackageTable.PackageTable.Builder + ) { + val packageIds = mutableListOf() + for ((packageInternalName, partsInPackage) in parts.groupBy { it.packageName }.toSortedMap()) { + val packageFqName = packageInternalName.replace('/', '.') + if (packageFqName !in packageTableBuilder.jvmPackageNameList) { + packageTableBuilder.addJvmPackageName(packageFqName) + } + val packageId = packageTableBuilder.jvmPackageNameList.indexOf(packageFqName) + for (part in partsInPackage.map { it.className }.sorted()) { + addClassWithJvmPackageNameShortName(part) + packageIds.add(packageId) + } + } + + // See PackageParts#class_with_jvm_package_name_package_id in jvm_package_table.proto for description of this optimization + while (packageIds.size > 1 && packageIds[packageIds.size - 1] == packageIds[packageIds.size - 2]) { + packageIds.removeAt(packageIds.size - 1) + } + + addAllClassWithJvmPackageNamePackageId(packageIds) + } + + private val String.packageName: String get() = substringBeforeLast('/', "") + private val String.className: String get() = substringAfterLast('/') + + fun getMultifileFacadeName(partInternalName: String): String? = packageParts[partInternalName] operator fun plusAssign(other: PackageParts) { - for ((partShortName, facadeShortName) in other.packageParts) { - addPart(partShortName, facadeShortName) + for ((partInternalName, facadeInternalName) in other.packageParts) { + addPart(partInternalName, facadeInternalName) } other.metadataParts.forEach(this::addMetadataPart) } diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/resolve/jvm/JvmClassName.java b/core/descriptor.loader.java/src/org/jetbrains/kotlin/resolve/jvm/JvmClassName.java index 1e42d0a3036..32dbefed06a 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/resolve/jvm/JvmClassName.java +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/resolve/jvm/JvmClassName.java @@ -89,7 +89,12 @@ public class JvmClassName { } /** - * WARNING: internal name cannot be converted to FQ name for a class which contains dollars in the name + * WARNING: internal name cannot be reliably converted to FQ name. + * + * This method treats all dollar characters ('$') in the internal name as inner class separators. + * So it _will work incorrectly_ for classes where dollar characters are a part of the identifier. + * + * E.g. JvmClassName("org/foo/bar/Baz$quux").getFqNameForClassNameWithoutDollars() -> FqName("org.foo.bar.Baz.quux") */ @NotNull public FqName getFqNameForClassNameWithoutDollars() { @@ -99,6 +104,19 @@ public class JvmClassName { return fqName; } + /** + * WARNING: internal name cannot be reliably converted to FQ name. + * + * This method treats all dollar characters ('$') in the internal name as a part of the identifier. + * So it _will work incorrectly_ for inner classes. + * + * E.g. JvmClassName("org/foo/bar/Baz$quux").getFqNameForTopLevelClassMaybeWithDollars() -> FqName("org.foo.bar.Baz$quux") + */ + @NotNull + public FqName getFqNameForTopLevelClassMaybeWithDollars() { + return new FqName(internalName.replace('/', '.')); + } + @NotNull public FqName getPackageFqName() { int lastSlash = internalName.lastIndexOf("/"); diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/serialization/jvm/JvmPackageTable.java b/core/descriptor.loader.java/src/org/jetbrains/kotlin/serialization/jvm/JvmPackageTable.java index ab778c36300..5c7a1e9cef0 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/serialization/jvm/JvmPackageTable.java +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/serialization/jvm/JvmPackageTable.java @@ -63,6 +63,45 @@ public final class JvmPackageTable { * */ int getMetadataPartsCount(); + + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList(); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + int getJvmPackageNameCount(); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + java.lang.String getJvmPackageName(int index); + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageTable} @@ -130,6 +169,15 @@ public final class JvmPackageTable { metadataParts_.add(input.readMessage(org.jetbrains.kotlin.serialization.jvm.JvmPackageTable.PackageParts.PARSER, extensionRegistry)); break; } + case 26: { + org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + jvmPackageName_.add(bs); + break; + } } } } catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) { @@ -144,6 +192,9 @@ public final class JvmPackageTable { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { metadataParts_ = java.util.Collections.unmodifiableList(metadataParts_); } + if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = jvmPackageName_.getUnmodifiableView(); + } try { unknownFieldsCodedOutput.flush(); } catch (java.io.IOException e) { @@ -279,9 +330,59 @@ public final class JvmPackageTable { return metadataParts_.get(index); } + public static final int JVM_PACKAGE_NAME_FIELD_NUMBER = 3; + private org.jetbrains.kotlin.protobuf.LazyStringList jvmPackageName_; + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList() { + return jvmPackageName_; + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public int getJvmPackageNameCount() { + return jvmPackageName_.size(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public java.lang.String getJvmPackageName(int index) { + return jvmPackageName_.get(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+     * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+     * The names here are dot-separated, e.g. "org.foo.bar"
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index) { + return jvmPackageName_.getByteString(index); + } + private void initFields() { packageParts_ = java.util.Collections.emptyList(); metadataParts_ = java.util.Collections.emptyList(); + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -314,6 +415,9 @@ public final class JvmPackageTable { for (int i = 0; i < metadataParts_.size(); i++) { output.writeMessage(2, metadataParts_.get(i)); } + for (int i = 0; i < jvmPackageName_.size(); i++) { + output.writeBytes(3, jvmPackageName_.getByteString(i)); + } output.writeRawBytes(unknownFields); } @@ -331,6 +435,15 @@ public final class JvmPackageTable { size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeMessageSize(2, metadataParts_.get(i)); } + { + int dataSize = 0; + for (int i = 0; i < jvmPackageName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeBytesSizeNoTag(jvmPackageName_.getByteString(i)); + } + size += dataSize; + size += 1 * getJvmPackageNameList().size(); + } size += unknownFields.size(); memoizedSerializedSize = size; return size; @@ -429,6 +542,8 @@ public final class JvmPackageTable { bitField0_ = (bitField0_ & ~0x00000001); metadataParts_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); return this; } @@ -461,6 +576,11 @@ public final class JvmPackageTable { bitField0_ = (bitField0_ & ~0x00000002); } result.metadataParts_ = metadataParts_; + if (((bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = jvmPackageName_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.jvmPackageName_ = jvmPackageName_; return result; } @@ -485,6 +605,16 @@ public final class JvmPackageTable { metadataParts_.addAll(other.metadataParts_); } + } + if (!other.jvmPackageName_.isEmpty()) { + if (jvmPackageName_.isEmpty()) { + jvmPackageName_ = other.jvmPackageName_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureJvmPackageNameIsMutable(); + jvmPackageName_.addAll(other.jvmPackageName_); + } + } setUnknownFields( getUnknownFields().concat(other.unknownFields)); @@ -872,6 +1002,144 @@ public final class JvmPackageTable { return this; } + private org.jetbrains.kotlin.protobuf.LazyStringList jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureJvmPackageNameIsMutable() { + if (!((bitField0_ & 0x00000004) == 0x00000004)) { + jvmPackageName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(jvmPackageName_); + bitField0_ |= 0x00000004; + } + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getJvmPackageNameList() { + return jvmPackageName_.getUnmodifiableView(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public int getJvmPackageNameCount() { + return jvmPackageName_.size(); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public java.lang.String getJvmPackageName(int index) { + return jvmPackageName_.get(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getJvmPackageNameBytes(int index) { + return jvmPackageName_.getByteString(index); + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder setJvmPackageName( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.set(index, value); + + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addJvmPackageName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.add(value); + + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addAllJvmPackageName( + java.lang.Iterable values) { + ensureJvmPackageNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, jvmPackageName_); + + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder clearJvmPackageName() { + jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + + return this; + } + /** + * repeated string jvm_package_name = 3; + * + *
+       * Values of @JvmPackageName annotation used in this module; can be referenced in PackageParts#class_with_jvm_package_name_package_id.
+       * The names here are dot-separated, e.g. "org.foo.bar"
+       * 
+ */ + public Builder addJvmPackageNameBytes( + org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureJvmPackageNameIsMutable(); + jvmPackageName_.add(value); + + return this; + } + // @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.PackageTable) } @@ -902,109 +1170,189 @@ public final class JvmPackageTable { getPackageFqNameBytes(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList(); + getShortClassNameList(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - int getClassNameCount(); + int getShortClassNameCount(); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - java.lang.String getClassName(int index); + java.lang.String getShortClassName(int index); /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index); + getShortClassNameBytes(int index); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - java.util.List getMultifileFacadeIdList(); + java.util.List getMultifileFacadeShortNameIdList(); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - int getMultifileFacadeIdCount(); + int getMultifileFacadeShortNameIdCount(); /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - int getMultifileFacadeId(int index); + int getMultifileFacadeShortNameId(int index); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList(); + getMultifileFacadeShortNameList(); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - int getMultifileFacadeNameCount(); + int getMultifileFacadeShortNameCount(); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - java.lang.String getMultifileFacadeName(int index); + java.lang.String getMultifileFacadeShortName(int index); /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index); + getMultifileFacadeShortNameBytes(int index); + + /** + * 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.
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList(); + /** + * 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.
+     * 
+ */ + int getClassWithJvmPackageNameShortNameCount(); + /** + * 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.
+     * 
+ */ + java.lang.String getClassWithJvmPackageNameShortName(int index); + /** + * 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.
+     * 
+ */ + org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index); + + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + java.util.List getClassWithJvmPackageNamePackageIdList(); + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + int getClassWithJvmPackageNamePackageIdCount(); + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + int getClassWithJvmPackageNamePackageId(int index); } /** * Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.PackageParts} @@ -1065,29 +1413,29 @@ public final class JvmPackageTable { case 18: { org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + shortClassName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000002; } - className_.add(bs); + shortClassName_.add(bs); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = new java.util.ArrayList(); + multifileFacadeShortNameId_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } - multifileFacadeId_.add(input.readInt32()); + multifileFacadeShortNameId_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { - multifileFacadeId_ = new java.util.ArrayList(); + multifileFacadeShortNameId_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { - multifileFacadeId_.add(input.readInt32()); + multifileFacadeShortNameId_.add(input.readInt32()); } input.popLimit(limit); break; @@ -1095,10 +1443,40 @@ public final class JvmPackageTable { case 34: { org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + multifileFacadeShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000008; } - multifileFacadeName_.add(bs); + multifileFacadeShortName_.add(bs); + break; + } + case 42: { + org.jetbrains.kotlin.protobuf.ByteString bs = input.readBytes(); + if (!((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000010; + } + classWithJvmPackageNameShortName_.add(bs); + break; + } + case 48: { + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + classWithJvmPackageNamePackageId_.add(input.readInt32()); + break; + } + case 50: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000020) == 0x00000020) && input.getBytesUntilLimit() > 0) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000020; + } + while (input.getBytesUntilLimit() > 0) { + classWithJvmPackageNamePackageId_.add(input.readInt32()); + } + input.popLimit(limit); break; } } @@ -1110,13 +1488,19 @@ public final class JvmPackageTable { e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { - className_ = className_.getUnmodifiableView(); + shortClassName_ = shortClassName_.getUnmodifiableView(); } if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_); + multifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); } if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView(); + multifileFacadeShortName_ = multifileFacadeShortName_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); } try { unknownFieldsCodedOutput.flush(); @@ -1186,146 +1570,248 @@ public final class JvmPackageTable { } } - public static final int CLASS_NAME_FIELD_NUMBER = 2; - private org.jetbrains.kotlin.protobuf.LazyStringList className_; + public static final int SHORT_CLASS_NAME_FIELD_NUMBER = 2; + private org.jetbrains.kotlin.protobuf.LazyStringList shortClassName_; /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList() { - return className_; + getShortClassNameList() { + return shortClassName_; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - public int getClassNameCount() { - return className_.size(); + public int getShortClassNameCount() { + return shortClassName_.size(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ - public java.lang.String getClassName(int index) { - return className_.get(index); + public java.lang.String getShortClassName(int index) { + return shortClassName_.get(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
      * 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)
+     * (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.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index) { - return className_.getByteString(index); + getShortClassNameBytes(int index) { + return shortClassName_.getByteString(index); } - public static final int MULTIFILE_FACADE_ID_FIELD_NUMBER = 3; - private java.util.List multifileFacadeId_; + public static final int MULTIFILE_FACADE_SHORT_NAME_ID_FIELD_NUMBER = 3; + private java.util.List multifileFacadeShortNameId_; /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ public java.util.List - getMultifileFacadeIdList() { - return multifileFacadeId_; + getMultifileFacadeShortNameIdList() { + return multifileFacadeShortNameId_; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - public int getMultifileFacadeIdCount() { - return multifileFacadeId_.size(); + public int getMultifileFacadeShortNameIdCount() { + return multifileFacadeShortNameId_.size(); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-     * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+     * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
      * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
      * 
*/ - public int getMultifileFacadeId(int index) { - return multifileFacadeId_.get(index); + public int getMultifileFacadeShortNameId(int index) { + return multifileFacadeShortNameId_.get(index); } - private int multifileFacadeIdMemoizedSerializedSize = -1; + private int multifileFacadeShortNameIdMemoizedSerializedSize = -1; - public static final int MULTIFILE_FACADE_NAME_FIELD_NUMBER = 4; - private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_; + public static final int MULTIFILE_FACADE_SHORT_NAME_FIELD_NUMBER = 4; + private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeShortName_; /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList() { - return multifileFacadeName_; + getMultifileFacadeShortNameList() { + return multifileFacadeShortName_; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - public int getMultifileFacadeNameCount() { - return multifileFacadeName_.size(); + public int getMultifileFacadeShortNameCount() { + return multifileFacadeShortName_.size(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ - public java.lang.String getMultifileFacadeName(int index) { - return multifileFacadeName_.get(index); + public java.lang.String getMultifileFacadeShortName(int index) { + return multifileFacadeShortName_.get(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-     * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+     * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
      * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index) { - return multifileFacadeName_.getByteString(index); + getMultifileFacadeShortNameBytes(int index) { + return multifileFacadeShortName_.getByteString(index); } + public static final int CLASS_WITH_JVM_PACKAGE_NAME_SHORT_NAME_FIELD_NUMBER = 5; + private org.jetbrains.kotlin.protobuf.LazyStringList classWithJvmPackageNameShortName_; + /** + * 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.
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList() { + return classWithJvmPackageNameShortName_; + } + /** + * 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.
+     * 
+ */ + public int getClassWithJvmPackageNameShortNameCount() { + return classWithJvmPackageNameShortName_.size(); + } + /** + * 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.
+     * 
+ */ + public java.lang.String getClassWithJvmPackageNameShortName(int index) { + return classWithJvmPackageNameShortName_.get(index); + } + /** + * 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.
+     * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index) { + return classWithJvmPackageNameShortName_.getByteString(index); + } + + public static final int CLASS_WITH_JVM_PACKAGE_NAME_PACKAGE_ID_FIELD_NUMBER = 6; + private java.util.List classWithJvmPackageNamePackageId_; + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public java.util.List + getClassWithJvmPackageNamePackageIdList() { + return classWithJvmPackageNamePackageId_; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public int getClassWithJvmPackageNamePackageIdCount() { + return classWithJvmPackageNamePackageId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+     * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+     * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+     * when a bunch of files from the same Kotlin package have the same JVM package name.
+     * 
+ */ + public int getClassWithJvmPackageNamePackageId(int index) { + return classWithJvmPackageNamePackageId_.get(index); + } + private int classWithJvmPackageNamePackageIdMemoizedSerializedSize = -1; + private void initFields() { packageFqName_ = ""; - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - multifileFacadeId_ = java.util.Collections.emptyList(); - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { @@ -1347,18 +1833,28 @@ public final class JvmPackageTable { if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getPackageFqNameBytes()); } - for (int i = 0; i < className_.size(); i++) { - output.writeBytes(2, className_.getByteString(i)); + for (int i = 0; i < shortClassName_.size(); i++) { + output.writeBytes(2, shortClassName_.getByteString(i)); } - if (getMultifileFacadeIdList().size() > 0) { + if (getMultifileFacadeShortNameIdList().size() > 0) { output.writeRawVarint32(26); - output.writeRawVarint32(multifileFacadeIdMemoizedSerializedSize); + output.writeRawVarint32(multifileFacadeShortNameIdMemoizedSerializedSize); } - for (int i = 0; i < multifileFacadeId_.size(); i++) { - output.writeInt32NoTag(multifileFacadeId_.get(i)); + for (int i = 0; i < multifileFacadeShortNameId_.size(); i++) { + output.writeInt32NoTag(multifileFacadeShortNameId_.get(i)); } - for (int i = 0; i < multifileFacadeName_.size(); i++) { - output.writeBytes(4, multifileFacadeName_.getByteString(i)); + for (int i = 0; i < multifileFacadeShortName_.size(); i++) { + output.writeBytes(4, multifileFacadeShortName_.getByteString(i)); + } + for (int i = 0; i < classWithJvmPackageNameShortName_.size(); i++) { + output.writeBytes(5, classWithJvmPackageNameShortName_.getByteString(i)); + } + if (getClassWithJvmPackageNamePackageIdList().size() > 0) { + output.writeRawVarint32(50); + output.writeRawVarint32(classWithJvmPackageNamePackageIdMemoizedSerializedSize); + } + for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { + output.writeInt32NoTag(classWithJvmPackageNamePackageId_.get(i)); } output.writeRawBytes(unknownFields); } @@ -1375,35 +1871,58 @@ public final class JvmPackageTable { } { int dataSize = 0; - for (int i = 0; i < className_.size(); i++) { + for (int i = 0; i < shortClassName_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeBytesSizeNoTag(className_.getByteString(i)); + .computeBytesSizeNoTag(shortClassName_.getByteString(i)); } size += dataSize; - size += 1 * getClassNameList().size(); + size += 1 * getShortClassNameList().size(); } { int dataSize = 0; - for (int i = 0; i < multifileFacadeId_.size(); i++) { + for (int i = 0; i < multifileFacadeShortNameId_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeInt32SizeNoTag(multifileFacadeId_.get(i)); + .computeInt32SizeNoTag(multifileFacadeShortNameId_.get(i)); } size += dataSize; - if (!getMultifileFacadeIdList().isEmpty()) { + if (!getMultifileFacadeShortNameIdList().isEmpty()) { size += 1; size += org.jetbrains.kotlin.protobuf.CodedOutputStream .computeInt32SizeNoTag(dataSize); } - multifileFacadeIdMemoizedSerializedSize = dataSize; + multifileFacadeShortNameIdMemoizedSerializedSize = dataSize; } { int dataSize = 0; - for (int i = 0; i < multifileFacadeName_.size(); i++) { + for (int i = 0; i < multifileFacadeShortName_.size(); i++) { dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream - .computeBytesSizeNoTag(multifileFacadeName_.getByteString(i)); + .computeBytesSizeNoTag(multifileFacadeShortName_.getByteString(i)); } size += dataSize; - size += 1 * getMultifileFacadeNameList().size(); + size += 1 * getMultifileFacadeShortNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNameShortName_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeBytesSizeNoTag(classWithJvmPackageNameShortName_.getByteString(i)); + } + size += dataSize; + size += 1 * getClassWithJvmPackageNameShortNameList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < classWithJvmPackageNamePackageId_.size(); i++) { + dataSize += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(classWithJvmPackageNamePackageId_.get(i)); + } + size += dataSize; + if (!getClassWithJvmPackageNamePackageIdList().isEmpty()) { + size += 1; + size += org.jetbrains.kotlin.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + classWithJvmPackageNamePackageIdMemoizedSerializedSize = dataSize; } size += unknownFields.size(); memoizedSerializedSize = size; @@ -1501,12 +2020,16 @@ public final class JvmPackageTable { super.clear(); packageFqName_ = ""; bitField0_ = (bitField0_ & ~0x00000001); - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); - multifileFacadeId_ = java.util.Collections.emptyList(); + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); return this; } @@ -1535,20 +2058,30 @@ public final class JvmPackageTable { } result.packageFqName_ = packageFqName_; if (((bitField0_ & 0x00000002) == 0x00000002)) { - className_ = className_.getUnmodifiableView(); + shortClassName_ = shortClassName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000002); } - result.className_ = className_; + result.shortClassName_ = shortClassName_; if (((bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = java.util.Collections.unmodifiableList(multifileFacadeId_); + multifileFacadeShortNameId_ = java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); bitField0_ = (bitField0_ & ~0x00000004); } - result.multifileFacadeId_ = multifileFacadeId_; + result.multifileFacadeShortNameId_ = multifileFacadeShortNameId_; if (((bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = multifileFacadeName_.getUnmodifiableView(); + multifileFacadeShortName_ = multifileFacadeShortName_.getUnmodifiableView(); bitField0_ = (bitField0_ & ~0x00000008); } - result.multifileFacadeName_ = multifileFacadeName_; + result.multifileFacadeShortName_ = multifileFacadeShortName_; + if (((bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.classWithJvmPackageNameShortName_ = classWithJvmPackageNameShortName_; + if (((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.classWithJvmPackageNamePackageId_ = classWithJvmPackageNamePackageId_; result.bitField0_ = to_bitField0_; return result; } @@ -1560,33 +2093,53 @@ public final class JvmPackageTable { packageFqName_ = other.packageFqName_; } - if (!other.className_.isEmpty()) { - if (className_.isEmpty()) { - className_ = other.className_; + if (!other.shortClassName_.isEmpty()) { + if (shortClassName_.isEmpty()) { + shortClassName_ = other.shortClassName_; bitField0_ = (bitField0_ & ~0x00000002); } else { - ensureClassNameIsMutable(); - className_.addAll(other.className_); + ensureShortClassNameIsMutable(); + shortClassName_.addAll(other.shortClassName_); } } - if (!other.multifileFacadeId_.isEmpty()) { - if (multifileFacadeId_.isEmpty()) { - multifileFacadeId_ = other.multifileFacadeId_; + if (!other.multifileFacadeShortNameId_.isEmpty()) { + if (multifileFacadeShortNameId_.isEmpty()) { + multifileFacadeShortNameId_ = other.multifileFacadeShortNameId_; bitField0_ = (bitField0_ & ~0x00000004); } else { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.addAll(other.multifileFacadeId_); + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.addAll(other.multifileFacadeShortNameId_); } } - if (!other.multifileFacadeName_.isEmpty()) { - if (multifileFacadeName_.isEmpty()) { - multifileFacadeName_ = other.multifileFacadeName_; + if (!other.multifileFacadeShortName_.isEmpty()) { + if (multifileFacadeShortName_.isEmpty()) { + multifileFacadeShortName_ = other.multifileFacadeShortName_; bitField0_ = (bitField0_ & ~0x00000008); } else { - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.addAll(other.multifileFacadeName_); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.addAll(other.multifileFacadeShortName_); + } + + } + if (!other.classWithJvmPackageNameShortName_.isEmpty()) { + if (classWithJvmPackageNameShortName_.isEmpty()) { + classWithJvmPackageNameShortName_ = other.classWithJvmPackageNameShortName_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.addAll(other.classWithJvmPackageNameShortName_); + } + + } + if (!other.classWithJvmPackageNamePackageId_.isEmpty()) { + if (classWithJvmPackageNamePackageId_.isEmpty()) { + classWithJvmPackageNamePackageId_ = other.classWithJvmPackageNamePackageId_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.addAll(other.classWithJvmPackageNamePackageId_); } } @@ -1698,377 +2251,646 @@ public final class JvmPackageTable { return this; } - private org.jetbrains.kotlin.protobuf.LazyStringList className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - private void ensureClassNameIsMutable() { + private org.jetbrains.kotlin.protobuf.LazyStringList shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureShortClassNameIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { - className_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(className_); + shortClassName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(shortClassName_); bitField0_ |= 0x00000002; } } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getClassNameList() { - return className_.getUnmodifiableView(); + getShortClassNameList() { + return shortClassName_.getUnmodifiableView(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public int getClassNameCount() { - return className_.size(); + public int getShortClassNameCount() { + return shortClassName_.size(); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public java.lang.String getClassName(int index) { - return className_.get(index); + public java.lang.String getShortClassName(int index) { + return shortClassName_.get(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getClassNameBytes(int index) { - return className_.getByteString(index); + getShortClassNameBytes(int index) { + return shortClassName_.getByteString(index); } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder setClassName( + public Builder setShortClassName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.set(index, value); + ensureShortClassNameIsMutable(); + shortClassName_.set(index, value); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addClassName( + public Builder addShortClassName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.add(value); + ensureShortClassNameIsMutable(); + shortClassName_.add(value); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addAllClassName( + public Builder addAllShortClassName( java.lang.Iterable values) { - ensureClassNameIsMutable(); + ensureShortClassNameIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, className_); + values, shortClassName_); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder clearClassName() { - className_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + public Builder clearShortClassName() { + shortClassName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); return this; } /** - * repeated string class_name = 2; + * repeated string short_class_name = 2; * *
        * 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)
+       * (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.
        * 
*/ - public Builder addClassNameBytes( + public Builder addShortClassNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureClassNameIsMutable(); - className_.add(value); + ensureShortClassNameIsMutable(); + shortClassName_.add(value); return this; } - private java.util.List multifileFacadeId_ = java.util.Collections.emptyList(); - private void ensureMultifileFacadeIdIsMutable() { + private java.util.List multifileFacadeShortNameId_ = java.util.Collections.emptyList(); + private void ensureMultifileFacadeShortNameIdIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { - multifileFacadeId_ = new java.util.ArrayList(multifileFacadeId_); + multifileFacadeShortNameId_ = new java.util.ArrayList(multifileFacadeShortNameId_); bitField0_ |= 0x00000004; } } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ public java.util.List - getMultifileFacadeIdList() { - return java.util.Collections.unmodifiableList(multifileFacadeId_); + getMultifileFacadeShortNameIdList() { + return java.util.Collections.unmodifiableList(multifileFacadeShortNameId_); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public int getMultifileFacadeIdCount() { - return multifileFacadeId_.size(); + public int getMultifileFacadeShortNameIdCount() { + return multifileFacadeShortNameId_.size(); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public int getMultifileFacadeId(int index) { - return multifileFacadeId_.get(index); + public int getMultifileFacadeShortNameId(int index) { + return multifileFacadeShortNameId_.get(index); } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder setMultifileFacadeId( + public Builder setMultifileFacadeShortNameId( int index, int value) { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.set(index, value); + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.set(index, value); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder addMultifileFacadeId(int value) { - ensureMultifileFacadeIdIsMutable(); - multifileFacadeId_.add(value); + public Builder addMultifileFacadeShortNameId(int value) { + ensureMultifileFacadeShortNameIdIsMutable(); + multifileFacadeShortNameId_.add(value); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder addAllMultifileFacadeId( + public Builder addAllMultifileFacadeShortNameId( java.lang.Iterable values) { - ensureMultifileFacadeIdIsMutable(); + ensureMultifileFacadeShortNameIdIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, multifileFacadeId_); + values, multifileFacadeShortNameId_); return this; } /** - * repeated int32 multifile_facade_id = 3 [packed = true]; + * repeated int32 multifile_facade_short_name_id = 3 [packed = true]; * *
-       * For each class name listed above, index of the name of the corresponding multi-file facade class in multifile_facade_name + 1,
+       * For each name in short_class_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. If there's no value in this list at some index, the value is assumed to be 0.
        * (e.g. if there are no multi-file classes in the module, this list is not going to exist at all)
        * 
*/ - public Builder clearMultifileFacadeId() { - multifileFacadeId_ = java.util.Collections.emptyList(); + public Builder clearMultifileFacadeShortNameId() { + multifileFacadeShortNameId_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); return this; } - private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; - private void ensureMultifileFacadeNameIsMutable() { + private org.jetbrains.kotlin.protobuf.LazyStringList multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureMultifileFacadeShortNameIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { - multifileFacadeName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeName_); + multifileFacadeShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(multifileFacadeShortName_); bitField0_ |= 0x00000008; } } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ public org.jetbrains.kotlin.protobuf.ProtocolStringList - getMultifileFacadeNameList() { - return multifileFacadeName_.getUnmodifiableView(); + getMultifileFacadeShortNameList() { + return multifileFacadeShortName_.getUnmodifiableView(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public int getMultifileFacadeNameCount() { - return multifileFacadeName_.size(); + public int getMultifileFacadeShortNameCount() { + return multifileFacadeShortName_.size(); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public java.lang.String getMultifileFacadeName(int index) { - return multifileFacadeName_.get(index); + public java.lang.String getMultifileFacadeShortName(int index) { + return multifileFacadeShortName_.get(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ public org.jetbrains.kotlin.protobuf.ByteString - getMultifileFacadeNameBytes(int index) { - return multifileFacadeName_.getByteString(index); + getMultifileFacadeShortNameBytes(int index) { + return multifileFacadeShortName_.getByteString(index); } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder setMultifileFacadeName( + public Builder setMultifileFacadeShortName( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.set(index, value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.set(index, value); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addMultifileFacadeName( + public Builder addMultifileFacadeShortName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.add(value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.add(value); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addAllMultifileFacadeName( + public Builder addAllMultifileFacadeShortName( java.lang.Iterable values) { - ensureMultifileFacadeNameIsMutable(); + ensureMultifileFacadeShortNameIsMutable(); org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( - values, multifileFacadeName_); + values, multifileFacadeShortName_); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder clearMultifileFacadeName() { - multifileFacadeName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + public Builder clearMultifileFacadeShortName() { + multifileFacadeShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); return this; } /** - * repeated string multifile_facade_name = 4; + * repeated string multifile_facade_short_name = 4; * *
-       * Short names of multi-file facades, used in multifile_facade_id to store the part -> facade mapping.
+       * Short names of multi-file facades, used in multifile_facade_short_name_id to store the part -> facade mapping.
        * 
*/ - public Builder addMultifileFacadeNameBytes( + public Builder addMultifileFacadeShortNameBytes( org.jetbrains.kotlin.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } - ensureMultifileFacadeNameIsMutable(); - multifileFacadeName_.add(value); + ensureMultifileFacadeShortNameIsMutable(); + multifileFacadeShortName_.add(value); + + return this; + } + + private org.jetbrains.kotlin.protobuf.LazyStringList classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + private void ensureClassWithJvmPackageNameShortNameIsMutable() { + if (!((bitField0_ & 0x00000010) == 0x00000010)) { + classWithJvmPackageNameShortName_ = new org.jetbrains.kotlin.protobuf.LazyStringArrayList(classWithJvmPackageNameShortName_); + bitField0_ |= 0x00000010; + } + } + /** + * 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.
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ProtocolStringList + getClassWithJvmPackageNameShortNameList() { + return classWithJvmPackageNameShortName_.getUnmodifiableView(); + } + /** + * 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.
+       * 
+ */ + public int getClassWithJvmPackageNameShortNameCount() { + return classWithJvmPackageNameShortName_.size(); + } + /** + * 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.
+       * 
+ */ + public java.lang.String getClassWithJvmPackageNameShortName(int index) { + return classWithJvmPackageNameShortName_.get(index); + } + /** + * 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.
+       * 
+ */ + public org.jetbrains.kotlin.protobuf.ByteString + getClassWithJvmPackageNameShortNameBytes(int index) { + return classWithJvmPackageNameShortName_.getByteString(index); + } + /** + * 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.
+       * 
+ */ + public Builder setClassWithJvmPackageNameShortName( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.set(index, value); + + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addClassWithJvmPackageNameShortName( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.add(value); + + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNameShortName( + java.lang.Iterable values) { + ensureClassWithJvmPackageNameShortNameIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNameShortName_); + + return this; + } + /** + * 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.
+       * 
+ */ + public Builder clearClassWithJvmPackageNameShortName() { + classWithJvmPackageNameShortName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + + return this; + } + /** + * 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.
+       * 
+ */ + public Builder addClassWithJvmPackageNameShortNameBytes( + org.jetbrains.kotlin.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + ensureClassWithJvmPackageNameShortNameIsMutable(); + classWithJvmPackageNameShortName_.add(value); + + return this; + } + + private java.util.List classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + private void ensureClassWithJvmPackageNamePackageIdIsMutable() { + if (!((bitField0_ & 0x00000020) == 0x00000020)) { + classWithJvmPackageNamePackageId_ = new java.util.ArrayList(classWithJvmPackageNamePackageId_); + bitField0_ |= 0x00000020; + } + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public java.util.List + getClassWithJvmPackageNamePackageIdList() { + return java.util.Collections.unmodifiableList(classWithJvmPackageNamePackageId_); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public int getClassWithJvmPackageNamePackageIdCount() { + return classWithJvmPackageNamePackageId_.size(); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public int getClassWithJvmPackageNamePackageId(int index) { + return classWithJvmPackageNamePackageId_.get(index); + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder setClassWithJvmPackageNamePackageId( + int index, int value) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.set(index, value); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder addClassWithJvmPackageNamePackageId(int value) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + classWithJvmPackageNamePackageId_.add(value); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder addAllClassWithJvmPackageNamePackageId( + java.lang.Iterable values) { + ensureClassWithJvmPackageNamePackageIdIsMutable(); + org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll( + values, classWithJvmPackageNamePackageId_); + + return this; + } + /** + * repeated int32 class_with_jvm_package_name_package_id = 6 [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.
+       * If there's no value in this list at some index other than 0, the value is assumed to be the same as the value of the last element
+       * of this list. The intended use case for this optimization is to have just a list of a single element in the most frequent case
+       * when a bunch of files from the same Kotlin package have the same JVM package name.
+       * 
+ */ + public Builder clearClassWithJvmPackageNamePackageId() { + classWithJvmPackageNamePackageId_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); return this; } diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/PackagePartProvider.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/PackagePartProvider.kt index a28671fac77..10b7203dd5d 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/PackagePartProvider.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/PackagePartProvider.kt @@ -18,10 +18,11 @@ package org.jetbrains.kotlin.descriptors interface PackagePartProvider { /** - * @return simple names of package parts existing in the package with the given FQ name. + * @return JVM internal names of package parts existing in the package with the given FQ name. * * For example, if a file named foo.kt in package org.test is compiled to a library, PackagePartProvider for such library - * must return the list `["FooKt"]` for the query `"org.test"` (in case the file is not annotated with @JvmName or @JvmMultifile*) + * must return the list `["org/test/FooKt"]` for the query `"org.test"` + * (in case the file is not annotated with @JvmName, @JvmPackageName or @JvmMultifileClass). */ fun findPackageParts(packageFqName: String): List diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/vfilefinder/KotlinModuleMappingIndex.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/vfilefinder/KotlinModuleMappingIndex.kt index 72295059c59..dcafc318444 100644 --- a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/vfilefinder/KotlinModuleMappingIndex.kt +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/vfilefinder/KotlinModuleMappingIndex.kt @@ -43,9 +43,9 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension( private val VALUE_EXTERNALIZER = object : DataExternalizer { override fun read(input: DataInput): PackageParts? = PackageParts(IOUtil.readUTF(input)).apply { - val shortPartNames = IOUtil.readStringList(input) - val shortFacadeNames = IOUtil.readStringList(input) - for ((partName, facadeName) in shortPartNames zip shortFacadeNames) { + val partInternalNames = IOUtil.readStringList(input) + val facadeInternalNames = IOUtil.readStringList(input) + for ((partName, facadeName) in partInternalNames zip facadeInternalNames) { addPart(partName, if (facadeName.isNotEmpty()) facadeName else null) } IOUtil.readStringList(input).forEach(this::addMetadataPart) @@ -67,11 +67,10 @@ object KotlinModuleMappingIndex : FileBasedIndexExtension( override fun getValueExternalizer() = VALUE_EXTERNALIZER - override fun getInputFilter(): FileBasedIndex.InputFilter { - return FileBasedIndex.InputFilter { file -> file.extension == ModuleMapping.MAPPING_FILE_EXT } - } + override fun getInputFilter(): FileBasedIndex.InputFilter = + FileBasedIndex.InputFilter { file -> file.extension == ModuleMapping.MAPPING_FILE_EXT } - override fun getVersion(): Int = 4 + override fun getVersion(): Int = 5 override fun getIndexer(): DataIndexer { return DataIndexer { inputData ->