Write/read module annotation FQ names to/from metadata on JVM
#KT-22759 In Progress
This commit is contained in:
+899
-13
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@ package org.jetbrains.kotlin.codegen;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import kotlin.Pair;
|
||||
import kotlin.collections.CollectionsKt;
|
||||
import kotlin.io.FilesKt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -26,13 +27,22 @@ import org.jetbrains.annotations.TestOnly;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFile;
|
||||
import org.jetbrains.kotlin.backend.common.output.OutputFileCollection;
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState;
|
||||
import org.jetbrains.kotlin.config.AnalysisFlag;
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.kotlin.descriptors.DescriptorUtilKt;
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.kotlin.incremental.components.NoLookupLocation;
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleMapping;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackagePartClassUtils;
|
||||
import org.jetbrains.kotlin.load.kotlin.PackageParts;
|
||||
import org.jetbrains.kotlin.name.ClassId;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.psi.KtFile;
|
||||
import org.jetbrains.kotlin.resolve.CompilerDeserializationConfiguration;
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt;
|
||||
import org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin;
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
import org.jetbrains.kotlin.serialization.StringTableImpl;
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf;
|
||||
import org.jetbrains.org.objectweb.asm.Type;
|
||||
|
||||
@@ -102,12 +112,18 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
part.addTo(builder);
|
||||
}
|
||||
|
||||
if (builder.getPackagePartsCount() == 0) return;
|
||||
List<String> experimental = state.getLanguageVersionSettings().getFlag(AnalysisFlag.getExperimental());
|
||||
if (!experimental.isEmpty()) {
|
||||
writeExperimentalMarkers(state.getModule(), builder, experimental);
|
||||
}
|
||||
|
||||
JvmModuleProtoBuf.Module moduleProto = builder.build();
|
||||
if (moduleProto.getSerializedSize() == 0) return;
|
||||
|
||||
generators.put(outputFilePath, new OutAndSourceFileList(CollectionsKt.toList(packagePartSourceFiles)) {
|
||||
@Override
|
||||
public byte[] asBytes(ClassBuilderFactory factory) {
|
||||
return ClassFileUtilsKt.serializeToByteArray(builder);
|
||||
return ClassFileUtilsKt.serializeToByteArray(moduleProto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,6 +138,29 @@ public class ClassFileFactory implements OutputFileCollection {
|
||||
});
|
||||
}
|
||||
|
||||
private static void writeExperimentalMarkers(
|
||||
@NotNull ModuleDescriptor module,
|
||||
@NotNull JvmModuleProtoBuf.Module.Builder builder,
|
||||
@NotNull List<String> experimental
|
||||
) {
|
||||
StringTableImpl stringTable = new StringTableImpl();
|
||||
for (String fqName : experimental) {
|
||||
ClassDescriptor descriptor =
|
||||
DescriptorUtilKt.resolveClassByFqName(module, new FqName(fqName), NoLookupLocation.FOR_ALREADY_TRACKED);
|
||||
if (descriptor != null) {
|
||||
ProtoBuf.Annotation.Builder annotation = ProtoBuf.Annotation.newBuilder();
|
||||
ClassId classId = DescriptorUtilsKt.getClassId(descriptor);
|
||||
if (classId != null) {
|
||||
annotation.setId(stringTable.getClassIdIndex(classId));
|
||||
builder.addAnnotation(annotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Pair<ProtoBuf.StringTable, ProtoBuf.QualifiedNameTable> tables = stringTable.buildProto();
|
||||
builder.setStringTable(tables.getFirst());
|
||||
builder.setQualifiedNameTable(tables.getSecond());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<OutputFile> asList() {
|
||||
|
||||
@@ -57,7 +57,7 @@ private fun Iterable<PackageParts>.addCompiledParts(state: GenerationState): Lis
|
||||
}
|
||||
}
|
||||
|
||||
fun JvmModuleProtoBuf.Module.Builder.serializeToByteArray(): ByteArray {
|
||||
fun JvmModuleProtoBuf.Module.serializeToByteArray(): ByteArray {
|
||||
val moduleMapping = ByteArrayOutputStream(4096)
|
||||
val out = DataOutputStream(moduleMapping)
|
||||
val version = JvmMetadataVersion.INSTANCE.toArray()
|
||||
@@ -65,7 +65,7 @@ fun JvmModuleProtoBuf.Module.Builder.serializeToByteArray(): ByteArray {
|
||||
for (number in version) {
|
||||
out.writeInt(number)
|
||||
}
|
||||
build().writeTo(out)
|
||||
writeTo(out)
|
||||
out.flush()
|
||||
return moduleMapping.toByteArray()
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ open class MetadataSerializer(private val dependOnOldBuiltIns: Boolean) {
|
||||
for (table in packageTable.values) {
|
||||
table.addTo(this)
|
||||
}
|
||||
}.serializeToByteArray()
|
||||
}.build().serializeToByteArray()
|
||||
|
||||
kotlinModuleFile.parentFile.mkdirs()
|
||||
kotlinModuleFile.writeBytes(packageTableBytes)
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package org.foo
|
||||
|
||||
@Experimental
|
||||
annotation class A
|
||||
|
||||
class B {
|
||||
@Experimental
|
||||
annotation class C
|
||||
}
|
||||
|
||||
@Experimental(Experimental.Level.ERROR, [Experimental.Impact.COMPILATION])
|
||||
annotation class D
|
||||
@@ -0,0 +1,2 @@
|
||||
@org/foo/A
|
||||
@org/foo/B.C
|
||||
@@ -31,7 +31,8 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
private fun doTest(
|
||||
relativeDirectory: String,
|
||||
compileWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE
|
||||
loadWith: LanguageVersion = LanguageVersion.LATEST_STABLE,
|
||||
extraOptions: List<String> = emptyList()
|
||||
) {
|
||||
val directory = KotlinTestUtils.getTestDataPathBase() + relativeDirectory
|
||||
val tmpdir = KotlinTestUtils.tmpDir(this::class.simpleName)
|
||||
@@ -42,7 +43,7 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
"-d", tmpdir.path,
|
||||
"-module-name", moduleName,
|
||||
"-language-version", compileWith.versionString
|
||||
))
|
||||
) + extraOptions)
|
||||
|
||||
val mapping = ModuleMapping.create(
|
||||
File(tmpdir, "META-INF/$moduleName.${ModuleMapping.MAPPING_FILE_EXT}").readBytes(), "test",
|
||||
@@ -51,6 +52,9 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
)
|
||||
)
|
||||
val result = buildString {
|
||||
for (annotationClassId in mapping.moduleData.annotations) {
|
||||
appendln("@${annotationClassId.asString()}")
|
||||
}
|
||||
for ((fqName, packageParts) in mapping.packageFqName2Parts) {
|
||||
appendln(fqName)
|
||||
for (part in packageParts.parts) {
|
||||
@@ -88,4 +92,17 @@ class JvmModuleProtoBufTest : KtUsefulTestCase() {
|
||||
doTest("/moduleProtoBuf/jvmPackageNameLanguageVersion11",
|
||||
compileWith = LanguageVersion.KOTLIN_1_2, loadWith = LanguageVersion.KOTLIN_1_1)
|
||||
}
|
||||
|
||||
fun testExperimental() {
|
||||
doTest(
|
||||
"/moduleProtoBuf/experimental", extraOptions = listOf(
|
||||
"-Xskip-runtime-version-check",
|
||||
"-language-version",
|
||||
"1.3",
|
||||
"-Xexperimental=org.foo.A",
|
||||
"-Xexperimental=org.foo.B.C",
|
||||
"-Xuse-experimental=org.foo.D"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.serialization.jvm;
|
||||
|
||||
import "core/deserialization/src/descriptors.proto";
|
||||
|
||||
option java_outer_classname = "JvmModuleProtoBuf";
|
||||
option optimize_for = LITE_RUNTIME;
|
||||
|
||||
@@ -29,6 +31,13 @@ message Module {
|
||||
// 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;
|
||||
|
||||
optional StringTable string_table = 4;
|
||||
|
||||
optional QualifiedNameTable qualified_name_table = 5;
|
||||
|
||||
// Annotations on the whole module
|
||||
repeated Annotation annotation = 6;
|
||||
}
|
||||
|
||||
message PackageParts {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.load.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.name.ClassId
|
||||
|
||||
class BinaryModuleData(val annotations: List<ClassId>)
|
||||
@@ -20,14 +20,16 @@ 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.deserialization.NameResolverImpl
|
||||
import org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf
|
||||
import java.io.ByteArrayInputStream
|
||||
import java.io.DataInputStream
|
||||
import java.io.IOException
|
||||
|
||||
class ModuleMapping private constructor(
|
||||
val packageFqName2Parts: Map<String, PackageParts>,
|
||||
private val debugName: String
|
||||
val packageFqName2Parts: Map<String, PackageParts>,
|
||||
val moduleData: BinaryModuleData,
|
||||
private val debugName: String
|
||||
) {
|
||||
fun findPackageParts(packageFqName: String): PackageParts? {
|
||||
return packageFqName2Parts[packageFqName]
|
||||
@@ -40,10 +42,10 @@ class ModuleMapping private constructor(
|
||||
val MAPPING_FILE_EXT: String = "kotlin_module"
|
||||
|
||||
@JvmField
|
||||
val EMPTY: ModuleMapping = ModuleMapping(emptyMap(), "EMPTY")
|
||||
val EMPTY: ModuleMapping = ModuleMapping(emptyMap(), BinaryModuleData(emptyList()), "EMPTY")
|
||||
|
||||
@JvmField
|
||||
val CORRUPTED: ModuleMapping = ModuleMapping(emptyMap(), "CORRUPTED")
|
||||
val CORRUPTED: ModuleMapping = ModuleMapping(emptyMap(), BinaryModuleData(emptyList()), "CORRUPTED")
|
||||
|
||||
fun create(
|
||||
bytes: ByteArray?,
|
||||
@@ -96,9 +98,12 @@ class ModuleMapping private constructor(
|
||||
proto.shortClassNameList.forEach(packageParts::addMetadataPart)
|
||||
}
|
||||
|
||||
return ModuleMapping(result, debugName)
|
||||
}
|
||||
else {
|
||||
// TODO: read arguments of module annotations
|
||||
val nameResolver = NameResolverImpl(moduleProto.stringTable, moduleProto.qualifiedNameTable)
|
||||
val annotations = moduleProto.annotationList.map { proto -> nameResolver.getClassId(proto.id) }
|
||||
|
||||
return ModuleMapping(result, BinaryModuleData(annotations), debugName)
|
||||
} else {
|
||||
// TODO: consider reporting "incompatible ABI version" error for package parts
|
||||
}
|
||||
|
||||
|
||||
+545
@@ -102,6 +102,50 @@ public final class JvmModuleProtoBuf {
|
||||
*/
|
||||
org.jetbrains.kotlin.protobuf.ByteString
|
||||
getJvmPackageNameBytes(int index);
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
boolean hasStringTable();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.StringTable getStringTable();
|
||||
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
boolean hasQualifiedNameTable();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable getQualifiedNameTable();
|
||||
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>
|
||||
getAnnotationList();
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index);
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
int getAnnotationCount();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code org.jetbrains.kotlin.serialization.jvm.Module}
|
||||
@@ -178,6 +222,40 @@ public final class JvmModuleProtoBuf {
|
||||
jvmPackageName_.add(bs);
|
||||
break;
|
||||
}
|
||||
case 34: {
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
subBuilder = stringTable_.toBuilder();
|
||||
}
|
||||
stringTable_ = input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(stringTable_);
|
||||
stringTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000001;
|
||||
break;
|
||||
}
|
||||
case 42: {
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.Builder subBuilder = null;
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
subBuilder = qualifiedNameTable_.toBuilder();
|
||||
}
|
||||
qualifiedNameTable_ = input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.PARSER, extensionRegistry);
|
||||
if (subBuilder != null) {
|
||||
subBuilder.mergeFrom(qualifiedNameTable_);
|
||||
qualifiedNameTable_ = subBuilder.buildPartial();
|
||||
}
|
||||
bitField0_ |= 0x00000002;
|
||||
break;
|
||||
}
|
||||
case 50: {
|
||||
if (!((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>();
|
||||
mutable_bitField0_ |= 0x00000020;
|
||||
}
|
||||
annotation_.add(input.readMessage(org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.PARSER, extensionRegistry));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException e) {
|
||||
@@ -195,6 +273,9 @@ public final class JvmModuleProtoBuf {
|
||||
if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||
jvmPackageName_ = jvmPackageName_.getUnmodifiableView();
|
||||
}
|
||||
if (((mutable_bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
annotation_ = java.util.Collections.unmodifiableList(annotation_);
|
||||
}
|
||||
try {
|
||||
unknownFieldsCodedOutput.flush();
|
||||
} catch (java.io.IOException e) {
|
||||
@@ -220,6 +301,7 @@ public final class JvmModuleProtoBuf {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
private int bitField0_;
|
||||
public static final int PACKAGE_PARTS_FIELD_NUMBER = 1;
|
||||
private java.util.List<org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf.PackageParts> packageParts_;
|
||||
/**
|
||||
@@ -379,10 +461,98 @@ public final class JvmModuleProtoBuf {
|
||||
return jvmPackageName_.getByteString(index);
|
||||
}
|
||||
|
||||
public static final int STRING_TABLE_FIELD_NUMBER = 4;
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.StringTable stringTable_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public boolean hasStringTable() {
|
||||
return ((bitField0_ & 0x00000001) == 0x00000001);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.StringTable getStringTable() {
|
||||
return stringTable_;
|
||||
}
|
||||
|
||||
public static final int QUALIFIED_NAME_TABLE_FIELD_NUMBER = 5;
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable qualifiedNameTable_;
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public boolean hasQualifiedNameTable() {
|
||||
return ((bitField0_ & 0x00000002) == 0x00000002);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable getQualifiedNameTable() {
|
||||
return qualifiedNameTable_;
|
||||
}
|
||||
|
||||
public static final int ANNOTATION_FIELD_NUMBER = 6;
|
||||
private java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> annotation_;
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> getAnnotationList() {
|
||||
return annotation_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public java.util.List<? extends org.jetbrains.kotlin.serialization.ProtoBuf.AnnotationOrBuilder>
|
||||
getAnnotationOrBuilderList() {
|
||||
return annotation_;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public int getAnnotationCount() {
|
||||
return annotation_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index) {
|
||||
return annotation_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.AnnotationOrBuilder getAnnotationOrBuilder(
|
||||
int index) {
|
||||
return annotation_.get(index);
|
||||
}
|
||||
|
||||
private void initFields() {
|
||||
packageParts_ = java.util.Collections.emptyList();
|
||||
metadataParts_ = java.util.Collections.emptyList();
|
||||
jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
|
||||
stringTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.getDefaultInstance();
|
||||
qualifiedNameTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.getDefaultInstance();
|
||||
annotation_ = java.util.Collections.emptyList();
|
||||
}
|
||||
private byte memoizedIsInitialized = -1;
|
||||
public final boolean isInitialized() {
|
||||
@@ -402,6 +572,18 @@ public final class JvmModuleProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasQualifiedNameTable()) {
|
||||
if (!getQualifiedNameTable().isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < getAnnotationCount(); i++) {
|
||||
if (!getAnnotation(i).isInitialized()) {
|
||||
memoizedIsInitialized = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
@@ -418,6 +600,15 @@ public final class JvmModuleProtoBuf {
|
||||
for (int i = 0; i < jvmPackageName_.size(); i++) {
|
||||
output.writeBytes(3, jvmPackageName_.getByteString(i));
|
||||
}
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
output.writeMessage(4, stringTable_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
output.writeMessage(5, qualifiedNameTable_);
|
||||
}
|
||||
for (int i = 0; i < annotation_.size(); i++) {
|
||||
output.writeMessage(6, annotation_.get(i));
|
||||
}
|
||||
output.writeRawBytes(unknownFields);
|
||||
}
|
||||
|
||||
@@ -444,6 +635,18 @@ public final class JvmModuleProtoBuf {
|
||||
size += dataSize;
|
||||
size += 1 * getJvmPackageNameList().size();
|
||||
}
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(4, stringTable_);
|
||||
}
|
||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(5, qualifiedNameTable_);
|
||||
}
|
||||
for (int i = 0; i < annotation_.size(); i++) {
|
||||
size += org.jetbrains.kotlin.protobuf.CodedOutputStream
|
||||
.computeMessageSize(6, annotation_.get(i));
|
||||
}
|
||||
size += unknownFields.size();
|
||||
memoizedSerializedSize = size;
|
||||
return size;
|
||||
@@ -544,6 +747,12 @@ public final class JvmModuleProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000002);
|
||||
jvmPackageName_ = org.jetbrains.kotlin.protobuf.LazyStringArrayList.EMPTY;
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
stringTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.getDefaultInstance();
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
qualifiedNameTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.getDefaultInstance();
|
||||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
annotation_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -566,6 +775,7 @@ public final class JvmModuleProtoBuf {
|
||||
public org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf.Module buildPartial() {
|
||||
org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf.Module result = new org.jetbrains.kotlin.serialization.jvm.JvmModuleProtoBuf.Module(this);
|
||||
int from_bitField0_ = bitField0_;
|
||||
int to_bitField0_ = 0;
|
||||
if (((bitField0_ & 0x00000001) == 0x00000001)) {
|
||||
packageParts_ = java.util.Collections.unmodifiableList(packageParts_);
|
||||
bitField0_ = (bitField0_ & ~0x00000001);
|
||||
@@ -581,6 +791,20 @@ public final class JvmModuleProtoBuf {
|
||||
bitField0_ = (bitField0_ & ~0x00000004);
|
||||
}
|
||||
result.jvmPackageName_ = jvmPackageName_;
|
||||
if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
|
||||
to_bitField0_ |= 0x00000001;
|
||||
}
|
||||
result.stringTable_ = stringTable_;
|
||||
if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
|
||||
to_bitField0_ |= 0x00000002;
|
||||
}
|
||||
result.qualifiedNameTable_ = qualifiedNameTable_;
|
||||
if (((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
annotation_ = java.util.Collections.unmodifiableList(annotation_);
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
}
|
||||
result.annotation_ = annotation_;
|
||||
result.bitField0_ = to_bitField0_;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -615,6 +839,22 @@ public final class JvmModuleProtoBuf {
|
||||
jvmPackageName_.addAll(other.jvmPackageName_);
|
||||
}
|
||||
|
||||
}
|
||||
if (other.hasStringTable()) {
|
||||
mergeStringTable(other.getStringTable());
|
||||
}
|
||||
if (other.hasQualifiedNameTable()) {
|
||||
mergeQualifiedNameTable(other.getQualifiedNameTable());
|
||||
}
|
||||
if (!other.annotation_.isEmpty()) {
|
||||
if (annotation_.isEmpty()) {
|
||||
annotation_ = other.annotation_;
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
} else {
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.addAll(other.annotation_);
|
||||
}
|
||||
|
||||
}
|
||||
setUnknownFields(
|
||||
getUnknownFields().concat(other.unknownFields));
|
||||
@@ -634,6 +874,18 @@ public final class JvmModuleProtoBuf {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (hasQualifiedNameTable()) {
|
||||
if (!getQualifiedNameTable().isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < getAnnotationCount(); i++) {
|
||||
if (!getAnnotation(i).isInitialized()) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1140,6 +1392,299 @@ public final class JvmModuleProtoBuf {
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.StringTable stringTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.getDefaultInstance();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public boolean hasStringTable() {
|
||||
return ((bitField0_ & 0x00000008) == 0x00000008);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.StringTable getStringTable() {
|
||||
return stringTable_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public Builder setStringTable(org.jetbrains.kotlin.serialization.ProtoBuf.StringTable value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
stringTable_ = value;
|
||||
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public Builder setStringTable(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.Builder builderForValue) {
|
||||
stringTable_ = builderForValue.build();
|
||||
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public Builder mergeStringTable(org.jetbrains.kotlin.serialization.ProtoBuf.StringTable value) {
|
||||
if (((bitField0_ & 0x00000008) == 0x00000008) &&
|
||||
stringTable_ != org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.getDefaultInstance()) {
|
||||
stringTable_ =
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.newBuilder(stringTable_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
stringTable_ = value;
|
||||
}
|
||||
|
||||
bitField0_ |= 0x00000008;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.StringTable string_table = 4;</code>
|
||||
*/
|
||||
public Builder clearStringTable() {
|
||||
stringTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.StringTable.getDefaultInstance();
|
||||
|
||||
bitField0_ = (bitField0_ & ~0x00000008);
|
||||
return this;
|
||||
}
|
||||
|
||||
private org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable qualifiedNameTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.getDefaultInstance();
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public boolean hasQualifiedNameTable() {
|
||||
return ((bitField0_ & 0x00000010) == 0x00000010);
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable getQualifiedNameTable() {
|
||||
return qualifiedNameTable_;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public Builder setQualifiedNameTable(org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
qualifiedNameTable_ = value;
|
||||
|
||||
bitField0_ |= 0x00000010;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public Builder setQualifiedNameTable(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.Builder builderForValue) {
|
||||
qualifiedNameTable_ = builderForValue.build();
|
||||
|
||||
bitField0_ |= 0x00000010;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public Builder mergeQualifiedNameTable(org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable value) {
|
||||
if (((bitField0_ & 0x00000010) == 0x00000010) &&
|
||||
qualifiedNameTable_ != org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.getDefaultInstance()) {
|
||||
qualifiedNameTable_ =
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.newBuilder(qualifiedNameTable_).mergeFrom(value).buildPartial();
|
||||
} else {
|
||||
qualifiedNameTable_ = value;
|
||||
}
|
||||
|
||||
bitField0_ |= 0x00000010;
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>optional .org.jetbrains.kotlin.serialization.QualifiedNameTable qualified_name_table = 5;</code>
|
||||
*/
|
||||
public Builder clearQualifiedNameTable() {
|
||||
qualifiedNameTable_ = org.jetbrains.kotlin.serialization.ProtoBuf.QualifiedNameTable.getDefaultInstance();
|
||||
|
||||
bitField0_ = (bitField0_ & ~0x00000010);
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> annotation_ =
|
||||
java.util.Collections.emptyList();
|
||||
private void ensureAnnotationIsMutable() {
|
||||
if (!((bitField0_ & 0x00000020) == 0x00000020)) {
|
||||
annotation_ = new java.util.ArrayList<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation>(annotation_);
|
||||
bitField0_ |= 0x00000020;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public java.util.List<org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> getAnnotationList() {
|
||||
return java.util.Collections.unmodifiableList(annotation_);
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public int getAnnotationCount() {
|
||||
return annotation_.size();
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public org.jetbrains.kotlin.serialization.ProtoBuf.Annotation getAnnotation(int index) {
|
||||
return annotation_.get(index);
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setAnnotation(
|
||||
int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.set(index, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder setAnnotation(
|
||||
int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.set(index, builderForValue.build());
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAnnotation(org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.add(value);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAnnotation(
|
||||
int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.add(index, value);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAnnotation(
|
||||
org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.add(builderForValue.build());
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAnnotation(
|
||||
int index, org.jetbrains.kotlin.serialization.ProtoBuf.Annotation.Builder builderForValue) {
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.add(index, builderForValue.build());
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder addAllAnnotation(
|
||||
java.lang.Iterable<? extends org.jetbrains.kotlin.serialization.ProtoBuf.Annotation> values) {
|
||||
ensureAnnotationIsMutable();
|
||||
org.jetbrains.kotlin.protobuf.AbstractMessageLite.Builder.addAll(
|
||||
values, annotation_);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder clearAnnotation() {
|
||||
annotation_ = java.util.Collections.emptyList();
|
||||
bitField0_ = (bitField0_ & ~0x00000020);
|
||||
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>repeated .org.jetbrains.kotlin.serialization.Annotation annotation = 6;</code>
|
||||
*
|
||||
* <pre>
|
||||
* Annotations on the whole module
|
||||
* </pre>
|
||||
*/
|
||||
public Builder removeAnnotation(int index) {
|
||||
ensureAnnotationIsMutable();
|
||||
annotation_.remove(index);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:org.jetbrains.kotlin.serialization.jvm.Module)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user