From 2130297c75ae2f604d60f224b5481d285f66c05a Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Tue, 12 Aug 2025 23:00:19 +0200 Subject: [PATCH 1/5] Set up protobuf conformance tests: - Added runner exe - Added conformance protos and generated code - Fixed low-hanging gradle and protoc-gen issues --- .github/workflows/protobuf-conformance.yml | 27 + .../util/tasks/protobufConformanceUpdate.kt | 154 + gradle-plugin/build.gradle.kts | 35 - .../src/main/kotlin/kotlinx/rpc/Extensions.kt | 7 +- .../kotlinx/rpc/buf/tasks/BufExecTask.kt | 10 +- .../kotlinx/rpc/buf/tasks/BufGenerateTask.kt | 8 +- .../rpc/buf/tasks/GenerateBufGenYaml.kt | 5 +- ...gureLocalProtocGenDevelopmentDependency.kt | 5 +- .../rpc/protoc/DefaultProtocExtension.kt | 99 +- protobuf/protobuf-core/build.gradle.kts | 3 +- .../rpc/protobuf/internal/WireDecoder.kt | 8 +- .../protobuf/internal/WireDecoder.native.kt | 5 + .../gen/core/AModelToKotlinCommonGenerator.kt | 8 +- .../rpc/protoc/gen/core/CodeGenerator.kt | 2 +- .../rpc/protoc/gen/core/ProtocGenPlugin.kt | 12 +- .../rpc/protoc/gen/core/codeRequestToModel.kt | 18 +- .../grpc/ModelToGrpcKotlinCommonGenerator.kt | 4 + .../ModelToProtobufKotlinCommonGenerator.kt | 14 +- settings.gradle.kts | 1 + tests/protobuf-conformance/build.gradle.kts | 46 + .../protobuf/conformance/Conformance.kt | 129 + .../conformance/_rpc_internal/Conformance.kt | 721 +++ .../proto3/TestMessagesProto3Editions.kt | 277 ++ .../TestMessagesProto3Editions.kt | 4362 +++++++++++++++++ .../proto3/TestMessagesProto3.kt | 277 ++ .../_rpc_internal/TestMessagesProto3.kt | 4362 +++++++++++++++++ .../conformance/conformance.proto | 172 + .../protobuf/test_messages_edition2023.proto | 217 + .../protobuf/test_messages_proto2.proto | 416 ++ .../test_messages_proto2_editions.proto | 683 +++ .../protobuf/test_messages_proto3.proto | 266 + .../test_messages_proto3_editions.proto | 309 ++ 32 files changed, 12556 insertions(+), 106 deletions(-) create mode 100644 .github/workflows/protobuf-conformance.yml create mode 100644 gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt create mode 100644 tests/protobuf-conformance/build.gradle.kts create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt create mode 100644 tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto create mode 100644 tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto diff --git a/.github/workflows/protobuf-conformance.yml b/.github/workflows/protobuf-conformance.yml new file mode 100644 index 000000000..222940ef5 --- /dev/null +++ b/.github/workflows/protobuf-conformance.yml @@ -0,0 +1,27 @@ +name: Verify Protobuf Conformance is Up-to-Date + +on: + pull_request: + +permissions: + contents: read + +jobs: + verify-platforms-table: + name: Run Verification + runs-on: ubuntu-latest + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Run Protobuf Conformance Test Generation + run: ./gradlew tests:protobuf-conformance:bufGenerateTest --info --stacktrace + - name: Check if protobuf-conformance test is up-to-date + run: | + if [[ -n "$(git status --porcelain | grep tests/protobuf-conformance/)" ]]; then + echo "Protobuf conformance test is not up to date. Please run './gradlew tests:protobuf-conformance:bufGenerateTest' and commit changes" + exit 1 + fi diff --git a/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt b/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt new file mode 100644 index 000000000..8d009c68f --- /dev/null +++ b/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt @@ -0,0 +1,154 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package util.tasks + +import org.gradle.api.DefaultTask +import org.gradle.api.Project +import org.gradle.api.provider.Property +import org.gradle.api.tasks.Copy +import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.TaskAction +import org.gradle.kotlin.dsl.accessors.runtime.addExternalModuleDependencyTo +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.register +import org.gradle.kotlin.dsl.the +import org.jetbrains.kotlin.gradle.dsl.KotlinJvmExtension +import util.other.libs +import java.io.File + +const val CONFORMANCE_TEST_RUNNER_CONFIGURATION = "conformanceTestRunner" +const val UNZIP_PROTOBUF_CONFORMANCE_TASK = "unzipProtobufConformance" +const val WRITE_CONFORMANCE_EXECUTABLE_PATH_TASK = "writeConformanceExecutablePath" + +abstract class ConformanceExecutablePathWriter : DefaultTask() { + @get:InputFile + abstract val executable: Property + + @get:OutputFile + abstract val destination: Property + + @TaskAction + fun action() { + val dest = destination.get() + if (dest.exists()) { + dest.delete() + } + + val parent = dest.parentFile + if (!parent.exists()) { + parent.mkdirs() + } + + dest.writeText( + """ + // file generated by ConformanceExecutablePathWriter task + + const val CONFORMANCE_EXECUTABLE_PATH: String = "${executable.get().absolutePath}" + + """.trimIndent() + ) + } +} + +fun Project.setupProtobufConformanceResources() { + val os = System.getProperty("os.name").lowercase() + val osPart = when { + os.startsWith("linux") -> "linux" + os.startsWith("mac") -> "osx" + else -> error("unsupported os for protobuf-conformance tests: $os") + } + + val archPart = when (val arch = System.getProperty("os.arch").lowercase()) { + in setOf("x86_64", "amd64", "aarch64") -> "x86_64" + else -> error("unsupported arch for protobuf-conformance tests: $arch") + } + + // https://stackoverflow.com/questions/23023069/gradle-download-and-unzip-file-from-url + repositories.ivy { + name = "protobuf-conformance-github" + url = uri("https://github.com") + + patternLayout { + // https://github.com/bufbuild/protobuf-conformance/releases/download/v${version}/conformance_test_runner-${version}-${build}.zip + artifact("[organisation]/[module]/releases/download/v[revision]/[artifact]-[revision]-[classifier].[ext]") + } + + // This is required in Gradle 6.0+ as metadata file (ivy.xml) + // is mandatory. Docs linked below this code section + metadataSources { artifact() } + } + + configurations.create(CONFORMANCE_TEST_RUNNER_CONFIGURATION) + + // https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/dsl/DependencyHandler.html + dependencies { + addExternalModuleDependencyTo( + this, + CONFORMANCE_TEST_RUNNER_CONFIGURATION, + group = "bufbuild", + name = "protobuf-conformance", + version = libs.versions.protobuf.asProvider().get().substringAfter("."), + classifier = null, + ext = null, + configuration = null, + ) { + artifact { + name = "conformance_test_runner" + type = "zip" + extension = "zip" + classifier = "$osPart-$archPart" + } + } + } + + val unzipProtobufConformance = tasks.register(UNZIP_PROTOBUF_CONFORMANCE_TASK) { + from(configurations.getByName(CONFORMANCE_TEST_RUNNER_CONFIGURATION).map { + zipTree(it).matching { include("include/**") } + }) + + val destDir = project.layout.projectDirectory + .dir("src") + .dir("test") + .dir("proto") + + into(destDir) + + eachFile { + if (path.startsWith("include/")) { + path = "protobuf-conformance/${path.removePrefix("include/")}" + } + } + + includeEmptyDirs = false + + doFirst { + destDir.asFile.deleteRecursively() + } + } + + val writeConformanceExecutablePath = + tasks.register(WRITE_CONFORMANCE_EXECUTABLE_PATH_TASK) { + executable.set( + configurations.getByName(CONFORMANCE_TEST_RUNNER_CONFIGURATION).map { + zipTree(it).matching { include("bin/**") }.files.first() + }.single() + ) + + destination.set( + project.layout.buildDirectory.file("generated/protobuf-conformance/executable-path.kt").get().asFile + ) + } + + tasks.matching { it.name == "processTestProtoFiles" }.all { + dependsOn(unzipProtobufConformance) + } + + the().apply { + sourceSets.getByName("test") { + kotlin.srcDir(writeConformanceExecutablePath.map { it.destination.get().parentFile }) + } + } +} diff --git a/gradle-plugin/build.gradle.kts b/gradle-plugin/build.gradle.kts index 8b7d974c7..769183659 100644 --- a/gradle-plugin/build.gradle.kts +++ b/gradle-plugin/build.gradle.kts @@ -83,9 +83,6 @@ gradlePlugin { abstract class GeneratePluginVersionsTask @Inject constructor( @get:Input val libraryVersion: String, - @get:Input val protobufVersion: String, - @get:Input val grpcVersion: String, - @get:Input val grpcKotlinVersion: String, @get:Input val bufToolVersion: String, @get:OutputDirectory val sourcesDir: File ) : DefaultTask() { @@ -104,24 +101,6 @@ package kotlinx.rpc */ public const val LIBRARY_VERSION: String = "$libraryVersion" -@Deprecated("Use kotlinx.rpc.LIBRARY_VERSION instead", ReplaceWith("kotlinx.rpc.LIBRARY_VERSION")) -public const val PLUGIN_VERSION: String = LIBRARY_VERSION - -/** - * The version of the protobuf library. - */ -public const val PROTOBUF_VERSION: String = "$protobufVersion" - -/** - * The version of the grpc java library. - */ -public const val GRPC_VERSION: String = "$grpcVersion" - -/** - * The version of the grpc kotlin library. - */ -public const val GRPC_KOTLIN_VERSION: String = "$grpcKotlinVersion" - /** * The version of the buf tool used to generate protobuf. */ @@ -141,18 +120,12 @@ val sourcesDir = File(project.layout.buildDirectory.asFile.get(), "generated-sou val generatePluginVersionsTask = tasks.register( GeneratePluginVersionsTask.NAME, version.toString(), - libs.versions.protobuf.asProvider().get(), - libs.versions.grpc.asProvider().get(), - libs.versions.grpc.kotlin.get(), libs.versions.buf.tool.get(), sourcesDir, ) abstract class GenerateTestVersionTask @Inject constructor( @get:Input val kotlinVersion: String, - @get:Input val protobufVersion: String, - @get:Input val grpcVersion: String, - @get:Input val grpcKotlinVersion: String, @get:Input val buildRepo: String, @get:OutputDirectory val sourcesDir: File ) : DefaultTask() { @@ -170,11 +143,6 @@ const val KOTLIN_VERSION: String = "$kotlinVersion" const val BUILD_REPO: String = "$buildRepo" -// can't use from generatePluginVersionsTask bacause Gradle messes up caches -const val TEST_PROTOBUF_VERSION: String = "$protobufVersion" -const val TEST_GRPC_VERSION: String = "$grpcVersion" -const val TEST_GRPC_KOTLIN_VERSION: String = "$grpcKotlinVersion" - """.trimIndent() ) } @@ -191,9 +159,6 @@ val globalRootDir: String by extra val generateTestVersionsTask = tasks.register( GenerateTestVersionTask.NAME, libs.versions.kotlin.lang.get(), - libs.versions.protobuf.asProvider().get(), - libs.versions.grpc.asProvider().get(), - libs.versions.grpc.kotlin.get(), File(globalRootDir).resolve("build/repo").absolutePath, testSourcesDir, ) diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/Extensions.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/Extensions.kt index b16a2afe7..aab87ea0a 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/Extensions.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/Extensions.kt @@ -19,7 +19,8 @@ import org.gradle.kotlin.dsl.property import java.util.concurrent.atomic.AtomicBoolean import javax.inject.Inject -internal fun Project.rpcExtension(): RpcExtension = extensions.findByType() ?: RpcExtension(objects, this) +internal fun Project.rpcExtension(): RpcExtension = extensions.findByType() + ?: error("Rpc extension not found. Please apply the plugin to the project") public open class RpcExtension @Inject constructor(objects: ObjectFactory, private val project: Project) { /** @@ -51,6 +52,10 @@ public open class RpcExtension @Inject constructor(objects: ObjectFactory, priva * Protoc settings. */ public val protoc: ProtocExtension by lazy { + if (protocApplied.get()) { + error("Illegal access to protoc extension during DefaultProtocExtension.init") + } + protocApplied.set(true) objects.newInstance() } diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufExecTask.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufExecTask.kt index 57e393cf1..e2a147401 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufExecTask.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufExecTask.kt @@ -117,11 +117,11 @@ internal fun Project.registerBufExecTask( bufExecutable.set(executableConfiguration.singleFile) this.workingDir.set(workingDir) - val buf = project.rpcExtension().protoc.buf - configFile.set(buf.configFile) - logFormat.set(buf.logFormat) - bufTimeoutInWholeSeconds.set(buf.timeout.map { it.inWholeSeconds }) - debug.set(project.gradle.startParameter.logLevel == LogLevel.DEBUG) + val buf = provider { rpcExtension().protoc.buf } + configFile.set(buf.flatMap { it.configFile }) + logFormat.set(buf.flatMap { it.logFormat }) + bufTimeoutInWholeSeconds.set(buf.flatMap { it.timeout.map { duration -> duration.inWholeSeconds } }) + debug.set(gradle.startParameter.logLevel == LogLevel.DEBUG) configuration() } diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt index e92f21555..84a101474 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt @@ -129,11 +129,11 @@ internal fun Project.registerBufGenerateTask( group = PROTO_GROUP description = "Generates code from .proto files using 'buf generate'" - val generate = project.rpcExtension().protoc.buf.generate + val generate = provider { rpcExtension().protoc.buf.generate } - includeImports.set(generate.includeImports) - includeWkt.set(generate.includeWkt) - errorFormat.set(generate.errorFormat) + includeImports.set(generate.flatMap { it.includeImports }) + includeWkt.set(generate.flatMap { it.includeWkt }) + errorFormat.set(generate.flatMap { it.errorFormat }) this.outputDirectory.set(outputDirectory) diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/GenerateBufGenYaml.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/GenerateBufGenYaml.kt index 455d99867..c281706b8 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/GenerateBufGenYaml.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/GenerateBufGenYaml.kt @@ -14,6 +14,7 @@ import org.gradle.api.GradleException import org.gradle.api.Project import org.gradle.api.provider.ListProperty import org.gradle.api.provider.Property +import org.gradle.api.provider.Provider import org.gradle.api.tasks.Input import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction @@ -136,13 +137,13 @@ public abstract class GenerateBufGenYaml : DefaultTask() { internal fun Project.registerGenerateBufGenYamlTask( name: String, buildSourceSetsDir: File, - protocPlugins: Iterable, + protocPlugins: Provider>, configure: GenerateBufGenYaml.() -> Unit = {}, ): TaskProvider { val capitalizeName = name.replaceFirstChar { it.uppercase() } return project.tasks.register("${GenerateBufGenYaml.NAME_PREFIX}$capitalizeName") { val pluginsProvider = project.provider { - protocPlugins.map { plugin -> + protocPlugins.get().map { plugin -> if (!plugin.artifact.isPresent) { throw GradleException( "Artifact is not specified for protoc plugin ${plugin.name}. " + diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt index 15ef97c3e..d13d82237 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt @@ -4,21 +4,20 @@ package kotlinx.rpc.internal -import kotlinx.rpc.RpcExtension import kotlinx.rpc.buf.tasks.BufGenerateTask import kotlinx.rpc.protoc.grpcKotlinMultiplatform import kotlinx.rpc.protoc.kotlinMultiplatform +import kotlinx.rpc.rpcExtension import org.gradle.api.Project import org.gradle.internal.extensions.core.extra import org.gradle.kotlin.dsl.provideDelegate -import org.gradle.kotlin.dsl.the import org.gradle.kotlin.dsl.withType @InternalRpcApi public fun Project.configureLocalProtocGenDevelopmentDependency() { val globalRootDir: String by extra - the().protoc.plugins { + rpcExtension().protoc.plugins { kotlinMultiplatform { local { javaJar("$globalRootDir/protoc-gen/protobuf/build/libs/protobuf-$version-all.jar") diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt index 5ec5800e2..f895d8880 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt @@ -6,6 +6,9 @@ package kotlinx.rpc.protoc import kotlinx.rpc.buf.BufExtension import kotlinx.rpc.buf.configureBufExecutable +import kotlinx.rpc.buf.tasks.BufGenerateTask +import kotlinx.rpc.buf.tasks.GenerateBufGenYaml +import kotlinx.rpc.buf.tasks.GenerateBufYaml import kotlinx.rpc.buf.tasks.registerBufExecTask import kotlinx.rpc.buf.tasks.registerBufGenerateTask import kotlinx.rpc.buf.tasks.registerGenerateBufGenYamlTask @@ -17,8 +20,11 @@ import org.gradle.api.Action import org.gradle.api.GradleException import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project +import org.gradle.api.file.ConfigurableFileTree import org.gradle.api.model.ObjectFactory import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.api.provider.Provider +import org.gradle.api.tasks.TaskProvider import org.gradle.api.tasks.compile.JavaCompile import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.newInstance @@ -28,6 +34,7 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask +import java.io.File import javax.inject.Inject internal open class DefaultProtocExtension @Inject constructor( @@ -55,19 +62,18 @@ internal open class DefaultProtocExtension @Inject constructor( createDefaultProtocPlugins() - project.protoSourceSets.forEach { protoSourceSet -> - protoSourceSet.protocPlugin(plugins.kotlinMultiplatform) - protoSourceSet.protocPlugin(plugins.grpcKotlinMultiplatform) + project.protoSourceSets.all { + protocPlugin(plugins.kotlinMultiplatform) + protocPlugin(plugins.grpcKotlinMultiplatform) } - project.afterEvaluate { - project.protoSourceSets.forEach { sourceSet -> - if (sourceSet !is DefaultProtoSourceSet) { - return@forEach - } - configureTasks(sourceSet) + project.protoSourceSets.all { + if (this !is DefaultProtoSourceSet) { + return@all } + + project.configureTasks(this) } } @@ -86,12 +92,16 @@ internal open class DefaultProtocExtension @Inject constructor( val pairSourceSet = protoSourceSet.correspondingMainSourceSetOrNull() - val mainProtocPlugins = pairSourceSet?.protocPlugins?.get().orEmpty() - val protocPluginNames = (protoSourceSet.protocPlugins.get() + mainProtocPlugins).distinct() + val mainProtocPlugins = pairSourceSet?.protocPlugins ?: provider { emptyList() } + val protocPluginNames = protoSourceSet.protocPlugins + .zip(mainProtocPlugins) { left, right -> left + right } + .map { it.distinct() } - val includedProtocPlugins = protocPluginNames.map { - this@DefaultProtocExtension.plugins.findByName(it) - ?: throw GradleException("Protoc plugin $it not found") + val includedProtocPlugins = protocPluginNames.map { list -> + list.map { pluginName -> + this@DefaultProtocExtension.plugins.findByName(pluginName) + ?: throw GradleException("Protoc plugin $pluginName not found") + } } val protoFiles = protoSourceSet.proto @@ -137,28 +147,28 @@ internal open class DefaultProtocExtension @Inject constructor( dependsOn(generateBufYamlTask) } - val out = protoBuildDirGenerated.resolve(baseName) - - val destinationFileTree = fileTree(buildSourceSetsProtoDir) + val sourceSetsProtoDirFileTree = fileTree(buildSourceSetsProtoDir) val bufGenerateTask = registerBufGenerateTask( name = baseName, workingDir = buildSourceSetsDir, - outputDirectory = out, + outputDirectory = protoBuildDirGenerated.resolve(baseName), protoFilesDir = buildSourceSetsProtoDir, importFilesDir = buildSourceSetsImportDir, ) { - includedProtocPlugins.forEach { plugin -> - executableFiles.addAll( - plugin.artifact.map { - if (it is ProtocPlugin.Artifact.Local) { - it.executableFiles.get() - } else { - emptyList() + executableFiles.addAll( + includedProtocPlugins.map { list -> + list.flatMap { plugin -> + plugin.artifact.get().let { + if (it is ProtocPlugin.Artifact.Local) { + it.executableFiles.get() + } else { + emptyList() + } } } - ) - } + } + ) dependsOn(generateBufGenYamlTask) dependsOn(generateBufYamlTask) @@ -171,7 +181,7 @@ internal open class DefaultProtocExtension @Inject constructor( dependsOn(pairSourceSet.generateTask) } - onlyIf { !destinationFileTree.filter { it.extension == "proto" }.isEmpty } + onlyIf { !sourceSetsProtoDirFileTree.filter { it.extension == "proto" }.isEmpty } } protoSourceSet.generateTask.set(bufGenerateTask) @@ -210,7 +220,36 @@ internal open class DefaultProtocExtension @Inject constructor( } } - includedProtocPlugins.forEach { plugin -> + configureAfterEvaluate( + baseName = baseName, + protoSourceSet = protoSourceSet, + buildSourceSetsDir = buildSourceSetsDir, + includedProtocPlugins = includedProtocPlugins, + generateBufYamlTask = generateBufYamlTask, + generateBufGenYamlTask = generateBufGenYamlTask, + processProtoTask = processProtoTask, + processImportProtoTask = processImportProtoTask, + bufGenerateTask = bufGenerateTask, + sourceSetsProtoDirFileTree = sourceSetsProtoDirFileTree, + ) + } + + private fun Project.configureAfterEvaluate( + baseName: String, + protoSourceSet: DefaultProtoSourceSet, + buildSourceSetsDir: File, + includedProtocPlugins: Provider>, + generateBufYamlTask: TaskProvider, + generateBufGenYamlTask: TaskProvider, + processProtoTask: TaskProvider, + processImportProtoTask: TaskProvider?, + bufGenerateTask: TaskProvider, + sourceSetsProtoDirFileTree: ConfigurableFileTree, + ) = afterEvaluate { + val out = bufGenerateTask.get().outputDirectory.get() + val plugins = includedProtocPlugins.get() + + plugins.forEach { plugin -> // locates correctly jvmMain, main jvmTest, test val javaSourceSet = extensions.findByType() ?.sourceSets?.findByName(baseName)?.java @@ -245,7 +284,7 @@ internal open class DefaultProtocExtension @Inject constructor( dependsOn(processImportProtoTask) } - onlyIf { !destinationFileTree.filter { it.extension == "proto" }.isEmpty } + onlyIf { !sourceSetsProtoDirFileTree.filter { it.extension == "proto" }.isEmpty } } when { diff --git a/protobuf/protobuf-core/build.gradle.kts b/protobuf/protobuf-core/build.gradle.kts index d75a73515..a8cf01755 100644 --- a/protobuf/protobuf-core/build.gradle.kts +++ b/protobuf/protobuf-core/build.gradle.kts @@ -34,8 +34,7 @@ kotlin { jvmMain { dependencies { - api(libs.protobuf.java.util) - implementation(libs.protobuf.kotlin) + implementation(libs.protobuf.java.util) } } diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.kt b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.kt index f010f44b9..acfffcf4b 100644 --- a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.kt +++ b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.kt @@ -4,7 +4,6 @@ package kotlinx.rpc.protobuf.internal -import kotlinx.io.Buffer import kotlinx.rpc.internal.utils.InternalRpcApi import kotlinx.rpc.protobuf.input.stream.InputStream @@ -109,12 +108,9 @@ public expect inline fun checkForPlatformDecodeException(block: () -> Unit) /** * Creates a platform-specific [WireDecoder]. * - * This constructor takes a [Buffer] instead of a [kotlinx.io.Source] because - * the native implementation (`WireDecoderNative`) depends on [Buffer]'s internal structure. + * NOTE: Do not use the [source] while the [WireDecoder] is still open. * - * NOTE: Do not use the [source] buffer while the [WireDecoder] is still open. - * - * @param source The buffer containing the encoded wire-format data. + * @param source The stream containing the encoded wire-format data. */ @InternalRpcApi public expect fun WireDecoder(source: InputStream): WireDecoder diff --git a/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.native.kt b/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.native.kt index c3fd1cfbb..f7d101587 100644 --- a/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.native.kt +++ b/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireDecoder.native.kt @@ -7,6 +7,7 @@ package kotlinx.rpc.protobuf.internal import kotlinx.cinterop.* import kotlinx.collections.immutable.persistentListOf import kotlinx.io.Buffer +import kotlinx.rpc.protobuf.input.stream.BufferInputStream import kotlinx.rpc.protobuf.input.stream.InputStream import libprotowire.* import kotlin.experimental.ExperimentalNativeApi @@ -299,6 +300,10 @@ internal class WireDecoderNative(private val source: Buffer) : WireDecoder { } } +/** + * This constructor takes an [BufferInputStream.buffer] and its [Buffer] instead of a [kotlinx.io.Source] because + * the implementation ([WireDecoderNative]) depends on [Buffer]'s internal structure. + */ public actual fun WireDecoder(source: InputStream): WireDecoder = WireDecoderNative(source.buffer) public actual inline fun checkForPlatformDecodeException(block: () -> Unit) { diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt index c1f7df818..1ccd0277b 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt @@ -64,7 +64,6 @@ abstract class AModelToKotlinCommonGenerator( generatePublicDeclaredEntities(this@generatePublicKotlinFile) import("kotlinx.rpc.internal.utils.*") - import("kotlinx.coroutines.flow.*") additionalPublicImports.forEach { import(it) @@ -92,7 +91,6 @@ abstract class AModelToKotlinCommonGenerator( import("$PB_PKG.*") import("kotlinx.rpc.internal.utils.*") - import("kotlinx.coroutines.flow.*") additionalInternalImports.forEach { import(it) @@ -118,6 +116,7 @@ abstract class AModelToKotlinCommonGenerator( val fqValue = when (val value = type.value) { is FieldType.Message -> value.dec.value.name is FieldType.IntegralType -> value.fqName + is FieldType.Enum -> value.dec.name else -> error("Unsupported type: $value") } @@ -136,6 +135,7 @@ abstract class AModelToKotlinCommonGenerator( val fqValue = when (val value = entry.value) { is FieldType.Message -> value.dec.value.name is FieldType.IntegralType -> value.fqName + is FieldType.Enum -> value.dec.name else -> error("Unsupported type: $value") } @@ -160,6 +160,10 @@ abstract class AModelToKotlinCommonGenerator( nameToImport: String = declaration.simpleName, internalOnly: Boolean = false, ) { + if (declaration is FqName.Package) { + return + } + if (declaration.parent == FqName.Package.Root && currentPackage != FqName.Package.Root && nameToImport.isNotBlank()) { additionalInternalImports.add(nameToImport) if (!internalOnly) { diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt index ea43f0283..55c25776b 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt @@ -11,7 +11,7 @@ import org.slf4j.helpers.NOPLogger open class CodeGenerator( private val indent: String, private val builder: StringBuilder = StringBuilder(), - private val logger: Logger = NOPLogger.NOP_LOGGER, + protected val logger: Logger = NOPLogger.NOP_LOGGER, ) { private var isEmpty: Boolean = true private var result: String? = null diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt index 8b3a2bc79..d21513fa6 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt @@ -9,6 +9,7 @@ import ch.qos.logback.classic.LoggerContext import ch.qos.logback.classic.encoder.PatternLayoutEncoder import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.FileAppender +import com.google.protobuf.DescriptorProtos import com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse.Feature @@ -29,6 +30,8 @@ abstract class ProtocGenPlugin { val factory = LoggerFactory.getILoggerFactory() (factory.getLogger(Logger.ROOT_LOGGER_NAME) as ch.qos.logback.classic.Logger).apply { + detachAndStopAllAppenders() + val appender = FileAppender().apply { isAppend = true file = debugOutput @@ -77,7 +80,14 @@ abstract class ProtocGenPlugin { .apply { files.forEach(::addFile) - supportedFeatures = Feature.FEATURE_PROTO3_OPTIONAL_VALUE.toLong() + val features = + Feature.FEATURE_PROTO3_OPTIONAL_VALUE or + Feature.FEATURE_SUPPORTS_EDITIONS_VALUE + + minimumEdition = DescriptorProtos.Edition.EDITION_PROTO2_VALUE + maximumEdition = DescriptorProtos.Edition.EDITION_MAX_VALUE + + supportedFeatures = features.toLong() } .build() } diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt index 1c15b453c..13ee912ee 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt @@ -79,7 +79,7 @@ private fun Descriptors.GenericDescriptor.fqName(): FqName { val nameCapital = name.simpleProtoNameToKotlin(firstLetterUpper = true) val nameLower = name.simpleProtoNameToKotlin() val fqName = when (this) { - is Descriptors.FileDescriptor -> FqName.Package.fromString(`package`) + is Descriptors.FileDescriptor -> FqName.Package.fromString(kotlinPackage()) is Descriptors.Descriptor -> FqName.Declaration(nameCapital, containingType?.fqName() ?: file.fqName()) is Descriptors.FieldDescriptor -> { val usedName = if (realContainingOneof != null) nameCapital else nameLower @@ -114,7 +114,7 @@ private inline fun D.cached(block: (D) -> T): T private fun Descriptors.FileDescriptor.toModel(): FileDeclaration = cached { return FileDeclaration( name = kotlinFileName(), - packageName = FqName.Package.fromString(`package`), + packageName = FqName.Package.fromString(kotlinPackage()), dependencies = dependencies.map { it.toModel() }, messageDeclarations = messageTypes.map { it.toModel() }, enumDeclarations = enumTypes.map { it.toModel() }, @@ -284,24 +284,28 @@ private fun Descriptors.FileDescriptor.kotlinFileName(): String { return "${protoFileNameToKotlinName()}.kt" } +private fun Descriptors.FileDescriptor.kotlinPackage(): String { + return if (options.hasJavaPackage()) { + options.javaPackage + } else { + `package` + } +} + private fun Descriptors.FileDescriptor.protoFileNameToKotlinName(): String { return name.removeSuffix(".proto").fullProtoNameToKotlin(firstLetterUpper = true) } - private fun String.fullProtoNameToKotlin(firstLetterUpper: Boolean = false): String { val lastDelimiterIndex = indexOfLast { it == '.' || it == '/' } return if (lastDelimiterIndex != -1) { - val packageName = substring(0, lastDelimiterIndex) val name = substring(lastDelimiterIndex + 1) - val delimiter = this[lastDelimiterIndex] - return "$packageName$delimiter${name.simpleProtoNameToKotlin(firstLetterUpper = true)}" + return name.simpleProtoNameToKotlin(firstLetterUpper = true) } else { simpleProtoNameToKotlin(firstLetterUpper) } } - private val snakeRegExp = "(_[a-z]|-[a-z])".toRegex() private fun String.snakeToCamelCase(): String { diff --git a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt index 4d50cd3c9..0177b063e 100644 --- a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt +++ b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt @@ -24,6 +24,10 @@ class ModelToGrpcKotlinCommonGenerator( override fun CodeGenerator.generateInternalDeclaredEntities(fileDeclaration: FileDeclaration) { } + init { + additionalPublicImports.add("kotlinx.coroutines.flow.Flow") + } + @Suppress("detekt.LongMethod") private fun CodeGenerator.generatePublicService(service: ServiceDeclaration) { code("@kotlinx.rpc.grpc.annotations.Grpc") diff --git a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt index e8343cf0b..5d8b1f215 100644 --- a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt +++ b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt @@ -586,7 +586,7 @@ class ModelToProtobufKotlinCommonGenerator( contextReceiver = declaration.internalClassFullName(), returnType = "Int", ) { - code("var result = 0") + code("var __result = 0") declaration.actualFields.forEach { field -> val fieldName = field.name if (field.nullable) { @@ -603,7 +603,7 @@ class ModelToProtobufKotlinCommonGenerator( } } } - code("return result") + code("return __result") } } @@ -638,17 +638,17 @@ class ModelToProtobufKotlinCommonGenerator( when (field.type) { is FieldType.List -> when { // packed fields also have the tag + len - field.dec.isPacked -> code("result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") - else -> code("result = $valueSize") + field.dec.isPacked -> code("__result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") + else -> code("__result = $valueSize") } is FieldType.Message, FieldType.IntegralType.STRING, FieldType.IntegralType.BYTES, - -> code("result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") + -> code("__result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") is FieldType.Map -> { - scope("result += ${field.name}.entries.sumOf", paramDecl = "kEntry ->") { + scope("__result += ${field.name}.entries.sumOf", paramDecl = "kEntry ->") { generateMapConstruction(field.type as FieldType.Map, "kEntry.key", "kEntry.value") code("._size") } @@ -677,7 +677,7 @@ class ModelToProtobufKotlinCommonGenerator( FieldType.IntegralType.SINT64, FieldType.IntegralType.SFIXED32, FieldType.IntegralType.SFIXED64, - -> code("result += ($tagSize + $valueSize)") + -> code("__result += ($tagSize + $valueSize)") } } diff --git a/settings.gradle.kts b/settings.gradle.kts index be56183a8..cd883338f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -64,6 +64,7 @@ includePublic(":krpc:krpc-ktor:krpc-ktor-client") include(":tests") include(":tests:krpc-compatibility-tests") +include(":tests:protobuf-conformance") val kotlinMasterBuild = providers.gradleProperty("kotlinx.rpc.kotlinMasterBuild").orNull == "true" diff --git a/tests/protobuf-conformance/build.gradle.kts b/tests/protobuf-conformance/build.gradle.kts new file mode 100644 index 000000000..5baa1b3f1 --- /dev/null +++ b/tests/protobuf-conformance/build.gradle.kts @@ -0,0 +1,46 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:OptIn(InternalRpcApi::class) + +import kotlinx.rpc.buf.tasks.BufGenerateTask +import kotlinx.rpc.internal.InternalRpcApi +import kotlinx.rpc.internal.configureLocalProtocGenDevelopmentDependency +import kotlinx.rpc.protoc.ProcessProtoFiles +import util.tasks.setupProtobufConformanceResources + +plugins { + alias(libs.plugins.conventions.jvm) + alias(libs.plugins.kotlinx.rpc) +} + +dependencies { + testImplementation(projects.grpc.grpcCodec) + testImplementation(projects.protobuf.protobufCore) +} + +setupProtobufConformanceResources() +configureLocalProtocGenDevelopmentDependency() + +val generatedCodeDir = project.layout.projectDirectory + .dir("src") + .dir("test") + .dir("generated-code") + .asFile + +tasks.withType().configureEach { + if (name.endsWith("Test")) { + outputDirectory.set(generatedCodeDir) + } +} + +protoSourceSets { + test { + proto { + exclude("**/test_messages_proto2.proto") + exclude("**/test_messages_proto2_editions.proto") + exclude("**/test_messages_edition2023.proto") + } + } +} diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt new file mode 100644 index 000000000..1f6b6008a --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt @@ -0,0 +1,129 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.conformance + +import kotlin.jvm.JvmInline +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.conformance.TestStatusInternal.CODEC::class) +interface TestStatus { + val name: String + val failureMessage: String + val matchedName: String + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.conformance.FailureSetInternal.CODEC::class) +interface FailureSet { + val test: List + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.conformance.ConformanceRequestInternal.CODEC::class) +interface ConformanceRequest { + val requestedOutputFormat: com.google.protobuf.conformance.WireFormat + val messageType: String + val testCategory: com.google.protobuf.conformance.TestCategory + val jspbEncodingOptions: com.google.protobuf.conformance.JspbEncodingConfig + val printUnknownFields: Boolean + val payload: com.google.protobuf.conformance.ConformanceRequest.Payload? + + sealed interface Payload { + @JvmInline + value class ProtobufPayload(val value: ByteArray): Payload + + @JvmInline + value class JsonPayload(val value: String): Payload + + @JvmInline + value class JspbPayload(val value: String): Payload + + @JvmInline + value class TextPayload(val value: String): Payload + } + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.conformance.ConformanceResponseInternal.CODEC::class) +interface ConformanceResponse { + val result: com.google.protobuf.conformance.ConformanceResponse.Result? + + sealed interface Result { + @JvmInline + value class ParseError(val value: String): Result + + @JvmInline + value class SerializeError(val value: String): Result + + @JvmInline + value class TimeoutError(val value: String): Result + + @JvmInline + value class RuntimeError(val value: String): Result + + @JvmInline + value class ProtobufPayload(val value: ByteArray): Result + + @JvmInline + value class JsonPayload(val value: String): Result + + @JvmInline + value class Skipped(val value: String): Result + + @JvmInline + value class JspbPayload(val value: String): Result + + @JvmInline + value class TextPayload(val value: String): Result + } + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.conformance.JspbEncodingConfigInternal.CODEC::class) +interface JspbEncodingConfig { + val useJspbArrayAnyFormat: Boolean + + companion object +} + +sealed class WireFormat(open val number: Int) { + object UNSPECIFIED: WireFormat(number = 0) + + object PROTOBUF: WireFormat(number = 1) + + object JSON: WireFormat(number = 2) + + object JSPB: WireFormat(number = 3) + + object TEXT_FORMAT: WireFormat(number = 4) + + data class UNRECOGNIZED(override val number: Int): WireFormat(number) + + companion object { + val entries: List by lazy { listOf(UNSPECIFIED, PROTOBUF, JSON, JSPB, TEXT_FORMAT) } + } +} + +sealed class TestCategory(open val number: Int) { + object UNSPECIFIED_TEST: TestCategory(number = 0) + + object BINARY_TEST: TestCategory(number = 1) + + object JSON_TEST: TestCategory(number = 2) + + object JSON_IGNORE_UNKNOWN_PARSING_TEST: TestCategory(number = 3) + + object JSPB_TEST: TestCategory(number = 4) + + object TEXT_FORMAT_TEST: TestCategory(number = 5) + + data class UNRECOGNIZED(override val number: Int): TestCategory(number) + + companion object { + val entries: List by lazy { listOf(UNSPECIFIED_TEST, BINARY_TEST, JSON_TEST, JSON_IGNORE_UNKNOWN_PARSING_TEST, JSPB_TEST, TEXT_FORMAT_TEST) } + } +} + diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt new file mode 100644 index 000000000..527deece2 --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt @@ -0,0 +1,721 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.conformance + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +@kotlinx.rpc.internal.utils.InternalRpcApi +class TestStatusInternal: com.google.protobuf.conformance.TestStatus, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var name: String by MsgFieldDelegate() { "" } + override var failureMessage: String by MsgFieldDelegate() { "" } + override var matchedName: String by MsgFieldDelegate() { "" } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf.conformance.TestStatus): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.conformance.TestStatus { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.conformance.TestStatusInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.conformance.TestStatusInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class FailureSetInternal: com.google.protobuf.conformance.FailureSet, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var test: List by MsgFieldDelegate() { mutableListOf() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf.conformance.FailureSet): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.conformance.FailureSet { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.conformance.FailureSetInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.conformance.FailureSetInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class ConformanceRequestInternal: com.google.protobuf.conformance.ConformanceRequest, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val jspbEncodingOptions = 0 + } + + override val _size: Int by lazy { computeSize() } + override var requestedOutputFormat: com.google.protobuf.conformance.WireFormat by MsgFieldDelegate() { com.google.protobuf.conformance.WireFormat.UNSPECIFIED } + override var messageType: String by MsgFieldDelegate() { "" } + override var testCategory: com.google.protobuf.conformance.TestCategory by MsgFieldDelegate() { com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST } + override var jspbEncodingOptions: com.google.protobuf.conformance.JspbEncodingConfig by MsgFieldDelegate(PresenceIndices.jspbEncodingOptions) { com.google.protobuf.conformance.JspbEncodingConfigInternal() } + override var printUnknownFields: Boolean by MsgFieldDelegate() { false } + override var payload: com.google.protobuf.conformance.ConformanceRequest.Payload? = null + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf.conformance.ConformanceRequest): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.conformance.ConformanceRequest { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.conformance.ConformanceRequestInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.conformance.ConformanceRequestInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class ConformanceResponseInternal: com.google.protobuf.conformance.ConformanceResponse, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var result: com.google.protobuf.conformance.ConformanceResponse.Result? = null + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf.conformance.ConformanceResponse): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.conformance.ConformanceResponse { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.conformance.ConformanceResponseInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.conformance.ConformanceResponseInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class JspbEncodingConfigInternal: com.google.protobuf.conformance.JspbEncodingConfig, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var useJspbArrayAnyFormat: Boolean by MsgFieldDelegate() { false } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf.conformance.JspbEncodingConfig): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.conformance.JspbEncodingConfig { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.conformance.JspbEncodingConfigInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.conformance.JspbEncodingConfigInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +operator fun com.google.protobuf.conformance.TestStatus.Companion.invoke(body: com.google.protobuf.conformance.TestStatusInternal.() -> Unit): com.google.protobuf.conformance.TestStatus { + val msg = com.google.protobuf.conformance.TestStatusInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf.conformance.FailureSet.Companion.invoke(body: com.google.protobuf.conformance.FailureSetInternal.() -> Unit): com.google.protobuf.conformance.FailureSet { + val msg = com.google.protobuf.conformance.FailureSetInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf.conformance.ConformanceRequest.Companion.invoke(body: com.google.protobuf.conformance.ConformanceRequestInternal.() -> Unit): com.google.protobuf.conformance.ConformanceRequest { + val msg = com.google.protobuf.conformance.ConformanceRequestInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf.conformance.ConformanceResponse.Companion.invoke(body: com.google.protobuf.conformance.ConformanceResponseInternal.() -> Unit): com.google.protobuf.conformance.ConformanceResponse { + val msg = com.google.protobuf.conformance.ConformanceResponseInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf.conformance.JspbEncodingConfig.Companion.invoke(body: com.google.protobuf.conformance.JspbEncodingConfigInternal.() -> Unit): com.google.protobuf.conformance.JspbEncodingConfig { + val msg = com.google.protobuf.conformance.JspbEncodingConfigInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.TestStatusInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.TestStatusInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (failureMessage.isNotEmpty()) { + encoder.writeString(fieldNr = 2, value = failureMessage) + } + + if (matchedName.isNotEmpty()) { + encoder.writeString(fieldNr = 3, value = matchedName) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.TestStatusInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.TestStatusInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.failureMessage = decoder.readString() + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.matchedName = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.conformance.TestStatusInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (failureMessage.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(failureMessage).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (matchedName.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(matchedName).let { kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.TestStatus.asInternal(): com.google.protobuf.conformance.TestStatusInternal { + return this as? com.google.protobuf.conformance.TestStatusInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.FailureSetInternal.checkRequiredFields() { + // no required fields to check + test.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.FailureSetInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (test.isNotEmpty()) { + test.forEach { + encoder.writeMessage(fieldNr = 2, value = it.asInternal()) { encodeWith(it) } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.FailureSetInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.FailureSetInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.conformance.TestStatusInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.conformance.TestStatusInternal::decodeWith) + (msg.test as MutableList).add(elem) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.conformance.FailureSetInternal.computeSize(): Int { + var __result = 0 + if (test.isNotEmpty()) { + __result = test.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.FailureSet.asInternal(): com.google.protobuf.conformance.FailureSetInternal { + return this as? com.google.protobuf.conformance.FailureSetInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceRequestInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + jspbEncodingOptions.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceRequestInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (com.google.protobuf.conformance.WireFormat.UNSPECIFIED != requestedOutputFormat) { + encoder.writeEnum(fieldNr = 3, value = requestedOutputFormat.number) + } + + if (messageType.isNotEmpty()) { + encoder.writeString(fieldNr = 4, value = messageType) + } + + if (com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST != testCategory) { + encoder.writeEnum(fieldNr = 5, value = testCategory.number) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 6, value = jspbEncodingOptions.asInternal()) { encodeWith(it) } + } + + if (printUnknownFields != false) { + encoder.writeBool(fieldNr = 9, value = printUnknownFields) + } + + payload?.also { + when (val value = it) { + is com.google.protobuf.conformance.ConformanceRequest.Payload.ProtobufPayload -> { + encoder.writeBytes(fieldNr = 1, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.JsonPayload -> { + encoder.writeString(fieldNr = 2, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.JspbPayload -> { + encoder.writeString(fieldNr = 7, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.TextPayload -> { + encoder.writeString(fieldNr = 8, value = value.value) + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceRequestInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceRequestInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.requestedOutputFormat = com.google.protobuf.conformance.WireFormat.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.messageType = decoder.readString() + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.testCategory = com.google.protobuf.conformance.TestCategory.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.jspbEncodingOptions = com.google.protobuf.conformance.JspbEncodingConfigInternal() + } + + decoder.readMessage(msg.jspbEncodingOptions.asInternal(), com.google.protobuf.conformance.JspbEncodingConfigInternal::decodeWith) + } + + tag.fieldNr == 9 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.printUnknownFields = decoder.readBool() + } + + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.payload = com.google.protobuf.conformance.ConformanceRequest.Payload.ProtobufPayload(decoder.readBytes()) + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.payload = com.google.protobuf.conformance.ConformanceRequest.Payload.JsonPayload(decoder.readString()) + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.payload = com.google.protobuf.conformance.ConformanceRequest.Payload.JspbPayload(decoder.readString()) + } + + tag.fieldNr == 8 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.payload = com.google.protobuf.conformance.ConformanceRequest.Payload.TextPayload(decoder.readString()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.conformance.ConformanceRequestInternal.computeSize(): Int { + var __result = 0 + if (com.google.protobuf.conformance.WireFormat.UNSPECIFIED != requestedOutputFormat) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(requestedOutputFormat.number)) + } + + if (messageType.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(messageType).let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST != testCategory) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(testCategory.number)) + } + + if (presenceMask[0]) { + __result += jspbEncodingOptions.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (printUnknownFields != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(9, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(printUnknownFields)) + } + + payload?.also { + when (val value = it) { + is com.google.protobuf.conformance.ConformanceRequest.Payload.ProtobufPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.JsonPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.JspbPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceRequest.Payload.TextPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(8, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceRequest.asInternal(): com.google.protobuf.conformance.ConformanceRequestInternal { + return this as? com.google.protobuf.conformance.ConformanceRequestInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceResponseInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceResponseInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + result?.also { + when (val value = it) { + is com.google.protobuf.conformance.ConformanceResponse.Result.ParseError -> { + encoder.writeString(fieldNr = 1, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.SerializeError -> { + encoder.writeString(fieldNr = 6, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.TimeoutError -> { + encoder.writeString(fieldNr = 9, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.RuntimeError -> { + encoder.writeString(fieldNr = 2, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.ProtobufPayload -> { + encoder.writeBytes(fieldNr = 3, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.JsonPayload -> { + encoder.writeString(fieldNr = 4, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.Skipped -> { + encoder.writeString(fieldNr = 5, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.JspbPayload -> { + encoder.writeString(fieldNr = 7, value = value.value) + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.TextPayload -> { + encoder.writeString(fieldNr = 8, value = value.value) + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceResponseInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceResponseInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.ParseError(decoder.readString()) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.SerializeError(decoder.readString()) + } + + tag.fieldNr == 9 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.TimeoutError(decoder.readString()) + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.RuntimeError(decoder.readString()) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.ProtobufPayload(decoder.readBytes()) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.JsonPayload(decoder.readString()) + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.Skipped(decoder.readString()) + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.JspbPayload(decoder.readString()) + } + + tag.fieldNr == 8 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.result = com.google.protobuf.conformance.ConformanceResponse.Result.TextPayload(decoder.readString()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.conformance.ConformanceResponseInternal.computeSize(): Int { + var __result = 0 + result?.also { + when (val value = it) { + is com.google.protobuf.conformance.ConformanceResponse.Result.ParseError -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.SerializeError -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.TimeoutError -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(9, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.RuntimeError -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.ProtobufPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.JsonPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.Skipped -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.JspbPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.conformance.ConformanceResponse.Result.TextPayload -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(8, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.ConformanceResponse.asInternal(): com.google.protobuf.conformance.ConformanceResponseInternal { + return this as? com.google.protobuf.conformance.ConformanceResponseInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (useJspbArrayAnyFormat != false) { + encoder.writeBool(fieldNr = 1, value = useJspbArrayAnyFormat) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.JspbEncodingConfigInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.useJspbArrayAnyFormat = decoder.readBool() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.conformance.JspbEncodingConfigInternal.computeSize(): Int { + var __result = 0 + if (useJspbArrayAnyFormat != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(useJspbArrayAnyFormat)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.JspbEncodingConfig.asInternal(): com.google.protobuf.conformance.JspbEncodingConfigInternal { + return this as? com.google.protobuf.conformance.JspbEncodingConfigInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.WireFormat.Companion.fromNumber(number: Int): com.google.protobuf.conformance.WireFormat { + return when (number) { + 0 -> { + com.google.protobuf.conformance.WireFormat.UNSPECIFIED + } + + 1 -> { + com.google.protobuf.conformance.WireFormat.PROTOBUF + } + + 2 -> { + com.google.protobuf.conformance.WireFormat.JSON + } + + 3 -> { + com.google.protobuf.conformance.WireFormat.JSPB + } + + 4 -> { + com.google.protobuf.conformance.WireFormat.TEXT_FORMAT + } + + else -> { + com.google.protobuf.conformance.WireFormat.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.conformance.TestCategory.Companion.fromNumber(number: Int): com.google.protobuf.conformance.TestCategory { + return when (number) { + 0 -> { + com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST + } + + 1 -> { + com.google.protobuf.conformance.TestCategory.BINARY_TEST + } + + 2 -> { + com.google.protobuf.conformance.TestCategory.JSON_TEST + } + + 3 -> { + com.google.protobuf.conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST + } + + 4 -> { + com.google.protobuf.conformance.TestCategory.JSPB_TEST + } + + 5 -> { + com.google.protobuf.conformance.TestCategory.TEXT_FORMAT_TEST + } + + else -> { + com.google.protobuf.conformance.TestCategory.UNRECOGNIZED(number) + } + } +} + diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt new file mode 100644 index 000000000..555f22469 --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt @@ -0,0 +1,277 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf_test_messages.editions.proto3 + +import com.google.protobuf.* +import kotlin.jvm.JvmInline +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.CODEC::class) +interface TestAllTypesProto3 { + val optionalInt32: Int + val optionalInt64: Long + val optionalUint32: UInt + val optionalUint64: ULong + val optionalSint32: Int + val optionalSint64: Long + val optionalFixed32: UInt + val optionalFixed64: ULong + val optionalSfixed32: Int + val optionalSfixed64: Long + val optionalFloat: Float + val optionalDouble: Double + val optionalBool: Boolean + val optionalString: String + val optionalBytes: ByteArray + val optionalNestedMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage + val optionalForeignMessage: com.google.protobuf_test_messages.editions.proto3.ForeignMessage + val optionalNestedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum + val optionalForeignEnum: com.google.protobuf_test_messages.editions.proto3.ForeignEnum + val optionalAliasedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum + val optionalStringPiece: String + val optionalCord: String + val recursiveMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 + val repeatedInt32: List + val repeatedInt64: List + val repeatedUint32: List + val repeatedUint64: List + val repeatedSint32: List + val repeatedSint64: List + val repeatedFixed32: List + val repeatedFixed64: List + val repeatedSfixed32: List + val repeatedSfixed64: List + val repeatedFloat: List + val repeatedDouble: List + val repeatedBool: List + val repeatedString: List + val repeatedBytes: List + val repeatedNestedMessage: List + val repeatedForeignMessage: List + val repeatedNestedEnum: List + val repeatedForeignEnum: List + val repeatedStringPiece: List + val repeatedCord: List + val packedInt32: List + val packedInt64: List + val packedUint32: List + val packedUint64: List + val packedSint32: List + val packedSint64: List + val packedFixed32: List + val packedFixed64: List + val packedSfixed32: List + val packedSfixed64: List + val packedFloat: List + val packedDouble: List + val packedBool: List + val packedNestedEnum: List + val unpackedInt32: List + val unpackedInt64: List + val unpackedUint32: List + val unpackedUint64: List + val unpackedSint32: List + val unpackedSint64: List + val unpackedFixed32: List + val unpackedFixed64: List + val unpackedSfixed32: List + val unpackedSfixed64: List + val unpackedFloat: List + val unpackedDouble: List + val unpackedBool: List + val unpackedNestedEnum: List + val mapInt32Int32: Map + val mapInt64Int64: Map + val mapUint32Uint32: Map + val mapUint64Uint64: Map + val mapSint32Sint32: Map + val mapSint64Sint64: Map + val mapFixed32Fixed32: Map + val mapFixed64Fixed64: Map + val mapSfixed32Sfixed32: Map + val mapSfixed64Sfixed64: Map + val mapInt32Float: Map + val mapInt32Double: Map + val mapBoolBool: Map + val mapStringString: Map + val mapStringBytes: Map + val mapStringNestedMessage: Map + val mapStringForeignMessage: Map + val mapStringNestedEnum: Map + val mapStringForeignEnum: Map + val optionalBoolWrapper: com.google.protobuf.BoolValue + val optionalInt32Wrapper: com.google.protobuf.Int32Value + val optionalInt64Wrapper: com.google.protobuf.Int64Value + val optionalUint32Wrapper: com.google.protobuf.UInt32Value + val optionalUint64Wrapper: com.google.protobuf.UInt64Value + val optionalFloatWrapper: com.google.protobuf.FloatValue + val optionalDoubleWrapper: com.google.protobuf.DoubleValue + val optionalStringWrapper: com.google.protobuf.StringValue + val optionalBytesWrapper: com.google.protobuf.BytesValue + val repeatedBoolWrapper: List + val repeatedInt32Wrapper: List + val repeatedInt64Wrapper: List + val repeatedUint32Wrapper: List + val repeatedUint64Wrapper: List + val repeatedFloatWrapper: List + val repeatedDoubleWrapper: List + val repeatedStringWrapper: List + val repeatedBytesWrapper: List + val optionalDuration: com.google.protobuf.Duration + val optionalTimestamp: com.google.protobuf.Timestamp + val optionalFieldMask: com.google.protobuf.FieldMask + val optionalStruct: com.google.protobuf.Struct + val optionalAny: com.google.protobuf.Any + val optionalValue: com.google.protobuf.Value + val optionalNullValue: com.google.protobuf.NullValue + val repeatedDuration: List + val repeatedTimestamp: List + val repeatedFieldmask: List + val repeatedStruct: List + val repeatedAny: List + val repeatedValue: List + val repeatedListValue: List + val fieldname1: Int + val fieldName2: Int + val FieldName3: Int + val field_Name4_: Int + val field0name5: Int + val field_0Name6: Int + val fieldName7: Int + val FieldName8: Int + val field_Name9: Int + val Field_Name10: Int + val FIELD_NAME11: Int + val FIELDName12: Int + val _FieldName13: Int + val __FieldName14: Int + val field_Name15: Int + val field__Name16: Int + val fieldName17__: Int + val FieldName18__: Int + val oneofField: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField? + + sealed interface OneofField { + @JvmInline + value class OneofUint32(val value: UInt): OneofField + + @JvmInline + value class OneofNestedMessage( + val value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage, + ): OneofField + + @JvmInline + value class OneofString(val value: String): OneofField + + @JvmInline + value class OneofBytes(val value: ByteArray): OneofField + + @JvmInline + value class OneofBool(val value: Boolean): OneofField + + @JvmInline + value class OneofUint64(val value: ULong): OneofField + + @JvmInline + value class OneofFloat(val value: Float): OneofField + + @JvmInline + value class OneofDouble(val value: Double): OneofField + + @JvmInline + value class OneofEnum( + val value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum, + ): OneofField + + @JvmInline + value class OneofNullValue(val value: com.google.protobuf.NullValue): OneofField + } + + @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.CODEC::class) + interface NestedMessage { + val a: Int + val corecursive: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 + + companion object + } + + sealed class NestedEnum(open val number: Int) { + object FOO: NestedEnum(number = 0) + + object BAR: NestedEnum(number = 1) + + object BAZ: NestedEnum(number = 2) + + object NEG: NestedEnum(number = -1) + + data class UNRECOGNIZED(override val number: Int): NestedEnum(number) + + companion object { + val entries: List by lazy { listOf(NEG, FOO, BAR, BAZ) } + } + } + + sealed class AliasedEnum(open val number: Int) { + object ALIAS_FOO: AliasedEnum(number = 0) + + object ALIAS_BAR: AliasedEnum(number = 1) + + object ALIAS_BAZ: AliasedEnum(number = 2) + + data class UNRECOGNIZED(override val number: Int): AliasedEnum(number) + + companion object { + val MOO: AliasedEnum get() = ALIAS_BAZ + val moo: AliasedEnum get() = ALIAS_BAZ + val bAz: AliasedEnum get() = ALIAS_BAZ + val entries: List by lazy { listOf(ALIAS_FOO, ALIAS_BAR, ALIAS_BAZ) } + } + } + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.CODEC::class) +interface ForeignMessage { + val c: Int + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.CODEC::class) +interface NullHypothesisProto3 { + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.CODEC::class) +interface EnumOnlyProto3 { + + sealed class Bool(open val number: Int) { + object kFalse: Bool(number = 0) + + object kTrue: Bool(number = 1) + + data class UNRECOGNIZED(override val number: Int): Bool(number) + + companion object { + val entries: List by lazy { listOf(kFalse, kTrue) } + } + } + + companion object +} + +sealed class ForeignEnum(open val number: Int) { + object FOREIGN_FOO: ForeignEnum(number = 0) + + object FOREIGN_BAR: ForeignEnum(number = 1) + + object FOREIGN_BAZ: ForeignEnum(number = 2) + + data class UNRECOGNIZED(override val number: Int): ForeignEnum(number) + + companion object { + val entries: List by lazy { listOf(FOREIGN_FOO, FOREIGN_BAR, FOREIGN_BAZ) } + } +} + diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt new file mode 100644 index 000000000..7614fc00b --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt @@ -0,0 +1,4362 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf_test_messages.editions.proto3 + +import com.google.protobuf.* +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +@kotlinx.rpc.internal.utils.InternalRpcApi +class TestAllTypesProto3Internal: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 18) { + private object PresenceIndices { + const val optionalNestedMessage = 0 + const val optionalForeignMessage = 1 + const val recursiveMessage = 2 + const val optionalBoolWrapper = 3 + const val optionalInt32Wrapper = 4 + const val optionalInt64Wrapper = 5 + const val optionalUint32Wrapper = 6 + const val optionalUint64Wrapper = 7 + const val optionalFloatWrapper = 8 + const val optionalDoubleWrapper = 9 + const val optionalStringWrapper = 10 + const val optionalBytesWrapper = 11 + const val optionalDuration = 12 + const val optionalTimestamp = 13 + const val optionalFieldMask = 14 + const val optionalStruct = 15 + const val optionalAny = 16 + const val optionalValue = 17 + } + + override val _size: Int by lazy { computeSize() } + override var optionalInt32: Int by MsgFieldDelegate() { 0 } + override var optionalInt64: Long by MsgFieldDelegate() { 0L } + override var optionalUint32: UInt by MsgFieldDelegate() { 0u } + override var optionalUint64: ULong by MsgFieldDelegate() { 0uL } + override var optionalSint32: Int by MsgFieldDelegate() { 0 } + override var optionalSint64: Long by MsgFieldDelegate() { 0L } + override var optionalFixed32: UInt by MsgFieldDelegate() { 0u } + override var optionalFixed64: ULong by MsgFieldDelegate() { 0uL } + override var optionalSfixed32: Int by MsgFieldDelegate() { 0 } + override var optionalSfixed64: Long by MsgFieldDelegate() { 0L } + override var optionalFloat: Float by MsgFieldDelegate() { 0.0f } + override var optionalDouble: Double by MsgFieldDelegate() { 0.0 } + override var optionalBool: Boolean by MsgFieldDelegate() { false } + override var optionalString: String by MsgFieldDelegate() { "" } + override var optionalBytes: ByteArray by MsgFieldDelegate() { byteArrayOf() } + override var optionalNestedMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + override var optionalForeignMessage: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } + override var optionalNestedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } + override var optionalForeignEnum: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } + override var optionalAliasedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } + override var optionalStringPiece: String by MsgFieldDelegate() { "" } + override var optionalCord: String by MsgFieldDelegate() { "" } + override var recursiveMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } + override var repeatedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBool: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedString: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBytes: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedNestedMessage: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedForeignMessage: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedForeignEnum: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStringPiece: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedCord: List by MsgFieldDelegate() { mutableListOf() } + override var packedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var packedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var packedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var packedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var packedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var packedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var packedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var packedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var packedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var packedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var packedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var packedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var packedBool: List by MsgFieldDelegate() { mutableListOf() } + override var packedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedBool: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var mapInt32Int32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt64Int64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapUint32Uint32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapUint64Uint64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSint32Sint32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSint64Sint64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapFixed32Fixed32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapFixed64Fixed64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSfixed32Sfixed32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSfixed64Sfixed64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt32Float: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt32Double: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapBoolBool: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringString: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringBytes: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringNestedMessage: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringForeignMessage: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringNestedEnum: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringForeignEnum: Map by MsgFieldDelegate() { mutableMapOf() } + override var optionalBoolWrapper: com.google.protobuf.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.BoolValueInternal() } + override var optionalInt32Wrapper: com.google.protobuf.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.Int32ValueInternal() } + override var optionalInt64Wrapper: com.google.protobuf.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.Int64ValueInternal() } + override var optionalUint32Wrapper: com.google.protobuf.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.UInt32ValueInternal() } + override var optionalUint64Wrapper: com.google.protobuf.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.UInt64ValueInternal() } + override var optionalFloatWrapper: com.google.protobuf.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.FloatValueInternal() } + override var optionalDoubleWrapper: com.google.protobuf.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.DoubleValueInternal() } + override var optionalStringWrapper: com.google.protobuf.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.StringValueInternal() } + override var optionalBytesWrapper: com.google.protobuf.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.BytesValueInternal() } + override var repeatedBoolWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt32Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt64Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint32Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint64Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFloatWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedDoubleWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStringWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBytesWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var optionalDuration: com.google.protobuf.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.DurationInternal() } + override var optionalTimestamp: com.google.protobuf.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.TimestampInternal() } + override var optionalFieldMask: com.google.protobuf.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.FieldMaskInternal() } + override var optionalStruct: com.google.protobuf.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.StructInternal() } + override var optionalAny: com.google.protobuf.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.AnyInternal() } + override var optionalValue: com.google.protobuf.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.ValueInternal() } + override var optionalNullValue: com.google.protobuf.NullValue by MsgFieldDelegate() { com.google.protobuf.NullValue.NULL_VALUE } + override var repeatedDuration: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedTimestamp: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFieldmask: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStruct: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedAny: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedValue: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedListValue: List by MsgFieldDelegate() { mutableListOf() } + override var fieldname1: Int by MsgFieldDelegate() { 0 } + override var fieldName2: Int by MsgFieldDelegate() { 0 } + override var FieldName3: Int by MsgFieldDelegate() { 0 } + override var field_Name4_: Int by MsgFieldDelegate() { 0 } + override var field0name5: Int by MsgFieldDelegate() { 0 } + override var field_0Name6: Int by MsgFieldDelegate() { 0 } + override var fieldName7: Int by MsgFieldDelegate() { 0 } + override var FieldName8: Int by MsgFieldDelegate() { 0 } + override var field_Name9: Int by MsgFieldDelegate() { 0 } + override var Field_Name10: Int by MsgFieldDelegate() { 0 } + override var FIELD_NAME11: Int by MsgFieldDelegate() { 0 } + override var FIELDName12: Int by MsgFieldDelegate() { 0 } + override var _FieldName13: Int by MsgFieldDelegate() { 0 } + override var __FieldName14: Int by MsgFieldDelegate() { 0 } + override var field_Name15: Int by MsgFieldDelegate() { 0 } + override var field__Name16: Int by MsgFieldDelegate() { 0 } + override var fieldName17__: Int by MsgFieldDelegate() { 0 } + override var FieldName18__: Int by MsgFieldDelegate() { 0 } + override var oneofField: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField? = null + @kotlinx.rpc.internal.utils.InternalRpcApi + class NestedMessageInternal: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val corecursive = 0 + } + + override val _size: Int by lazy { computeSize() } + override var a: Int by MsgFieldDelegate() { 0 } + override var corecursive: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32Int32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt64Int64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapUint32Uint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: UInt by MsgFieldDelegate() { 0u } + var value: UInt by MsgFieldDelegate() { 0u } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapUint64Uint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: ULong by MsgFieldDelegate() { 0uL } + var value: ULong by MsgFieldDelegate() { 0uL } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSint32Sint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSint64Sint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapFixed32Fixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: UInt by MsgFieldDelegate() { 0u } + var value: UInt by MsgFieldDelegate() { 0u } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapFixed64Fixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: ULong by MsgFieldDelegate() { 0uL } + var value: ULong by MsgFieldDelegate() { 0uL } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSfixed32Sfixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSfixed64Sfixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32FloatEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Float by MsgFieldDelegate() { 0.0f } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32DoubleEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Double by MsgFieldDelegate() { 0.0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapBoolBoolEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Boolean by MsgFieldDelegate() { false } + var value: Boolean by MsgFieldDelegate() { false } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringStringEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: String by MsgFieldDelegate() { "" } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringBytesEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: ByteArray by MsgFieldDelegate() { byteArrayOf() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringNestedMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val value = 0 + } + + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringForeignMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val value = 0 + } + + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringNestedEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringForeignEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } + companion object + } + + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class ForeignMessageInternal: com.google.protobuf_test_messages.editions.proto3.ForeignMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var c: Int by MsgFieldDelegate() { 0 } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.editions.proto3.ForeignMessage): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.editions.proto3.ForeignMessage { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class NullHypothesisProto3Internal: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class EnumOnlyProto3Internal: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +operator fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.Companion.invoke(body: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.() -> Unit): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 { + val msg = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.editions.proto3.ForeignMessage.Companion.invoke(body: com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.() -> Unit): com.google.protobuf_test_messages.editions.proto3.ForeignMessage { + val msg = com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3.Companion.invoke(body: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.() -> Unit): com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3 { + val msg = com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Companion.invoke(body: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.() -> Unit): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3 { + val msg = com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage.Companion.invoke(body: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.() -> Unit): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage { + val msg = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + optionalNestedMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[1]) { + optionalForeignMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[2]) { + recursiveMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[3]) { + optionalBoolWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[4]) { + optionalInt32Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[5]) { + optionalInt64Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[6]) { + optionalUint32Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[7]) { + optionalUint64Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[8]) { + optionalFloatWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[9]) { + optionalDoubleWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[10]) { + optionalStringWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[11]) { + optionalBytesWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[12]) { + optionalDuration.asInternal().checkRequiredFields() + } + + if (presenceMask[13]) { + optionalTimestamp.asInternal().checkRequiredFields() + } + + if (presenceMask[14]) { + optionalFieldMask.asInternal().checkRequiredFields() + } + + if (presenceMask[15]) { + optionalStruct.asInternal().checkRequiredFields() + } + + if (presenceMask[16]) { + optionalAny.asInternal().checkRequiredFields() + } + + if (presenceMask[17]) { + optionalValue.asInternal().checkRequiredFields() + } + + oneofField?.also { + when { + it is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + it.value.asInternal().checkRequiredFields() + } + } + } + + repeatedNestedMessage.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedForeignMessage.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedBoolWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedInt32Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedInt64Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedUint32Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedUint64Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedFloatWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedDoubleWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedStringWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedBytesWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedDuration.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedTimestamp.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedFieldmask.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedStruct.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedAny.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedValue.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedListValue.forEach { + it.asInternal().checkRequiredFields() + } + + mapStringNestedMessage.values.forEach { + it.asInternal().checkRequiredFields() + } + + mapStringForeignMessage.values.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (optionalInt32 != 0) { + encoder.writeInt32(fieldNr = 1, value = optionalInt32) + } + + if (optionalInt64 != 0L) { + encoder.writeInt64(fieldNr = 2, value = optionalInt64) + } + + if (optionalUint32 != 0u) { + encoder.writeUInt32(fieldNr = 3, value = optionalUint32) + } + + if (optionalUint64 != 0uL) { + encoder.writeUInt64(fieldNr = 4, value = optionalUint64) + } + + if (optionalSint32 != 0) { + encoder.writeSInt32(fieldNr = 5, value = optionalSint32) + } + + if (optionalSint64 != 0L) { + encoder.writeSInt64(fieldNr = 6, value = optionalSint64) + } + + if (optionalFixed32 != 0u) { + encoder.writeFixed32(fieldNr = 7, value = optionalFixed32) + } + + if (optionalFixed64 != 0uL) { + encoder.writeFixed64(fieldNr = 8, value = optionalFixed64) + } + + if (optionalSfixed32 != 0) { + encoder.writeSFixed32(fieldNr = 9, value = optionalSfixed32) + } + + if (optionalSfixed64 != 0L) { + encoder.writeSFixed64(fieldNr = 10, value = optionalSfixed64) + } + + if (optionalFloat != 0.0f) { + encoder.writeFloat(fieldNr = 11, value = optionalFloat) + } + + if (optionalDouble != 0.0) { + encoder.writeDouble(fieldNr = 12, value = optionalDouble) + } + + if (optionalBool != false) { + encoder.writeBool(fieldNr = 13, value = optionalBool) + } + + if (optionalString.isNotEmpty()) { + encoder.writeString(fieldNr = 14, value = optionalString) + } + + if (optionalBytes.isNotEmpty()) { + encoder.writeBytes(fieldNr = 15, value = optionalBytes) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 18, value = optionalNestedMessage.asInternal()) { encodeWith(it) } + } + + if (presenceMask[1]) { + encoder.writeMessage(fieldNr = 19, value = optionalForeignMessage.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG != optionalNestedEnum) { + encoder.writeEnum(fieldNr = 21, value = optionalNestedEnum.number) + } + + if (com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO != optionalForeignEnum) { + encoder.writeEnum(fieldNr = 22, value = optionalForeignEnum.number) + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO != optionalAliasedEnum) { + encoder.writeEnum(fieldNr = 23, value = optionalAliasedEnum.number) + } + + if (optionalStringPiece.isNotEmpty()) { + encoder.writeString(fieldNr = 24, value = optionalStringPiece) + } + + if (optionalCord.isNotEmpty()) { + encoder.writeString(fieldNr = 25, value = optionalCord) + } + + if (presenceMask[2]) { + encoder.writeMessage(fieldNr = 27, value = recursiveMessage.asInternal()) { encodeWith(it) } + } + + if (repeatedInt32.isNotEmpty()) { + encoder.writePackedInt32(fieldNr = 31, value = repeatedInt32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt32(repeatedInt32)) + } + + if (repeatedInt64.isNotEmpty()) { + encoder.writePackedInt64(fieldNr = 32, value = repeatedInt64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt64(repeatedInt64)) + } + + if (repeatedUint32.isNotEmpty()) { + encoder.writePackedUInt32(fieldNr = 33, value = repeatedUint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(repeatedUint32)) + } + + if (repeatedUint64.isNotEmpty()) { + encoder.writePackedUInt64(fieldNr = 34, value = repeatedUint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(repeatedUint64)) + } + + if (repeatedSint32.isNotEmpty()) { + encoder.writePackedSInt32(fieldNr = 35, value = repeatedSint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(repeatedSint32)) + } + + if (repeatedSint64.isNotEmpty()) { + encoder.writePackedSInt64(fieldNr = 36, value = repeatedSint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(repeatedSint64)) + } + + if (repeatedFixed32.isNotEmpty()) { + encoder.writePackedFixed32(fieldNr = 37, value = repeatedFixed32) + } + + if (repeatedFixed64.isNotEmpty()) { + encoder.writePackedFixed64(fieldNr = 38, value = repeatedFixed64) + } + + if (repeatedSfixed32.isNotEmpty()) { + encoder.writePackedSFixed32(fieldNr = 39, value = repeatedSfixed32) + } + + if (repeatedSfixed64.isNotEmpty()) { + encoder.writePackedSFixed64(fieldNr = 40, value = repeatedSfixed64) + } + + if (repeatedFloat.isNotEmpty()) { + encoder.writePackedFloat(fieldNr = 41, value = repeatedFloat) + } + + if (repeatedDouble.isNotEmpty()) { + encoder.writePackedDouble(fieldNr = 42, value = repeatedDouble) + } + + if (repeatedBool.isNotEmpty()) { + encoder.writePackedBool(fieldNr = 43, value = repeatedBool, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedBool(repeatedBool)) + } + + if (repeatedString.isNotEmpty()) { + repeatedString.forEach { + encoder.writeString(44, it) + } + } + + if (repeatedBytes.isNotEmpty()) { + repeatedBytes.forEach { + encoder.writeBytes(45, it) + } + } + + if (repeatedNestedMessage.isNotEmpty()) { + repeatedNestedMessage.forEach { + encoder.writeMessage(fieldNr = 48, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedForeignMessage.isNotEmpty()) { + repeatedForeignMessage.forEach { + encoder.writeMessage(fieldNr = 49, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedNestedEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum)) + } + + if (repeatedForeignEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum)) + } + + if (repeatedStringPiece.isNotEmpty()) { + repeatedStringPiece.forEach { + encoder.writeString(54, it) + } + } + + if (repeatedCord.isNotEmpty()) { + repeatedCord.forEach { + encoder.writeString(55, it) + } + } + + if (packedInt32.isNotEmpty()) { + encoder.writePackedInt32(fieldNr = 75, value = packedInt32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt32(packedInt32)) + } + + if (packedInt64.isNotEmpty()) { + encoder.writePackedInt64(fieldNr = 76, value = packedInt64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt64(packedInt64)) + } + + if (packedUint32.isNotEmpty()) { + encoder.writePackedUInt32(fieldNr = 77, value = packedUint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(packedUint32)) + } + + if (packedUint64.isNotEmpty()) { + encoder.writePackedUInt64(fieldNr = 78, value = packedUint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(packedUint64)) + } + + if (packedSint32.isNotEmpty()) { + encoder.writePackedSInt32(fieldNr = 79, value = packedSint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(packedSint32)) + } + + if (packedSint64.isNotEmpty()) { + encoder.writePackedSInt64(fieldNr = 80, value = packedSint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(packedSint64)) + } + + if (packedFixed32.isNotEmpty()) { + encoder.writePackedFixed32(fieldNr = 81, value = packedFixed32) + } + + if (packedFixed64.isNotEmpty()) { + encoder.writePackedFixed64(fieldNr = 82, value = packedFixed64) + } + + if (packedSfixed32.isNotEmpty()) { + encoder.writePackedSFixed32(fieldNr = 83, value = packedSfixed32) + } + + if (packedSfixed64.isNotEmpty()) { + encoder.writePackedSFixed64(fieldNr = 84, value = packedSfixed64) + } + + if (packedFloat.isNotEmpty()) { + encoder.writePackedFloat(fieldNr = 85, value = packedFloat) + } + + if (packedDouble.isNotEmpty()) { + encoder.writePackedDouble(fieldNr = 86, value = packedDouble) + } + + if (packedBool.isNotEmpty()) { + encoder.writePackedBool(fieldNr = 87, value = packedBool, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedBool(packedBool)) + } + + if (packedNestedEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum)) + } + + if (unpackedInt32.isNotEmpty()) { + unpackedInt32.forEach { + encoder.writeInt32(89, it) + } + } + + if (unpackedInt64.isNotEmpty()) { + unpackedInt64.forEach { + encoder.writeInt64(90, it) + } + } + + if (unpackedUint32.isNotEmpty()) { + unpackedUint32.forEach { + encoder.writeUInt32(91, it) + } + } + + if (unpackedUint64.isNotEmpty()) { + unpackedUint64.forEach { + encoder.writeUInt64(92, it) + } + } + + if (unpackedSint32.isNotEmpty()) { + unpackedSint32.forEach { + encoder.writeSInt32(93, it) + } + } + + if (unpackedSint64.isNotEmpty()) { + unpackedSint64.forEach { + encoder.writeSInt64(94, it) + } + } + + if (unpackedFixed32.isNotEmpty()) { + unpackedFixed32.forEach { + encoder.writeFixed32(95, it) + } + } + + if (unpackedFixed64.isNotEmpty()) { + unpackedFixed64.forEach { + encoder.writeFixed64(96, it) + } + } + + if (unpackedSfixed32.isNotEmpty()) { + unpackedSfixed32.forEach { + encoder.writeSFixed32(97, it) + } + } + + if (unpackedSfixed64.isNotEmpty()) { + unpackedSfixed64.forEach { + encoder.writeSFixed64(98, it) + } + } + + if (unpackedFloat.isNotEmpty()) { + unpackedFloat.forEach { + encoder.writeFloat(99, it) + } + } + + if (unpackedDouble.isNotEmpty()) { + unpackedDouble.forEach { + encoder.writeDouble(100, it) + } + } + + if (unpackedBool.isNotEmpty()) { + unpackedBool.forEach { + encoder.writeBool(101, it) + } + } + + if (unpackedNestedEnum.isNotEmpty()) { + unpackedNestedEnum.forEach { + encoder.writeEnum(102, it) + } + } + + if (mapInt32Int32.isNotEmpty()) { + mapInt32Int32.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 56, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt64Int64.isNotEmpty()) { + mapInt64Int64.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 57, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapUint32Uint32.isNotEmpty()) { + mapUint32Uint32.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 58, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapUint64Uint64.isNotEmpty()) { + mapUint64Uint64.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 59, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSint32Sint32.isNotEmpty()) { + mapSint32Sint32.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 60, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSint64Sint64.isNotEmpty()) { + mapSint64Sint64.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 61, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapFixed32Fixed32.isNotEmpty()) { + mapFixed32Fixed32.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 62, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapFixed64Fixed64.isNotEmpty()) { + mapFixed64Fixed64.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 63, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSfixed32Sfixed32.isNotEmpty()) { + mapSfixed32Sfixed32.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 64, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSfixed64Sfixed64.isNotEmpty()) { + mapSfixed64Sfixed64.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 65, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt32Float.isNotEmpty()) { + mapInt32Float.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 66, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt32Double.isNotEmpty()) { + mapInt32Double.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 67, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapBoolBool.isNotEmpty()) { + mapBoolBool.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 68, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringString.isNotEmpty()) { + mapStringString.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 69, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringBytes.isNotEmpty()) { + mapStringBytes.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 70, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringNestedMessage.isNotEmpty()) { + mapStringNestedMessage.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 71, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringForeignMessage.isNotEmpty()) { + mapStringForeignMessage.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 72, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringNestedEnum.isNotEmpty()) { + mapStringNestedEnum.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 73, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringForeignEnum.isNotEmpty()) { + mapStringForeignEnum.forEach { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 74, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (presenceMask[3]) { + encoder.writeMessage(fieldNr = 201, value = optionalBoolWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[4]) { + encoder.writeMessage(fieldNr = 202, value = optionalInt32Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[5]) { + encoder.writeMessage(fieldNr = 203, value = optionalInt64Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[6]) { + encoder.writeMessage(fieldNr = 204, value = optionalUint32Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[7]) { + encoder.writeMessage(fieldNr = 205, value = optionalUint64Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[8]) { + encoder.writeMessage(fieldNr = 206, value = optionalFloatWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[9]) { + encoder.writeMessage(fieldNr = 207, value = optionalDoubleWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[10]) { + encoder.writeMessage(fieldNr = 208, value = optionalStringWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[11]) { + encoder.writeMessage(fieldNr = 209, value = optionalBytesWrapper.asInternal()) { encodeWith(it) } + } + + if (repeatedBoolWrapper.isNotEmpty()) { + repeatedBoolWrapper.forEach { + encoder.writeMessage(fieldNr = 211, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedInt32Wrapper.isNotEmpty()) { + repeatedInt32Wrapper.forEach { + encoder.writeMessage(fieldNr = 212, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedInt64Wrapper.isNotEmpty()) { + repeatedInt64Wrapper.forEach { + encoder.writeMessage(fieldNr = 213, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedUint32Wrapper.isNotEmpty()) { + repeatedUint32Wrapper.forEach { + encoder.writeMessage(fieldNr = 214, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedUint64Wrapper.isNotEmpty()) { + repeatedUint64Wrapper.forEach { + encoder.writeMessage(fieldNr = 215, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedFloatWrapper.isNotEmpty()) { + repeatedFloatWrapper.forEach { + encoder.writeMessage(fieldNr = 216, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedDoubleWrapper.isNotEmpty()) { + repeatedDoubleWrapper.forEach { + encoder.writeMessage(fieldNr = 217, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedStringWrapper.isNotEmpty()) { + repeatedStringWrapper.forEach { + encoder.writeMessage(fieldNr = 218, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedBytesWrapper.isNotEmpty()) { + repeatedBytesWrapper.forEach { + encoder.writeMessage(fieldNr = 219, value = it.asInternal()) { encodeWith(it) } + } + } + + if (presenceMask[12]) { + encoder.writeMessage(fieldNr = 301, value = optionalDuration.asInternal()) { encodeWith(it) } + } + + if (presenceMask[13]) { + encoder.writeMessage(fieldNr = 302, value = optionalTimestamp.asInternal()) { encodeWith(it) } + } + + if (presenceMask[14]) { + encoder.writeMessage(fieldNr = 303, value = optionalFieldMask.asInternal()) { encodeWith(it) } + } + + if (presenceMask[15]) { + encoder.writeMessage(fieldNr = 304, value = optionalStruct.asInternal()) { encodeWith(it) } + } + + if (presenceMask[16]) { + encoder.writeMessage(fieldNr = 305, value = optionalAny.asInternal()) { encodeWith(it) } + } + + if (presenceMask[17]) { + encoder.writeMessage(fieldNr = 306, value = optionalValue.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + encoder.writeEnum(fieldNr = 307, value = optionalNullValue.number) + } + + if (repeatedDuration.isNotEmpty()) { + repeatedDuration.forEach { + encoder.writeMessage(fieldNr = 311, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedTimestamp.isNotEmpty()) { + repeatedTimestamp.forEach { + encoder.writeMessage(fieldNr = 312, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedFieldmask.isNotEmpty()) { + repeatedFieldmask.forEach { + encoder.writeMessage(fieldNr = 313, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedStruct.isNotEmpty()) { + repeatedStruct.forEach { + encoder.writeMessage(fieldNr = 324, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedAny.isNotEmpty()) { + repeatedAny.forEach { + encoder.writeMessage(fieldNr = 315, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedValue.isNotEmpty()) { + repeatedValue.forEach { + encoder.writeMessage(fieldNr = 316, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedListValue.isNotEmpty()) { + repeatedListValue.forEach { + encoder.writeMessage(fieldNr = 317, value = it.asInternal()) { encodeWith(it) } + } + } + + if (fieldname1 != 0) { + encoder.writeInt32(fieldNr = 401, value = fieldname1) + } + + if (fieldName2 != 0) { + encoder.writeInt32(fieldNr = 402, value = fieldName2) + } + + if (FieldName3 != 0) { + encoder.writeInt32(fieldNr = 403, value = FieldName3) + } + + if (field_Name4_ != 0) { + encoder.writeInt32(fieldNr = 404, value = field_Name4_) + } + + if (field0name5 != 0) { + encoder.writeInt32(fieldNr = 405, value = field0name5) + } + + if (field_0Name6 != 0) { + encoder.writeInt32(fieldNr = 406, value = field_0Name6) + } + + if (fieldName7 != 0) { + encoder.writeInt32(fieldNr = 407, value = fieldName7) + } + + if (FieldName8 != 0) { + encoder.writeInt32(fieldNr = 408, value = FieldName8) + } + + if (field_Name9 != 0) { + encoder.writeInt32(fieldNr = 409, value = field_Name9) + } + + if (Field_Name10 != 0) { + encoder.writeInt32(fieldNr = 410, value = Field_Name10) + } + + if (FIELD_NAME11 != 0) { + encoder.writeInt32(fieldNr = 411, value = FIELD_NAME11) + } + + if (FIELDName12 != 0) { + encoder.writeInt32(fieldNr = 412, value = FIELDName12) + } + + if (_FieldName13 != 0) { + encoder.writeInt32(fieldNr = 413, value = _FieldName13) + } + + if (__FieldName14 != 0) { + encoder.writeInt32(fieldNr = 414, value = __FieldName14) + } + + if (field_Name15 != 0) { + encoder.writeInt32(fieldNr = 415, value = field_Name15) + } + + if (field__Name16 != 0) { + encoder.writeInt32(fieldNr = 416, value = field__Name16) + } + + if (fieldName17__ != 0) { + encoder.writeInt32(fieldNr = 417, value = fieldName17__) + } + + if (FieldName18__ != 0) { + encoder.writeInt32(fieldNr = 418, value = FieldName18__) + } + + oneofField?.also { + when (val value = it) { + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint32 -> { + encoder.writeUInt32(fieldNr = 111, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + encoder.writeMessage(fieldNr = 112, value = value.value.asInternal()) { encodeWith(it) } + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofString -> { + encoder.writeString(fieldNr = 113, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBytes -> { + encoder.writeBytes(fieldNr = 114, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBool -> { + encoder.writeBool(fieldNr = 115, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint64 -> { + encoder.writeUInt64(fieldNr = 116, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofFloat -> { + encoder.writeFloat(fieldNr = 117, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofDouble -> { + encoder.writeDouble(fieldNr = 118, value = value.value) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofEnum -> { + encoder.writeEnum(fieldNr = 119, value = value.value.number) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNullValue -> { + encoder.writeEnum(fieldNr = 120, value = value.value.number) + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalInt32 = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalInt64 = decoder.readInt64() + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalUint32 = decoder.readUInt32() + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalUint64 = decoder.readUInt64() + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalSint32 = decoder.readSInt32() + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalSint64 = decoder.readSInt64() + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalFixed32 = decoder.readFixed32() + } + + tag.fieldNr == 8 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalFixed64 = decoder.readFixed64() + } + + tag.fieldNr == 9 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalSfixed32 = decoder.readSFixed32() + } + + tag.fieldNr == 10 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalSfixed64 = decoder.readSFixed64() + } + + tag.fieldNr == 11 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalFloat = decoder.readFloat() + } + + tag.fieldNr == 12 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalDouble = decoder.readDouble() + } + + tag.fieldNr == 13 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalBool = decoder.readBool() + } + + tag.fieldNr == 14 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalString = decoder.readString() + } + + tag.fieldNr == 15 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalBytes = decoder.readBytes() + } + + tag.fieldNr == 18 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.optionalNestedMessage = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + } + + decoder.readMessage(msg.optionalNestedMessage.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + tag.fieldNr == 19 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[1]) { + msg.optionalForeignMessage = com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() + } + + decoder.readMessage(msg.optionalForeignMessage.asInternal(), com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal::decodeWith) + } + + tag.fieldNr == 21 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalNestedEnum = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 22 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalForeignEnum = com.google.protobuf_test_messages.editions.proto3.ForeignEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 23 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalAliasedEnum = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 24 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalStringPiece = decoder.readString() + } + + tag.fieldNr == 25 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalCord = decoder.readString() + } + + tag.fieldNr == 27 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[2]) { + msg.recursiveMessage = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() + } + + decoder.readMessage(msg.recursiveMessage.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal::decodeWith) + } + + tag.fieldNr == 31 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedInt32 = decoder.readPackedInt32() + } + + tag.fieldNr == 32 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedInt64 = decoder.readPackedInt64() + } + + tag.fieldNr == 33 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedUint32 = decoder.readPackedUInt32() + } + + tag.fieldNr == 34 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedUint64 = decoder.readPackedUInt64() + } + + tag.fieldNr == 35 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSint32 = decoder.readPackedSInt32() + } + + tag.fieldNr == 36 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSint64 = decoder.readPackedSInt64() + } + + tag.fieldNr == 37 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFixed32 = decoder.readPackedFixed32() + } + + tag.fieldNr == 38 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFixed64 = decoder.readPackedFixed64() + } + + tag.fieldNr == 39 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSfixed32 = decoder.readPackedSFixed32() + } + + tag.fieldNr == 40 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSfixed64 = decoder.readPackedSFixed64() + } + + tag.fieldNr == 41 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFloat = decoder.readPackedFloat() + } + + tag.fieldNr == 42 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedDouble = decoder.readPackedDouble() + } + + tag.fieldNr == 43 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedBool = decoder.readPackedBool() + } + + tag.fieldNr == 44 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedString as MutableList).add(elem) + } + + tag.fieldNr == 45 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readBytes() + (msg.repeatedBytes as MutableList).add(elem) + } + + tag.fieldNr == 48 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + (msg.repeatedNestedMessage as MutableList).add(elem) + } + + tag.fieldNr == 49 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal::decodeWith) + (msg.repeatedForeignMessage as MutableList).add(elem) + } + + tag.fieldNr == 51 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedNestedEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 52 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedForeignEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 54 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedStringPiece as MutableList).add(elem) + } + + tag.fieldNr == 55 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedCord as MutableList).add(elem) + } + + tag.fieldNr == 75 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedInt32 = decoder.readPackedInt32() + } + + tag.fieldNr == 76 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedInt64 = decoder.readPackedInt64() + } + + tag.fieldNr == 77 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedUint32 = decoder.readPackedUInt32() + } + + tag.fieldNr == 78 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedUint64 = decoder.readPackedUInt64() + } + + tag.fieldNr == 79 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSint32 = decoder.readPackedSInt32() + } + + tag.fieldNr == 80 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSint64 = decoder.readPackedSInt64() + } + + tag.fieldNr == 81 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFixed32 = decoder.readPackedFixed32() + } + + tag.fieldNr == 82 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFixed64 = decoder.readPackedFixed64() + } + + tag.fieldNr == 83 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSfixed32 = decoder.readPackedSFixed32() + } + + tag.fieldNr == 84 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSfixed64 = decoder.readPackedSFixed64() + } + + tag.fieldNr == 85 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFloat = decoder.readPackedFloat() + } + + tag.fieldNr == 86 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedDouble = decoder.readPackedDouble() + } + + tag.fieldNr == 87 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedBool = decoder.readPackedBool() + } + + tag.fieldNr == 88 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedNestedEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 89 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readInt32() + (msg.unpackedInt32 as MutableList).add(elem) + } + + tag.fieldNr == 90 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readInt64() + (msg.unpackedInt64 as MutableList).add(elem) + } + + tag.fieldNr == 91 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readUInt32() + (msg.unpackedUint32 as MutableList).add(elem) + } + + tag.fieldNr == 92 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readUInt64() + (msg.unpackedUint64 as MutableList).add(elem) + } + + tag.fieldNr == 93 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readSInt32() + (msg.unpackedSint32 as MutableList).add(elem) + } + + tag.fieldNr == 94 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readSInt64() + (msg.unpackedSint64 as MutableList).add(elem) + } + + tag.fieldNr == 95 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readFixed32() + (msg.unpackedFixed32 as MutableList).add(elem) + } + + tag.fieldNr == 96 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readFixed64() + (msg.unpackedFixed64 as MutableList).add(elem) + } + + tag.fieldNr == 97 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readSFixed32() + (msg.unpackedSfixed32 as MutableList).add(elem) + } + + tag.fieldNr == 98 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readSFixed64() + (msg.unpackedSfixed64 as MutableList).add(elem) + } + + tag.fieldNr == 99 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readFloat() + (msg.unpackedFloat as MutableList).add(elem) + } + + tag.fieldNr == 100 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readDouble() + (msg.unpackedDouble as MutableList).add(elem) + } + + tag.fieldNr == 101 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readBool() + (msg.unpackedBool as MutableList).add(elem) + } + + tag.fieldNr == 102 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + (msg.unpackedNestedEnum as MutableList).add(elem) + } + + tag.fieldNr == 56 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal::decodeWith) + (msg.mapInt32Int32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 57 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal::decodeWith) + (msg.mapInt64Int64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 58 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal::decodeWith) + (msg.mapUint32Uint32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 59 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal::decodeWith) + (msg.mapUint64Uint64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 60 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal::decodeWith) + (msg.mapSint32Sint32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 61 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal::decodeWith) + (msg.mapSint64Sint64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 62 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal::decodeWith) + (msg.mapFixed32Fixed32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 63 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal::decodeWith) + (msg.mapFixed64Fixed64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 64 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal::decodeWith) + (msg.mapSfixed32Sfixed32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 65 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal::decodeWith) + (msg.mapSfixed64Sfixed64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 66 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal::decodeWith) + (msg.mapInt32Float as MutableMap)[key] = value + } + } + + tag.fieldNr == 67 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal::decodeWith) + (msg.mapInt32Double as MutableMap)[key] = value + } + } + + tag.fieldNr == 68 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal::decodeWith) + (msg.mapBoolBool as MutableMap)[key] = value + } + } + + tag.fieldNr == 69 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal::decodeWith) + (msg.mapStringString as MutableMap)[key] = value + } + } + + tag.fieldNr == 70 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal::decodeWith) + (msg.mapStringBytes as MutableMap)[key] = value + } + } + + tag.fieldNr == 71 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal::decodeWith) + (msg.mapStringNestedMessage as MutableMap)[key] = value + } + } + + tag.fieldNr == 72 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal::decodeWith) + (msg.mapStringForeignMessage as MutableMap)[key] = value + } + } + + tag.fieldNr == 73 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal::decodeWith) + (msg.mapStringNestedEnum as MutableMap)[key] = value + } + } + + tag.fieldNr == 74 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal::decodeWith) + (msg.mapStringForeignEnum as MutableMap)[key] = value + } + } + + tag.fieldNr == 201 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[3]) { + msg.optionalBoolWrapper = com.google.protobuf.BoolValueInternal() + } + + decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + } + + tag.fieldNr == 202 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[4]) { + msg.optionalInt32Wrapper = com.google.protobuf.Int32ValueInternal() + } + + decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + } + + tag.fieldNr == 203 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[5]) { + msg.optionalInt64Wrapper = com.google.protobuf.Int64ValueInternal() + } + + decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + } + + tag.fieldNr == 204 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[6]) { + msg.optionalUint32Wrapper = com.google.protobuf.UInt32ValueInternal() + } + + decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + } + + tag.fieldNr == 205 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[7]) { + msg.optionalUint64Wrapper = com.google.protobuf.UInt64ValueInternal() + } + + decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + } + + tag.fieldNr == 206 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[8]) { + msg.optionalFloatWrapper = com.google.protobuf.FloatValueInternal() + } + + decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + } + + tag.fieldNr == 207 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[9]) { + msg.optionalDoubleWrapper = com.google.protobuf.DoubleValueInternal() + } + + decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + } + + tag.fieldNr == 208 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[10]) { + msg.optionalStringWrapper = com.google.protobuf.StringValueInternal() + } + + decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + } + + tag.fieldNr == 209 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[11]) { + msg.optionalBytesWrapper = com.google.protobuf.BytesValueInternal() + } + + decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + } + + tag.fieldNr == 211 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.BoolValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + (msg.repeatedBoolWrapper as MutableList).add(elem) + } + + tag.fieldNr == 212 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.Int32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + (msg.repeatedInt32Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 213 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.Int64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + (msg.repeatedInt64Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 214 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.UInt32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + (msg.repeatedUint32Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 215 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.UInt64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + (msg.repeatedUint64Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 216 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.FloatValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + (msg.repeatedFloatWrapper as MutableList).add(elem) + } + + tag.fieldNr == 217 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.DoubleValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + (msg.repeatedDoubleWrapper as MutableList).add(elem) + } + + tag.fieldNr == 218 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.StringValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + (msg.repeatedStringWrapper as MutableList).add(elem) + } + + tag.fieldNr == 219 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.BytesValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + (msg.repeatedBytesWrapper as MutableList).add(elem) + } + + tag.fieldNr == 301 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[12]) { + msg.optionalDuration = com.google.protobuf.DurationInternal() + } + + decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + } + + tag.fieldNr == 302 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[13]) { + msg.optionalTimestamp = com.google.protobuf.TimestampInternal() + } + + decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + } + + tag.fieldNr == 303 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[14]) { + msg.optionalFieldMask = com.google.protobuf.FieldMaskInternal() + } + + decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + } + + tag.fieldNr == 304 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[15]) { + msg.optionalStruct = com.google.protobuf.StructInternal() + } + + decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.StructInternal::decodeWith) + } + + tag.fieldNr == 305 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[16]) { + msg.optionalAny = com.google.protobuf.AnyInternal() + } + + decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + } + + tag.fieldNr == 306 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[17]) { + msg.optionalValue = com.google.protobuf.ValueInternal() + } + + decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + } + + tag.fieldNr == 307 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalNullValue = com.google.protobuf.NullValue.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 311 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.DurationInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + (msg.repeatedDuration as MutableList).add(elem) + } + + tag.fieldNr == 312 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.TimestampInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + (msg.repeatedTimestamp as MutableList).add(elem) + } + + tag.fieldNr == 313 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.FieldMaskInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + (msg.repeatedFieldmask as MutableList).add(elem) + } + + tag.fieldNr == 324 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.StructInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.StructInternal::decodeWith) + (msg.repeatedStruct as MutableList).add(elem) + } + + tag.fieldNr == 315 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.AnyInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + (msg.repeatedAny as MutableList).add(elem) + } + + tag.fieldNr == 316 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + (msg.repeatedValue as MutableList).add(elem) + } + + tag.fieldNr == 317 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.ListValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.ListValueInternal::decodeWith) + (msg.repeatedListValue as MutableList).add(elem) + } + + tag.fieldNr == 401 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldname1 = decoder.readInt32() + } + + tag.fieldNr == 402 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName2 = decoder.readInt32() + } + + tag.fieldNr == 403 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName3 = decoder.readInt32() + } + + tag.fieldNr == 404 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name4_ = decoder.readInt32() + } + + tag.fieldNr == 405 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field0name5 = decoder.readInt32() + } + + tag.fieldNr == 406 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_0Name6 = decoder.readInt32() + } + + tag.fieldNr == 407 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName7 = decoder.readInt32() + } + + tag.fieldNr == 408 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName8 = decoder.readInt32() + } + + tag.fieldNr == 409 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name9 = decoder.readInt32() + } + + tag.fieldNr == 410 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.Field_Name10 = decoder.readInt32() + } + + tag.fieldNr == 411 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FIELD_NAME11 = decoder.readInt32() + } + + tag.fieldNr == 412 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FIELDName12 = decoder.readInt32() + } + + tag.fieldNr == 413 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg._FieldName13 = decoder.readInt32() + } + + tag.fieldNr == 414 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.__FieldName14 = decoder.readInt32() + } + + tag.fieldNr == 415 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name15 = decoder.readInt32() + } + + tag.fieldNr == 416 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field__Name16 = decoder.readInt32() + } + + tag.fieldNr == 417 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName17__ = decoder.readInt32() + } + + tag.fieldNr == 418 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName18__ = decoder.readInt32() + } + + tag.fieldNr == 111 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint32(decoder.readUInt32()) + } + + tag.fieldNr == 112 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val field = (msg.oneofField as? com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage) ?: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal()).also { + msg.oneofField = it + } + + decoder.readMessage(field.value.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + tag.fieldNr == 113 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofString(decoder.readString()) + } + + tag.fieldNr == 114 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBytes(decoder.readBytes()) + } + + tag.fieldNr == 115 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBool(decoder.readBool()) + } + + tag.fieldNr == 116 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint64(decoder.readUInt64()) + } + + tag.fieldNr == 117 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofFloat(decoder.readFloat()) + } + + tag.fieldNr == 118 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofDouble(decoder.readDouble()) + } + + tag.fieldNr == 119 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofEnum(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum())) + } + + tag.fieldNr == 120 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.NullValue.fromNumber(decoder.readEnum())) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.computeSize(): Int { + var __result = 0 + if (optionalInt32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(optionalInt32)) + } + + if (optionalInt64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(optionalInt64)) + } + + if (optionalUint32 != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(optionalUint32)) + } + + if (optionalUint64 != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(optionalUint64)) + } + + if (optionalSint32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(optionalSint32)) + } + + if (optionalSint64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(optionalSint64)) + } + + if (optionalFixed32 != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(optionalFixed32)) + } + + if (optionalFixed64 != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(8, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(optionalFixed64)) + } + + if (optionalSfixed32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(9, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(optionalSfixed32)) + } + + if (optionalSfixed64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(10, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(optionalSfixed64)) + } + + if (optionalFloat != 0.0f) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(11, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(optionalFloat)) + } + + if (optionalDouble != 0.0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(12, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(optionalDouble)) + } + + if (optionalBool != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(13, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(optionalBool)) + } + + if (optionalString.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalString).let { kotlinx.rpc.protobuf.internal.WireSize.tag(14, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (optionalBytes.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(optionalBytes).let { kotlinx.rpc.protobuf.internal.WireSize.tag(15, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += optionalNestedMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(18, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[1]) { + __result += optionalForeignMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(19, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG != optionalNestedEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(21, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNestedEnum.number)) + } + + if (com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO != optionalForeignEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(22, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalForeignEnum.number)) + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO != optionalAliasedEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(23, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalAliasedEnum.number)) + } + + if (optionalStringPiece.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalStringPiece).let { kotlinx.rpc.protobuf.internal.WireSize.tag(24, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (optionalCord.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalCord).let { kotlinx.rpc.protobuf.internal.WireSize.tag(25, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[2]) { + __result += recursiveMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(27, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedInt32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt32(repeatedInt32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(31, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedInt64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt64(repeatedInt64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(32, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedUint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(repeatedUint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(33, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedUint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(repeatedUint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(34, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(repeatedSint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(35, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(repeatedSint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(36, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed32(repeatedFixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(37, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed64(repeatedFixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(38, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSfixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed32(repeatedSfixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(39, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSfixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed64(repeatedSfixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(40, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFloat.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFloat(repeatedFloat).let { kotlinx.rpc.protobuf.internal.WireSize.tag(41, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedDouble.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedDouble(repeatedDouble).let { kotlinx.rpc.protobuf.internal.WireSize.tag(42, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedBool.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedBool(repeatedBool).let { kotlinx.rpc.protobuf.internal.WireSize.tag(43, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedString.isNotEmpty()) { + __result = repeatedString.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(44, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedBytes.isNotEmpty()) { + __result = repeatedBytes.sumOf { kotlinx.rpc.protobuf.internal.WireSize.bytes(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(45, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedNestedMessage.isNotEmpty()) { + __result = repeatedNestedMessage.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(48, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedForeignMessage.isNotEmpty()) { + __result = repeatedForeignMessage.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(49, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedNestedEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedForeignEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedStringPiece.isNotEmpty()) { + __result = repeatedStringPiece.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(54, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedCord.isNotEmpty()) { + __result = repeatedCord.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(55, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (packedInt32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt32(packedInt32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(75, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedInt64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt64(packedInt64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(76, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedUint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(packedUint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(77, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedUint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(packedUint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(78, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(packedSint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(79, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(packedSint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(80, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed32(packedFixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(81, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed64(packedFixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(82, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSfixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed32(packedSfixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(83, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSfixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed64(packedSfixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(84, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFloat.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFloat(packedFloat).let { kotlinx.rpc.protobuf.internal.WireSize.tag(85, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedDouble.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedDouble(packedDouble).let { kotlinx.rpc.protobuf.internal.WireSize.tag(86, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedBool.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedBool(packedBool).let { kotlinx.rpc.protobuf.internal.WireSize.tag(87, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedNestedEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (unpackedInt32.isNotEmpty()) { + __result = unpackedInt32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.int32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(89, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedInt64.isNotEmpty()) { + __result = unpackedInt64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.int64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(90, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedUint32.isNotEmpty()) { + __result = unpackedUint32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.uInt32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(91, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedUint64.isNotEmpty()) { + __result = unpackedUint64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.uInt64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(92, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedSint32.isNotEmpty()) { + __result = unpackedSint32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sInt32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(93, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedSint64.isNotEmpty()) { + __result = unpackedSint64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sInt64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(94, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedFixed32.isNotEmpty()) { + __result = unpackedFixed32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.fixed32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(95, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedFixed64.isNotEmpty()) { + __result = unpackedFixed64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.fixed64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(96, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedSfixed32.isNotEmpty()) { + __result = unpackedSfixed32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sFixed32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(97, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedSfixed64.isNotEmpty()) { + __result = unpackedSfixed64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sFixed64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(98, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedFloat.isNotEmpty()) { + __result = unpackedFloat.sumOf { kotlinx.rpc.protobuf.internal.WireSize.float(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(99, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedDouble.isNotEmpty()) { + __result = unpackedDouble.sumOf { kotlinx.rpc.protobuf.internal.WireSize.double(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(100, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedBool.isNotEmpty()) { + __result = unpackedBool.sumOf { kotlinx.rpc.protobuf.internal.WireSize.bool(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(101, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedNestedEnum.isNotEmpty()) { + __result = unpackedNestedEnum.sumOf { kotlinx.rpc.protobuf.internal.WireSize.enum(it.number) + kotlinx.rpc.protobuf.internal.WireSize.tag(102, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (mapInt32Int32.isNotEmpty()) { + __result += mapInt32Int32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt64Int64.isNotEmpty()) { + __result += mapInt64Int64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapUint32Uint32.isNotEmpty()) { + __result += mapUint32Uint32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapUint64Uint64.isNotEmpty()) { + __result += mapUint64Uint64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSint32Sint32.isNotEmpty()) { + __result += mapSint32Sint32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSint64Sint64.isNotEmpty()) { + __result += mapSint64Sint64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapFixed32Fixed32.isNotEmpty()) { + __result += mapFixed32Fixed32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapFixed64Fixed64.isNotEmpty()) { + __result += mapFixed64Fixed64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSfixed32Sfixed32.isNotEmpty()) { + __result += mapSfixed32Sfixed32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSfixed64Sfixed64.isNotEmpty()) { + __result += mapSfixed64Sfixed64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt32Float.isNotEmpty()) { + __result += mapInt32Float.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt32Double.isNotEmpty()) { + __result += mapInt32Double.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapBoolBool.isNotEmpty()) { + __result += mapBoolBool.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringString.isNotEmpty()) { + __result += mapStringString.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringBytes.isNotEmpty()) { + __result += mapStringBytes.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringNestedMessage.isNotEmpty()) { + __result += mapStringNestedMessage.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringForeignMessage.isNotEmpty()) { + __result += mapStringForeignMessage.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringNestedEnum.isNotEmpty()) { + __result += mapStringNestedEnum.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringForeignEnum.isNotEmpty()) { + __result += mapStringForeignEnum.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (presenceMask[3]) { + __result += optionalBoolWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(201, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[4]) { + __result += optionalInt32Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(202, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[5]) { + __result += optionalInt64Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(203, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[6]) { + __result += optionalUint32Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(204, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[7]) { + __result += optionalUint64Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(205, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[8]) { + __result += optionalFloatWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(206, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[9]) { + __result += optionalDoubleWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(207, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[10]) { + __result += optionalStringWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(208, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[11]) { + __result += optionalBytesWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(209, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedBoolWrapper.isNotEmpty()) { + __result = repeatedBoolWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(211, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedInt32Wrapper.isNotEmpty()) { + __result = repeatedInt32Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(212, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedInt64Wrapper.isNotEmpty()) { + __result = repeatedInt64Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(213, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedUint32Wrapper.isNotEmpty()) { + __result = repeatedUint32Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(214, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedUint64Wrapper.isNotEmpty()) { + __result = repeatedUint64Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(215, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedFloatWrapper.isNotEmpty()) { + __result = repeatedFloatWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(216, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedDoubleWrapper.isNotEmpty()) { + __result = repeatedDoubleWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(217, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedStringWrapper.isNotEmpty()) { + __result = repeatedStringWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(218, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedBytesWrapper.isNotEmpty()) { + __result = repeatedBytesWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(219, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (presenceMask[12]) { + __result += optionalDuration.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(301, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[13]) { + __result += optionalTimestamp.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(302, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[14]) { + __result += optionalFieldMask.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(303, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[15]) { + __result += optionalStruct.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(304, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[16]) { + __result += optionalAny.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(305, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[17]) { + __result += optionalValue.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(306, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(307, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNullValue.number)) + } + + if (repeatedDuration.isNotEmpty()) { + __result = repeatedDuration.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(311, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedTimestamp.isNotEmpty()) { + __result = repeatedTimestamp.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(312, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedFieldmask.isNotEmpty()) { + __result = repeatedFieldmask.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(313, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedStruct.isNotEmpty()) { + __result = repeatedStruct.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(324, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedAny.isNotEmpty()) { + __result = repeatedAny.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(315, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedValue.isNotEmpty()) { + __result = repeatedValue.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(316, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedListValue.isNotEmpty()) { + __result = repeatedListValue.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(317, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (fieldname1 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(401, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldname1)) + } + + if (fieldName2 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(402, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName2)) + } + + if (FieldName3 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(403, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName3)) + } + + if (field_Name4_ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(404, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name4_)) + } + + if (field0name5 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(405, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field0name5)) + } + + if (field_0Name6 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(406, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_0Name6)) + } + + if (fieldName7 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(407, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName7)) + } + + if (FieldName8 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(408, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName8)) + } + + if (field_Name9 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(409, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name9)) + } + + if (Field_Name10 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(410, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(Field_Name10)) + } + + if (FIELD_NAME11 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(411, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FIELD_NAME11)) + } + + if (FIELDName12 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(412, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FIELDName12)) + } + + if (_FieldName13 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(413, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(_FieldName13)) + } + + if (__FieldName14 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(414, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(__FieldName14)) + } + + if (field_Name15 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(415, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name15)) + } + + if (field__Name16 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(416, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field__Name16)) + } + + if (fieldName17__ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(417, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName17__)) + } + + if (FieldName18__ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(418, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName18__)) + } + + oneofField?.also { + when (val value = it) { + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint32 -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(111, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(value.value)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + __result += value.value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(112, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofString -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(113, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBytes -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(114, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofBool -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(115, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value.value)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofUint64 -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(116, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(value.value)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofFloat -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(117, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(value.value)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofDouble -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(118, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value.value)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofEnum -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(119, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.value.number)) + } + + is com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNullValue -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(120, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.value.number)) + } + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal { + return this as? com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (c != 0) { + encoder.writeInt32(fieldNr = 1, value = c) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.c = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.computeSize(): Int { + var __result = 0 + if (c != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(c)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal { + return this as? com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + // no fields to encode +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.computeSize(): Int { + var __result = 0 + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal { + return this as? com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + // no fields to encode +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.computeSize(): Int { + var __result = 0 + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal { + return this as? com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + corecursive.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (a != 0) { + encoder.writeInt32(fieldNr = 1, value = a) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = corecursive.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.a = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.corecursive = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() + } + + decoder.readMessage(msg.corecursive.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.computeSize(): Int { + var __result = 0 + if (a != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(a)) + } + + if (presenceMask[0]) { + __result += corecursive.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal { + return this as? com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeInt64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0u) { + encoder.writeUInt32(fieldNr = 1, value = key) + } + + if (value != 0u) { + encoder.writeUInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readUInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(key)) + } + + if (value != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0uL) { + encoder.writeUInt64(fieldNr = 1, value = key) + } + + if (value != 0uL) { + encoder.writeUInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readUInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(key)) + } + + if (value != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeSInt32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeSInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readSInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readSInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeSInt64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeSInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readSInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readSInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0u) { + encoder.writeFixed32(fieldNr = 1, value = key) + } + + if (value != 0u) { + encoder.writeFixed32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.key = decoder.readFixed32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readFixed32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(key)) + } + + if (value != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0uL) { + encoder.writeFixed64(fieldNr = 1, value = key) + } + + if (value != 0uL) { + encoder.writeFixed64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.key = decoder.readFixed64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readFixed64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(key)) + } + + if (value != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeSFixed32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeSFixed32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.key = decoder.readSFixed32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readSFixed32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeSFixed64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeSFixed64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.key = decoder.readSFixed64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readSFixed64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0.0f) { + encoder.writeFloat(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readFloat() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0.0f) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0.0) { + encoder.writeDouble(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readDouble() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0.0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != false) { + encoder.writeBool(fieldNr = 1, value = key) + } + + if (value != false) { + encoder.writeBool(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readBool() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readBool() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.computeSize(): Int { + var __result = 0 + if (key != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(key)) + } + + if (value != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (value.isNotEmpty()) { + encoder.writeString(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (value.isNotEmpty()) { + encoder.writeBytes(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readBytes() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG != value) { + encoder.writeEnum(fieldNr = 2, value = value.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG != value) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO != value) { + encoder.writeEnum(fieldNr = 2, value = value.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = com.google.protobuf_test_messages.editions.proto3.ForeignEnum.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO != value) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.ForeignEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO + } + + 1 -> { + com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_BAR + } + + 2 -> { + com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_BAZ + } + + else -> { + com.google.protobuf_test_messages.editions.proto3.ForeignEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.FOO + } + + 1 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.BAR + } + + 2 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.BAZ + } + + -1 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG + } + + else -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO + } + + 1 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_BAR + } + + 2 -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_BAZ + } + + else -> { + com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.kFalse + } + + 1 -> { + com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.kTrue + } + + else -> { + com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.UNRECOGNIZED(number) + } + } +} + diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt new file mode 100644 index 000000000..4bc427c0e --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt @@ -0,0 +1,277 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf_test_messages.proto3 + +import com.google.protobuf.* +import kotlin.jvm.JvmInline +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.CODEC::class) +interface TestAllTypesProto3 { + val optionalInt32: Int + val optionalInt64: Long + val optionalUint32: UInt + val optionalUint64: ULong + val optionalSint32: Int + val optionalSint64: Long + val optionalFixed32: UInt + val optionalFixed64: ULong + val optionalSfixed32: Int + val optionalSfixed64: Long + val optionalFloat: Float + val optionalDouble: Double + val optionalBool: Boolean + val optionalString: String + val optionalBytes: ByteArray + val optionalNestedMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage + val optionalForeignMessage: com.google.protobuf_test_messages.proto3.ForeignMessage + val optionalNestedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum + val optionalForeignEnum: com.google.protobuf_test_messages.proto3.ForeignEnum + val optionalAliasedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum + val optionalStringPiece: String + val optionalCord: String + val recursiveMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 + val repeatedInt32: List + val repeatedInt64: List + val repeatedUint32: List + val repeatedUint64: List + val repeatedSint32: List + val repeatedSint64: List + val repeatedFixed32: List + val repeatedFixed64: List + val repeatedSfixed32: List + val repeatedSfixed64: List + val repeatedFloat: List + val repeatedDouble: List + val repeatedBool: List + val repeatedString: List + val repeatedBytes: List + val repeatedNestedMessage: List + val repeatedForeignMessage: List + val repeatedNestedEnum: List + val repeatedForeignEnum: List + val repeatedStringPiece: List + val repeatedCord: List + val packedInt32: List + val packedInt64: List + val packedUint32: List + val packedUint64: List + val packedSint32: List + val packedSint64: List + val packedFixed32: List + val packedFixed64: List + val packedSfixed32: List + val packedSfixed64: List + val packedFloat: List + val packedDouble: List + val packedBool: List + val packedNestedEnum: List + val unpackedInt32: List + val unpackedInt64: List + val unpackedUint32: List + val unpackedUint64: List + val unpackedSint32: List + val unpackedSint64: List + val unpackedFixed32: List + val unpackedFixed64: List + val unpackedSfixed32: List + val unpackedSfixed64: List + val unpackedFloat: List + val unpackedDouble: List + val unpackedBool: List + val unpackedNestedEnum: List + val mapInt32Int32: Map + val mapInt64Int64: Map + val mapUint32Uint32: Map + val mapUint64Uint64: Map + val mapSint32Sint32: Map + val mapSint64Sint64: Map + val mapFixed32Fixed32: Map + val mapFixed64Fixed64: Map + val mapSfixed32Sfixed32: Map + val mapSfixed64Sfixed64: Map + val mapInt32Float: Map + val mapInt32Double: Map + val mapBoolBool: Map + val mapStringString: Map + val mapStringBytes: Map + val mapStringNestedMessage: Map + val mapStringForeignMessage: Map + val mapStringNestedEnum: Map + val mapStringForeignEnum: Map + val optionalBoolWrapper: com.google.protobuf.BoolValue + val optionalInt32Wrapper: com.google.protobuf.Int32Value + val optionalInt64Wrapper: com.google.protobuf.Int64Value + val optionalUint32Wrapper: com.google.protobuf.UInt32Value + val optionalUint64Wrapper: com.google.protobuf.UInt64Value + val optionalFloatWrapper: com.google.protobuf.FloatValue + val optionalDoubleWrapper: com.google.protobuf.DoubleValue + val optionalStringWrapper: com.google.protobuf.StringValue + val optionalBytesWrapper: com.google.protobuf.BytesValue + val repeatedBoolWrapper: List + val repeatedInt32Wrapper: List + val repeatedInt64Wrapper: List + val repeatedUint32Wrapper: List + val repeatedUint64Wrapper: List + val repeatedFloatWrapper: List + val repeatedDoubleWrapper: List + val repeatedStringWrapper: List + val repeatedBytesWrapper: List + val optionalDuration: com.google.protobuf.Duration + val optionalTimestamp: com.google.protobuf.Timestamp + val optionalFieldMask: com.google.protobuf.FieldMask + val optionalStruct: com.google.protobuf.Struct + val optionalAny: com.google.protobuf.Any + val optionalValue: com.google.protobuf.Value + val optionalNullValue: com.google.protobuf.NullValue + val repeatedDuration: List + val repeatedTimestamp: List + val repeatedFieldmask: List + val repeatedStruct: List + val repeatedAny: List + val repeatedValue: List + val repeatedListValue: List + val fieldname1: Int + val fieldName2: Int + val FieldName3: Int + val field_Name4_: Int + val field0name5: Int + val field_0Name6: Int + val fieldName7: Int + val FieldName8: Int + val field_Name9: Int + val Field_Name10: Int + val FIELD_NAME11: Int + val FIELDName12: Int + val _FieldName13: Int + val __FieldName14: Int + val field_Name15: Int + val field__Name16: Int + val fieldName17__: Int + val FieldName18__: Int + val oneofField: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField? + + sealed interface OneofField { + @JvmInline + value class OneofUint32(val value: UInt): OneofField + + @JvmInline + value class OneofNestedMessage( + val value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage, + ): OneofField + + @JvmInline + value class OneofString(val value: String): OneofField + + @JvmInline + value class OneofBytes(val value: ByteArray): OneofField + + @JvmInline + value class OneofBool(val value: Boolean): OneofField + + @JvmInline + value class OneofUint64(val value: ULong): OneofField + + @JvmInline + value class OneofFloat(val value: Float): OneofField + + @JvmInline + value class OneofDouble(val value: Double): OneofField + + @JvmInline + value class OneofEnum( + val value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum, + ): OneofField + + @JvmInline + value class OneofNullValue(val value: com.google.protobuf.NullValue): OneofField + } + + @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.CODEC::class) + interface NestedMessage { + val a: Int + val corecursive: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 + + companion object + } + + sealed class NestedEnum(open val number: Int) { + object FOO: NestedEnum(number = 0) + + object BAR: NestedEnum(number = 1) + + object BAZ: NestedEnum(number = 2) + + object NEG: NestedEnum(number = -1) + + data class UNRECOGNIZED(override val number: Int): NestedEnum(number) + + companion object { + val entries: List by lazy { listOf(NEG, FOO, BAR, BAZ) } + } + } + + sealed class AliasedEnum(open val number: Int) { + object ALIAS_FOO: AliasedEnum(number = 0) + + object ALIAS_BAR: AliasedEnum(number = 1) + + object ALIAS_BAZ: AliasedEnum(number = 2) + + data class UNRECOGNIZED(override val number: Int): AliasedEnum(number) + + companion object { + val MOO: AliasedEnum get() = ALIAS_BAZ + val moo: AliasedEnum get() = ALIAS_BAZ + val bAz: AliasedEnum get() = ALIAS_BAZ + val entries: List by lazy { listOf(ALIAS_FOO, ALIAS_BAR, ALIAS_BAZ) } + } + } + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.ForeignMessageInternal.CODEC::class) +interface ForeignMessage { + val c: Int + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.CODEC::class) +interface NullHypothesisProto3 { + + companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.CODEC::class) +interface EnumOnlyProto3 { + + sealed class Bool(open val number: Int) { + object kFalse: Bool(number = 0) + + object kTrue: Bool(number = 1) + + data class UNRECOGNIZED(override val number: Int): Bool(number) + + companion object { + val entries: List by lazy { listOf(kFalse, kTrue) } + } + } + + companion object +} + +sealed class ForeignEnum(open val number: Int) { + object FOREIGN_FOO: ForeignEnum(number = 0) + + object FOREIGN_BAR: ForeignEnum(number = 1) + + object FOREIGN_BAZ: ForeignEnum(number = 2) + + data class UNRECOGNIZED(override val number: Int): ForeignEnum(number) + + companion object { + val entries: List by lazy { listOf(FOREIGN_FOO, FOREIGN_BAR, FOREIGN_BAZ) } + } +} + diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt new file mode 100644 index 000000000..586d76e3f --- /dev/null +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt @@ -0,0 +1,4362 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf_test_messages.proto3 + +import com.google.protobuf.* +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +@kotlinx.rpc.internal.utils.InternalRpcApi +class TestAllTypesProto3Internal: com.google.protobuf_test_messages.proto3.TestAllTypesProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 18) { + private object PresenceIndices { + const val optionalNestedMessage = 0 + const val optionalForeignMessage = 1 + const val recursiveMessage = 2 + const val optionalBoolWrapper = 3 + const val optionalInt32Wrapper = 4 + const val optionalInt64Wrapper = 5 + const val optionalUint32Wrapper = 6 + const val optionalUint64Wrapper = 7 + const val optionalFloatWrapper = 8 + const val optionalDoubleWrapper = 9 + const val optionalStringWrapper = 10 + const val optionalBytesWrapper = 11 + const val optionalDuration = 12 + const val optionalTimestamp = 13 + const val optionalFieldMask = 14 + const val optionalStruct = 15 + const val optionalAny = 16 + const val optionalValue = 17 + } + + override val _size: Int by lazy { computeSize() } + override var optionalInt32: Int by MsgFieldDelegate() { 0 } + override var optionalInt64: Long by MsgFieldDelegate() { 0L } + override var optionalUint32: UInt by MsgFieldDelegate() { 0u } + override var optionalUint64: ULong by MsgFieldDelegate() { 0uL } + override var optionalSint32: Int by MsgFieldDelegate() { 0 } + override var optionalSint64: Long by MsgFieldDelegate() { 0L } + override var optionalFixed32: UInt by MsgFieldDelegate() { 0u } + override var optionalFixed64: ULong by MsgFieldDelegate() { 0uL } + override var optionalSfixed32: Int by MsgFieldDelegate() { 0 } + override var optionalSfixed64: Long by MsgFieldDelegate() { 0L } + override var optionalFloat: Float by MsgFieldDelegate() { 0.0f } + override var optionalDouble: Double by MsgFieldDelegate() { 0.0 } + override var optionalBool: Boolean by MsgFieldDelegate() { false } + override var optionalString: String by MsgFieldDelegate() { "" } + override var optionalBytes: ByteArray by MsgFieldDelegate() { byteArrayOf() } + override var optionalNestedMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + override var optionalForeignMessage: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } + override var optionalNestedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } + override var optionalForeignEnum: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } + override var optionalAliasedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } + override var optionalStringPiece: String by MsgFieldDelegate() { "" } + override var optionalCord: String by MsgFieldDelegate() { "" } + override var recursiveMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } + override var repeatedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBool: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedString: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBytes: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedNestedMessage: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedForeignMessage: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedForeignEnum: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStringPiece: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedCord: List by MsgFieldDelegate() { mutableListOf() } + override var packedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var packedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var packedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var packedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var packedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var packedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var packedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var packedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var packedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var packedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var packedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var packedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var packedBool: List by MsgFieldDelegate() { mutableListOf() } + override var packedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedInt32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedInt64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedUint32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedUint64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSint32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSint64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFixed32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFixed64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSfixed32: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedSfixed64: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedFloat: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedDouble: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedBool: List by MsgFieldDelegate() { mutableListOf() } + override var unpackedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } + override var mapInt32Int32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt64Int64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapUint32Uint32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapUint64Uint64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSint32Sint32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSint64Sint64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapFixed32Fixed32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapFixed64Fixed64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSfixed32Sfixed32: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapSfixed64Sfixed64: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt32Float: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapInt32Double: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapBoolBool: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringString: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringBytes: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringNestedMessage: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringForeignMessage: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringNestedEnum: Map by MsgFieldDelegate() { mutableMapOf() } + override var mapStringForeignEnum: Map by MsgFieldDelegate() { mutableMapOf() } + override var optionalBoolWrapper: com.google.protobuf.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.BoolValueInternal() } + override var optionalInt32Wrapper: com.google.protobuf.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.Int32ValueInternal() } + override var optionalInt64Wrapper: com.google.protobuf.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.Int64ValueInternal() } + override var optionalUint32Wrapper: com.google.protobuf.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.UInt32ValueInternal() } + override var optionalUint64Wrapper: com.google.protobuf.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.UInt64ValueInternal() } + override var optionalFloatWrapper: com.google.protobuf.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.FloatValueInternal() } + override var optionalDoubleWrapper: com.google.protobuf.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.DoubleValueInternal() } + override var optionalStringWrapper: com.google.protobuf.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.StringValueInternal() } + override var optionalBytesWrapper: com.google.protobuf.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.BytesValueInternal() } + override var repeatedBoolWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt32Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedInt64Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint32Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedUint64Wrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFloatWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedDoubleWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStringWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedBytesWrapper: List by MsgFieldDelegate() { mutableListOf() } + override var optionalDuration: com.google.protobuf.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.DurationInternal() } + override var optionalTimestamp: com.google.protobuf.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.TimestampInternal() } + override var optionalFieldMask: com.google.protobuf.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.FieldMaskInternal() } + override var optionalStruct: com.google.protobuf.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.StructInternal() } + override var optionalAny: com.google.protobuf.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.AnyInternal() } + override var optionalValue: com.google.protobuf.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.ValueInternal() } + override var optionalNullValue: com.google.protobuf.NullValue by MsgFieldDelegate() { com.google.protobuf.NullValue.NULL_VALUE } + override var repeatedDuration: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedTimestamp: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedFieldmask: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedStruct: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedAny: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedValue: List by MsgFieldDelegate() { mutableListOf() } + override var repeatedListValue: List by MsgFieldDelegate() { mutableListOf() } + override var fieldname1: Int by MsgFieldDelegate() { 0 } + override var fieldName2: Int by MsgFieldDelegate() { 0 } + override var FieldName3: Int by MsgFieldDelegate() { 0 } + override var field_Name4_: Int by MsgFieldDelegate() { 0 } + override var field0name5: Int by MsgFieldDelegate() { 0 } + override var field_0Name6: Int by MsgFieldDelegate() { 0 } + override var fieldName7: Int by MsgFieldDelegate() { 0 } + override var FieldName8: Int by MsgFieldDelegate() { 0 } + override var field_Name9: Int by MsgFieldDelegate() { 0 } + override var Field_Name10: Int by MsgFieldDelegate() { 0 } + override var FIELD_NAME11: Int by MsgFieldDelegate() { 0 } + override var FIELDName12: Int by MsgFieldDelegate() { 0 } + override var _FieldName13: Int by MsgFieldDelegate() { 0 } + override var __FieldName14: Int by MsgFieldDelegate() { 0 } + override var field_Name15: Int by MsgFieldDelegate() { 0 } + override var field__Name16: Int by MsgFieldDelegate() { 0 } + override var fieldName17__: Int by MsgFieldDelegate() { 0 } + override var FieldName18__: Int by MsgFieldDelegate() { 0 } + override var oneofField: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField? = null + @kotlinx.rpc.internal.utils.InternalRpcApi + class NestedMessageInternal: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val corecursive = 0 + } + + override val _size: Int by lazy { computeSize() } + override var a: Int by MsgFieldDelegate() { 0 } + override var corecursive: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32Int32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt64Int64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapUint32Uint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: UInt by MsgFieldDelegate() { 0u } + var value: UInt by MsgFieldDelegate() { 0u } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapUint64Uint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: ULong by MsgFieldDelegate() { 0uL } + var value: ULong by MsgFieldDelegate() { 0uL } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSint32Sint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSint64Sint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapFixed32Fixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: UInt by MsgFieldDelegate() { 0u } + var value: UInt by MsgFieldDelegate() { 0u } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapFixed64Fixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: ULong by MsgFieldDelegate() { 0uL } + var value: ULong by MsgFieldDelegate() { 0uL } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSfixed32Sfixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Int by MsgFieldDelegate() { 0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapSfixed64Sfixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Long by MsgFieldDelegate() { 0L } + var value: Long by MsgFieldDelegate() { 0L } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32FloatEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Float by MsgFieldDelegate() { 0.0f } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapInt32DoubleEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Int by MsgFieldDelegate() { 0 } + var value: Double by MsgFieldDelegate() { 0.0 } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapBoolBoolEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: Boolean by MsgFieldDelegate() { false } + var value: Boolean by MsgFieldDelegate() { false } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringStringEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: String by MsgFieldDelegate() { "" } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringBytesEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: ByteArray by MsgFieldDelegate() { byteArrayOf() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringNestedMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val value = 0 + } + + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringForeignMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + const val value = 0 + } + + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringNestedEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } + companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + class MapStringForeignEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + var key: String by MsgFieldDelegate() { "" } + var value: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } + companion object + } + + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.proto3.TestAllTypesProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class ForeignMessageInternal: com.google.protobuf_test_messages.proto3.ForeignMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + override var c: Int by MsgFieldDelegate() { 0 } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.proto3.ForeignMessage): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.proto3.ForeignMessage { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.proto3.ForeignMessageInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.proto3.ForeignMessageInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class NullHypothesisProto3Internal: com.google.protobuf_test_messages.proto3.NullHypothesisProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.proto3.NullHypothesisProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.proto3.NullHypothesisProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +class EnumOnlyProto3Internal: com.google.protobuf_test_messages.proto3.EnumOnlyProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + override val _size: Int by lazy { computeSize() } + object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + override fun encode(value: com.google.protobuf_test_messages.proto3.EnumOnlyProto3): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf_test_messages.proto3.EnumOnlyProto3 { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + companion object +} + +operator fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.Companion.invoke(body: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.() -> Unit): com.google.protobuf_test_messages.proto3.TestAllTypesProto3 { + val msg = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.proto3.ForeignMessage.Companion.invoke(body: com.google.protobuf_test_messages.proto3.ForeignMessageInternal.() -> Unit): com.google.protobuf_test_messages.proto3.ForeignMessage { + val msg = com.google.protobuf_test_messages.proto3.ForeignMessageInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3.Companion.invoke(body: com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.() -> Unit): com.google.protobuf_test_messages.proto3.NullHypothesisProto3 { + val msg = com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Companion.invoke(body: com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.() -> Unit): com.google.protobuf_test_messages.proto3.EnumOnlyProto3 { + val msg = com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal().apply(body) + msg.checkRequiredFields() + return msg +} + +operator fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage.Companion.invoke(body: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.() -> Unit): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage { + val msg = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + optionalNestedMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[1]) { + optionalForeignMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[2]) { + recursiveMessage.asInternal().checkRequiredFields() + } + + if (presenceMask[3]) { + optionalBoolWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[4]) { + optionalInt32Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[5]) { + optionalInt64Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[6]) { + optionalUint32Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[7]) { + optionalUint64Wrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[8]) { + optionalFloatWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[9]) { + optionalDoubleWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[10]) { + optionalStringWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[11]) { + optionalBytesWrapper.asInternal().checkRequiredFields() + } + + if (presenceMask[12]) { + optionalDuration.asInternal().checkRequiredFields() + } + + if (presenceMask[13]) { + optionalTimestamp.asInternal().checkRequiredFields() + } + + if (presenceMask[14]) { + optionalFieldMask.asInternal().checkRequiredFields() + } + + if (presenceMask[15]) { + optionalStruct.asInternal().checkRequiredFields() + } + + if (presenceMask[16]) { + optionalAny.asInternal().checkRequiredFields() + } + + if (presenceMask[17]) { + optionalValue.asInternal().checkRequiredFields() + } + + oneofField?.also { + when { + it is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + it.value.asInternal().checkRequiredFields() + } + } + } + + repeatedNestedMessage.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedForeignMessage.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedBoolWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedInt32Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedInt64Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedUint32Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedUint64Wrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedFloatWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedDoubleWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedStringWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedBytesWrapper.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedDuration.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedTimestamp.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedFieldmask.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedStruct.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedAny.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedValue.forEach { + it.asInternal().checkRequiredFields() + } + + repeatedListValue.forEach { + it.asInternal().checkRequiredFields() + } + + mapStringNestedMessage.values.forEach { + it.asInternal().checkRequiredFields() + } + + mapStringForeignMessage.values.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (optionalInt32 != 0) { + encoder.writeInt32(fieldNr = 1, value = optionalInt32) + } + + if (optionalInt64 != 0L) { + encoder.writeInt64(fieldNr = 2, value = optionalInt64) + } + + if (optionalUint32 != 0u) { + encoder.writeUInt32(fieldNr = 3, value = optionalUint32) + } + + if (optionalUint64 != 0uL) { + encoder.writeUInt64(fieldNr = 4, value = optionalUint64) + } + + if (optionalSint32 != 0) { + encoder.writeSInt32(fieldNr = 5, value = optionalSint32) + } + + if (optionalSint64 != 0L) { + encoder.writeSInt64(fieldNr = 6, value = optionalSint64) + } + + if (optionalFixed32 != 0u) { + encoder.writeFixed32(fieldNr = 7, value = optionalFixed32) + } + + if (optionalFixed64 != 0uL) { + encoder.writeFixed64(fieldNr = 8, value = optionalFixed64) + } + + if (optionalSfixed32 != 0) { + encoder.writeSFixed32(fieldNr = 9, value = optionalSfixed32) + } + + if (optionalSfixed64 != 0L) { + encoder.writeSFixed64(fieldNr = 10, value = optionalSfixed64) + } + + if (optionalFloat != 0.0f) { + encoder.writeFloat(fieldNr = 11, value = optionalFloat) + } + + if (optionalDouble != 0.0) { + encoder.writeDouble(fieldNr = 12, value = optionalDouble) + } + + if (optionalBool != false) { + encoder.writeBool(fieldNr = 13, value = optionalBool) + } + + if (optionalString.isNotEmpty()) { + encoder.writeString(fieldNr = 14, value = optionalString) + } + + if (optionalBytes.isNotEmpty()) { + encoder.writeBytes(fieldNr = 15, value = optionalBytes) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 18, value = optionalNestedMessage.asInternal()) { encodeWith(it) } + } + + if (presenceMask[1]) { + encoder.writeMessage(fieldNr = 19, value = optionalForeignMessage.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG != optionalNestedEnum) { + encoder.writeEnum(fieldNr = 21, value = optionalNestedEnum.number) + } + + if (com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO != optionalForeignEnum) { + encoder.writeEnum(fieldNr = 22, value = optionalForeignEnum.number) + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO != optionalAliasedEnum) { + encoder.writeEnum(fieldNr = 23, value = optionalAliasedEnum.number) + } + + if (optionalStringPiece.isNotEmpty()) { + encoder.writeString(fieldNr = 24, value = optionalStringPiece) + } + + if (optionalCord.isNotEmpty()) { + encoder.writeString(fieldNr = 25, value = optionalCord) + } + + if (presenceMask[2]) { + encoder.writeMessage(fieldNr = 27, value = recursiveMessage.asInternal()) { encodeWith(it) } + } + + if (repeatedInt32.isNotEmpty()) { + encoder.writePackedInt32(fieldNr = 31, value = repeatedInt32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt32(repeatedInt32)) + } + + if (repeatedInt64.isNotEmpty()) { + encoder.writePackedInt64(fieldNr = 32, value = repeatedInt64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt64(repeatedInt64)) + } + + if (repeatedUint32.isNotEmpty()) { + encoder.writePackedUInt32(fieldNr = 33, value = repeatedUint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(repeatedUint32)) + } + + if (repeatedUint64.isNotEmpty()) { + encoder.writePackedUInt64(fieldNr = 34, value = repeatedUint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(repeatedUint64)) + } + + if (repeatedSint32.isNotEmpty()) { + encoder.writePackedSInt32(fieldNr = 35, value = repeatedSint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(repeatedSint32)) + } + + if (repeatedSint64.isNotEmpty()) { + encoder.writePackedSInt64(fieldNr = 36, value = repeatedSint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(repeatedSint64)) + } + + if (repeatedFixed32.isNotEmpty()) { + encoder.writePackedFixed32(fieldNr = 37, value = repeatedFixed32) + } + + if (repeatedFixed64.isNotEmpty()) { + encoder.writePackedFixed64(fieldNr = 38, value = repeatedFixed64) + } + + if (repeatedSfixed32.isNotEmpty()) { + encoder.writePackedSFixed32(fieldNr = 39, value = repeatedSfixed32) + } + + if (repeatedSfixed64.isNotEmpty()) { + encoder.writePackedSFixed64(fieldNr = 40, value = repeatedSfixed64) + } + + if (repeatedFloat.isNotEmpty()) { + encoder.writePackedFloat(fieldNr = 41, value = repeatedFloat) + } + + if (repeatedDouble.isNotEmpty()) { + encoder.writePackedDouble(fieldNr = 42, value = repeatedDouble) + } + + if (repeatedBool.isNotEmpty()) { + encoder.writePackedBool(fieldNr = 43, value = repeatedBool, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedBool(repeatedBool)) + } + + if (repeatedString.isNotEmpty()) { + repeatedString.forEach { + encoder.writeString(44, it) + } + } + + if (repeatedBytes.isNotEmpty()) { + repeatedBytes.forEach { + encoder.writeBytes(45, it) + } + } + + if (repeatedNestedMessage.isNotEmpty()) { + repeatedNestedMessage.forEach { + encoder.writeMessage(fieldNr = 48, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedForeignMessage.isNotEmpty()) { + repeatedForeignMessage.forEach { + encoder.writeMessage(fieldNr = 49, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedNestedEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum)) + } + + if (repeatedForeignEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum)) + } + + if (repeatedStringPiece.isNotEmpty()) { + repeatedStringPiece.forEach { + encoder.writeString(54, it) + } + } + + if (repeatedCord.isNotEmpty()) { + repeatedCord.forEach { + encoder.writeString(55, it) + } + } + + if (packedInt32.isNotEmpty()) { + encoder.writePackedInt32(fieldNr = 75, value = packedInt32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt32(packedInt32)) + } + + if (packedInt64.isNotEmpty()) { + encoder.writePackedInt64(fieldNr = 76, value = packedInt64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedInt64(packedInt64)) + } + + if (packedUint32.isNotEmpty()) { + encoder.writePackedUInt32(fieldNr = 77, value = packedUint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(packedUint32)) + } + + if (packedUint64.isNotEmpty()) { + encoder.writePackedUInt64(fieldNr = 78, value = packedUint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(packedUint64)) + } + + if (packedSint32.isNotEmpty()) { + encoder.writePackedSInt32(fieldNr = 79, value = packedSint32, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(packedSint32)) + } + + if (packedSint64.isNotEmpty()) { + encoder.writePackedSInt64(fieldNr = 80, value = packedSint64, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(packedSint64)) + } + + if (packedFixed32.isNotEmpty()) { + encoder.writePackedFixed32(fieldNr = 81, value = packedFixed32) + } + + if (packedFixed64.isNotEmpty()) { + encoder.writePackedFixed64(fieldNr = 82, value = packedFixed64) + } + + if (packedSfixed32.isNotEmpty()) { + encoder.writePackedSFixed32(fieldNr = 83, value = packedSfixed32) + } + + if (packedSfixed64.isNotEmpty()) { + encoder.writePackedSFixed64(fieldNr = 84, value = packedSfixed64) + } + + if (packedFloat.isNotEmpty()) { + encoder.writePackedFloat(fieldNr = 85, value = packedFloat) + } + + if (packedDouble.isNotEmpty()) { + encoder.writePackedDouble(fieldNr = 86, value = packedDouble) + } + + if (packedBool.isNotEmpty()) { + encoder.writePackedBool(fieldNr = 87, value = packedBool, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedBool(packedBool)) + } + + if (packedNestedEnum.isNotEmpty()) { + encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum)) + } + + if (unpackedInt32.isNotEmpty()) { + unpackedInt32.forEach { + encoder.writeInt32(89, it) + } + } + + if (unpackedInt64.isNotEmpty()) { + unpackedInt64.forEach { + encoder.writeInt64(90, it) + } + } + + if (unpackedUint32.isNotEmpty()) { + unpackedUint32.forEach { + encoder.writeUInt32(91, it) + } + } + + if (unpackedUint64.isNotEmpty()) { + unpackedUint64.forEach { + encoder.writeUInt64(92, it) + } + } + + if (unpackedSint32.isNotEmpty()) { + unpackedSint32.forEach { + encoder.writeSInt32(93, it) + } + } + + if (unpackedSint64.isNotEmpty()) { + unpackedSint64.forEach { + encoder.writeSInt64(94, it) + } + } + + if (unpackedFixed32.isNotEmpty()) { + unpackedFixed32.forEach { + encoder.writeFixed32(95, it) + } + } + + if (unpackedFixed64.isNotEmpty()) { + unpackedFixed64.forEach { + encoder.writeFixed64(96, it) + } + } + + if (unpackedSfixed32.isNotEmpty()) { + unpackedSfixed32.forEach { + encoder.writeSFixed32(97, it) + } + } + + if (unpackedSfixed64.isNotEmpty()) { + unpackedSfixed64.forEach { + encoder.writeSFixed64(98, it) + } + } + + if (unpackedFloat.isNotEmpty()) { + unpackedFloat.forEach { + encoder.writeFloat(99, it) + } + } + + if (unpackedDouble.isNotEmpty()) { + unpackedDouble.forEach { + encoder.writeDouble(100, it) + } + } + + if (unpackedBool.isNotEmpty()) { + unpackedBool.forEach { + encoder.writeBool(101, it) + } + } + + if (unpackedNestedEnum.isNotEmpty()) { + unpackedNestedEnum.forEach { + encoder.writeEnum(102, it) + } + } + + if (mapInt32Int32.isNotEmpty()) { + mapInt32Int32.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 56, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt64Int64.isNotEmpty()) { + mapInt64Int64.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 57, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapUint32Uint32.isNotEmpty()) { + mapUint32Uint32.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 58, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapUint64Uint64.isNotEmpty()) { + mapUint64Uint64.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 59, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSint32Sint32.isNotEmpty()) { + mapSint32Sint32.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 60, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSint64Sint64.isNotEmpty()) { + mapSint64Sint64.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 61, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapFixed32Fixed32.isNotEmpty()) { + mapFixed32Fixed32.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 62, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapFixed64Fixed64.isNotEmpty()) { + mapFixed64Fixed64.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 63, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSfixed32Sfixed32.isNotEmpty()) { + mapSfixed32Sfixed32.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 64, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapSfixed64Sfixed64.isNotEmpty()) { + mapSfixed64Sfixed64.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 65, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt32Float.isNotEmpty()) { + mapInt32Float.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 66, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapInt32Double.isNotEmpty()) { + mapInt32Double.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 67, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapBoolBool.isNotEmpty()) { + mapBoolBool.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 68, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringString.isNotEmpty()) { + mapStringString.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 69, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringBytes.isNotEmpty()) { + mapStringBytes.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 70, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringNestedMessage.isNotEmpty()) { + mapStringNestedMessage.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 71, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringForeignMessage.isNotEmpty()) { + mapStringForeignMessage.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 72, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringNestedEnum.isNotEmpty()) { + mapStringNestedEnum.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 73, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (mapStringForeignEnum.isNotEmpty()) { + mapStringForeignEnum.forEach { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 74, value = entry.asInternal()) { encodeWith(it) } + } + } + } + + if (presenceMask[3]) { + encoder.writeMessage(fieldNr = 201, value = optionalBoolWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[4]) { + encoder.writeMessage(fieldNr = 202, value = optionalInt32Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[5]) { + encoder.writeMessage(fieldNr = 203, value = optionalInt64Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[6]) { + encoder.writeMessage(fieldNr = 204, value = optionalUint32Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[7]) { + encoder.writeMessage(fieldNr = 205, value = optionalUint64Wrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[8]) { + encoder.writeMessage(fieldNr = 206, value = optionalFloatWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[9]) { + encoder.writeMessage(fieldNr = 207, value = optionalDoubleWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[10]) { + encoder.writeMessage(fieldNr = 208, value = optionalStringWrapper.asInternal()) { encodeWith(it) } + } + + if (presenceMask[11]) { + encoder.writeMessage(fieldNr = 209, value = optionalBytesWrapper.asInternal()) { encodeWith(it) } + } + + if (repeatedBoolWrapper.isNotEmpty()) { + repeatedBoolWrapper.forEach { + encoder.writeMessage(fieldNr = 211, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedInt32Wrapper.isNotEmpty()) { + repeatedInt32Wrapper.forEach { + encoder.writeMessage(fieldNr = 212, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedInt64Wrapper.isNotEmpty()) { + repeatedInt64Wrapper.forEach { + encoder.writeMessage(fieldNr = 213, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedUint32Wrapper.isNotEmpty()) { + repeatedUint32Wrapper.forEach { + encoder.writeMessage(fieldNr = 214, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedUint64Wrapper.isNotEmpty()) { + repeatedUint64Wrapper.forEach { + encoder.writeMessage(fieldNr = 215, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedFloatWrapper.isNotEmpty()) { + repeatedFloatWrapper.forEach { + encoder.writeMessage(fieldNr = 216, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedDoubleWrapper.isNotEmpty()) { + repeatedDoubleWrapper.forEach { + encoder.writeMessage(fieldNr = 217, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedStringWrapper.isNotEmpty()) { + repeatedStringWrapper.forEach { + encoder.writeMessage(fieldNr = 218, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedBytesWrapper.isNotEmpty()) { + repeatedBytesWrapper.forEach { + encoder.writeMessage(fieldNr = 219, value = it.asInternal()) { encodeWith(it) } + } + } + + if (presenceMask[12]) { + encoder.writeMessage(fieldNr = 301, value = optionalDuration.asInternal()) { encodeWith(it) } + } + + if (presenceMask[13]) { + encoder.writeMessage(fieldNr = 302, value = optionalTimestamp.asInternal()) { encodeWith(it) } + } + + if (presenceMask[14]) { + encoder.writeMessage(fieldNr = 303, value = optionalFieldMask.asInternal()) { encodeWith(it) } + } + + if (presenceMask[15]) { + encoder.writeMessage(fieldNr = 304, value = optionalStruct.asInternal()) { encodeWith(it) } + } + + if (presenceMask[16]) { + encoder.writeMessage(fieldNr = 305, value = optionalAny.asInternal()) { encodeWith(it) } + } + + if (presenceMask[17]) { + encoder.writeMessage(fieldNr = 306, value = optionalValue.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + encoder.writeEnum(fieldNr = 307, value = optionalNullValue.number) + } + + if (repeatedDuration.isNotEmpty()) { + repeatedDuration.forEach { + encoder.writeMessage(fieldNr = 311, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedTimestamp.isNotEmpty()) { + repeatedTimestamp.forEach { + encoder.writeMessage(fieldNr = 312, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedFieldmask.isNotEmpty()) { + repeatedFieldmask.forEach { + encoder.writeMessage(fieldNr = 313, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedStruct.isNotEmpty()) { + repeatedStruct.forEach { + encoder.writeMessage(fieldNr = 324, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedAny.isNotEmpty()) { + repeatedAny.forEach { + encoder.writeMessage(fieldNr = 315, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedValue.isNotEmpty()) { + repeatedValue.forEach { + encoder.writeMessage(fieldNr = 316, value = it.asInternal()) { encodeWith(it) } + } + } + + if (repeatedListValue.isNotEmpty()) { + repeatedListValue.forEach { + encoder.writeMessage(fieldNr = 317, value = it.asInternal()) { encodeWith(it) } + } + } + + if (fieldname1 != 0) { + encoder.writeInt32(fieldNr = 401, value = fieldname1) + } + + if (fieldName2 != 0) { + encoder.writeInt32(fieldNr = 402, value = fieldName2) + } + + if (FieldName3 != 0) { + encoder.writeInt32(fieldNr = 403, value = FieldName3) + } + + if (field_Name4_ != 0) { + encoder.writeInt32(fieldNr = 404, value = field_Name4_) + } + + if (field0name5 != 0) { + encoder.writeInt32(fieldNr = 405, value = field0name5) + } + + if (field_0Name6 != 0) { + encoder.writeInt32(fieldNr = 406, value = field_0Name6) + } + + if (fieldName7 != 0) { + encoder.writeInt32(fieldNr = 407, value = fieldName7) + } + + if (FieldName8 != 0) { + encoder.writeInt32(fieldNr = 408, value = FieldName8) + } + + if (field_Name9 != 0) { + encoder.writeInt32(fieldNr = 409, value = field_Name9) + } + + if (Field_Name10 != 0) { + encoder.writeInt32(fieldNr = 410, value = Field_Name10) + } + + if (FIELD_NAME11 != 0) { + encoder.writeInt32(fieldNr = 411, value = FIELD_NAME11) + } + + if (FIELDName12 != 0) { + encoder.writeInt32(fieldNr = 412, value = FIELDName12) + } + + if (_FieldName13 != 0) { + encoder.writeInt32(fieldNr = 413, value = _FieldName13) + } + + if (__FieldName14 != 0) { + encoder.writeInt32(fieldNr = 414, value = __FieldName14) + } + + if (field_Name15 != 0) { + encoder.writeInt32(fieldNr = 415, value = field_Name15) + } + + if (field__Name16 != 0) { + encoder.writeInt32(fieldNr = 416, value = field__Name16) + } + + if (fieldName17__ != 0) { + encoder.writeInt32(fieldNr = 417, value = fieldName17__) + } + + if (FieldName18__ != 0) { + encoder.writeInt32(fieldNr = 418, value = FieldName18__) + } + + oneofField?.also { + when (val value = it) { + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint32 -> { + encoder.writeUInt32(fieldNr = 111, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + encoder.writeMessage(fieldNr = 112, value = value.value.asInternal()) { encodeWith(it) } + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofString -> { + encoder.writeString(fieldNr = 113, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBytes -> { + encoder.writeBytes(fieldNr = 114, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBool -> { + encoder.writeBool(fieldNr = 115, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint64 -> { + encoder.writeUInt64(fieldNr = 116, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofFloat -> { + encoder.writeFloat(fieldNr = 117, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofDouble -> { + encoder.writeDouble(fieldNr = 118, value = value.value) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofEnum -> { + encoder.writeEnum(fieldNr = 119, value = value.value.number) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNullValue -> { + encoder.writeEnum(fieldNr = 120, value = value.value.number) + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalInt32 = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalInt64 = decoder.readInt64() + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalUint32 = decoder.readUInt32() + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalUint64 = decoder.readUInt64() + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalSint32 = decoder.readSInt32() + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalSint64 = decoder.readSInt64() + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalFixed32 = decoder.readFixed32() + } + + tag.fieldNr == 8 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalFixed64 = decoder.readFixed64() + } + + tag.fieldNr == 9 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalSfixed32 = decoder.readSFixed32() + } + + tag.fieldNr == 10 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalSfixed64 = decoder.readSFixed64() + } + + tag.fieldNr == 11 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.optionalFloat = decoder.readFloat() + } + + tag.fieldNr == 12 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.optionalDouble = decoder.readDouble() + } + + tag.fieldNr == 13 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalBool = decoder.readBool() + } + + tag.fieldNr == 14 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalString = decoder.readString() + } + + tag.fieldNr == 15 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalBytes = decoder.readBytes() + } + + tag.fieldNr == 18 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.optionalNestedMessage = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + } + + decoder.readMessage(msg.optionalNestedMessage.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + tag.fieldNr == 19 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[1]) { + msg.optionalForeignMessage = com.google.protobuf_test_messages.proto3.ForeignMessageInternal() + } + + decoder.readMessage(msg.optionalForeignMessage.asInternal(), com.google.protobuf_test_messages.proto3.ForeignMessageInternal::decodeWith) + } + + tag.fieldNr == 21 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalNestedEnum = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 22 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalForeignEnum = com.google.protobuf_test_messages.proto3.ForeignEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 23 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalAliasedEnum = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 24 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalStringPiece = decoder.readString() + } + + tag.fieldNr == 25 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.optionalCord = decoder.readString() + } + + tag.fieldNr == 27 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[2]) { + msg.recursiveMessage = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() + } + + decoder.readMessage(msg.recursiveMessage.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal::decodeWith) + } + + tag.fieldNr == 31 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedInt32 = decoder.readPackedInt32() + } + + tag.fieldNr == 32 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedInt64 = decoder.readPackedInt64() + } + + tag.fieldNr == 33 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedUint32 = decoder.readPackedUInt32() + } + + tag.fieldNr == 34 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedUint64 = decoder.readPackedUInt64() + } + + tag.fieldNr == 35 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSint32 = decoder.readPackedSInt32() + } + + tag.fieldNr == 36 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSint64 = decoder.readPackedSInt64() + } + + tag.fieldNr == 37 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFixed32 = decoder.readPackedFixed32() + } + + tag.fieldNr == 38 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFixed64 = decoder.readPackedFixed64() + } + + tag.fieldNr == 39 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSfixed32 = decoder.readPackedSFixed32() + } + + tag.fieldNr == 40 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedSfixed64 = decoder.readPackedSFixed64() + } + + tag.fieldNr == 41 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedFloat = decoder.readPackedFloat() + } + + tag.fieldNr == 42 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedDouble = decoder.readPackedDouble() + } + + tag.fieldNr == 43 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedBool = decoder.readPackedBool() + } + + tag.fieldNr == 44 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedString as MutableList).add(elem) + } + + tag.fieldNr == 45 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readBytes() + (msg.repeatedBytes as MutableList).add(elem) + } + + tag.fieldNr == 48 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + (msg.repeatedNestedMessage as MutableList).add(elem) + } + + tag.fieldNr == 49 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf_test_messages.proto3.ForeignMessageInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf_test_messages.proto3.ForeignMessageInternal::decodeWith) + (msg.repeatedForeignMessage as MutableList).add(elem) + } + + tag.fieldNr == 51 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedNestedEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 52 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.repeatedForeignEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 54 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedStringPiece as MutableList).add(elem) + } + + tag.fieldNr == 55 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.repeatedCord as MutableList).add(elem) + } + + tag.fieldNr == 75 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedInt32 = decoder.readPackedInt32() + } + + tag.fieldNr == 76 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedInt64 = decoder.readPackedInt64() + } + + tag.fieldNr == 77 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedUint32 = decoder.readPackedUInt32() + } + + tag.fieldNr == 78 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedUint64 = decoder.readPackedUInt64() + } + + tag.fieldNr == 79 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSint32 = decoder.readPackedSInt32() + } + + tag.fieldNr == 80 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSint64 = decoder.readPackedSInt64() + } + + tag.fieldNr == 81 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFixed32 = decoder.readPackedFixed32() + } + + tag.fieldNr == 82 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFixed64 = decoder.readPackedFixed64() + } + + tag.fieldNr == 83 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSfixed32 = decoder.readPackedSFixed32() + } + + tag.fieldNr == 84 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedSfixed64 = decoder.readPackedSFixed64() + } + + tag.fieldNr == 85 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedFloat = decoder.readPackedFloat() + } + + tag.fieldNr == 86 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedDouble = decoder.readPackedDouble() + } + + tag.fieldNr == 87 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedBool = decoder.readPackedBool() + } + + tag.fieldNr == 88 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.packedNestedEnum = decoder.readPackedEnum() + } + + tag.fieldNr == 89 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readInt32() + (msg.unpackedInt32 as MutableList).add(elem) + } + + tag.fieldNr == 90 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readInt64() + (msg.unpackedInt64 as MutableList).add(elem) + } + + tag.fieldNr == 91 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readUInt32() + (msg.unpackedUint32 as MutableList).add(elem) + } + + tag.fieldNr == 92 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readUInt64() + (msg.unpackedUint64 as MutableList).add(elem) + } + + tag.fieldNr == 93 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readSInt32() + (msg.unpackedSint32 as MutableList).add(elem) + } + + tag.fieldNr == 94 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readSInt64() + (msg.unpackedSint64 as MutableList).add(elem) + } + + tag.fieldNr == 95 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readFixed32() + (msg.unpackedFixed32 as MutableList).add(elem) + } + + tag.fieldNr == 96 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readFixed64() + (msg.unpackedFixed64 as MutableList).add(elem) + } + + tag.fieldNr == 97 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readSFixed32() + (msg.unpackedSfixed32 as MutableList).add(elem) + } + + tag.fieldNr == 98 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readSFixed64() + (msg.unpackedSfixed64 as MutableList).add(elem) + } + + tag.fieldNr == 99 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + val elem = decoder.readFloat() + (msg.unpackedFloat as MutableList).add(elem) + } + + tag.fieldNr == 100 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + val elem = decoder.readDouble() + (msg.unpackedDouble as MutableList).add(elem) + } + + tag.fieldNr == 101 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = decoder.readBool() + (msg.unpackedBool as MutableList).add(elem) + } + + tag.fieldNr == 102 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + val elem = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + (msg.unpackedNestedEnum as MutableList).add(elem) + } + + tag.fieldNr == 56 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal::decodeWith) + (msg.mapInt32Int32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 57 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal::decodeWith) + (msg.mapInt64Int64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 58 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal::decodeWith) + (msg.mapUint32Uint32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 59 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal::decodeWith) + (msg.mapUint64Uint64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 60 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal::decodeWith) + (msg.mapSint32Sint32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 61 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal::decodeWith) + (msg.mapSint64Sint64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 62 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal::decodeWith) + (msg.mapFixed32Fixed32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 63 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal::decodeWith) + (msg.mapFixed64Fixed64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 64 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal::decodeWith) + (msg.mapSfixed32Sfixed32 as MutableMap)[key] = value + } + } + + tag.fieldNr == 65 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal::decodeWith) + (msg.mapSfixed64Sfixed64 as MutableMap)[key] = value + } + } + + tag.fieldNr == 66 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal::decodeWith) + (msg.mapInt32Float as MutableMap)[key] = value + } + } + + tag.fieldNr == 67 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal::decodeWith) + (msg.mapInt32Double as MutableMap)[key] = value + } + } + + tag.fieldNr == 68 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal::decodeWith) + (msg.mapBoolBool as MutableMap)[key] = value + } + } + + tag.fieldNr == 69 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal::decodeWith) + (msg.mapStringString as MutableMap)[key] = value + } + } + + tag.fieldNr == 70 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal::decodeWith) + (msg.mapStringBytes as MutableMap)[key] = value + } + } + + tag.fieldNr == 71 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal::decodeWith) + (msg.mapStringNestedMessage as MutableMap)[key] = value + } + } + + tag.fieldNr == 72 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal::decodeWith) + (msg.mapStringForeignMessage as MutableMap)[key] = value + } + } + + tag.fieldNr == 73 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal::decodeWith) + (msg.mapStringNestedEnum as MutableMap)[key] = value + } + } + + tag.fieldNr == 74 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal::decodeWith) + (msg.mapStringForeignEnum as MutableMap)[key] = value + } + } + + tag.fieldNr == 201 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[3]) { + msg.optionalBoolWrapper = com.google.protobuf.BoolValueInternal() + } + + decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + } + + tag.fieldNr == 202 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[4]) { + msg.optionalInt32Wrapper = com.google.protobuf.Int32ValueInternal() + } + + decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + } + + tag.fieldNr == 203 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[5]) { + msg.optionalInt64Wrapper = com.google.protobuf.Int64ValueInternal() + } + + decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + } + + tag.fieldNr == 204 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[6]) { + msg.optionalUint32Wrapper = com.google.protobuf.UInt32ValueInternal() + } + + decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + } + + tag.fieldNr == 205 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[7]) { + msg.optionalUint64Wrapper = com.google.protobuf.UInt64ValueInternal() + } + + decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + } + + tag.fieldNr == 206 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[8]) { + msg.optionalFloatWrapper = com.google.protobuf.FloatValueInternal() + } + + decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + } + + tag.fieldNr == 207 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[9]) { + msg.optionalDoubleWrapper = com.google.protobuf.DoubleValueInternal() + } + + decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + } + + tag.fieldNr == 208 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[10]) { + msg.optionalStringWrapper = com.google.protobuf.StringValueInternal() + } + + decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + } + + tag.fieldNr == 209 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[11]) { + msg.optionalBytesWrapper = com.google.protobuf.BytesValueInternal() + } + + decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + } + + tag.fieldNr == 211 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.BoolValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + (msg.repeatedBoolWrapper as MutableList).add(elem) + } + + tag.fieldNr == 212 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.Int32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + (msg.repeatedInt32Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 213 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.Int64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + (msg.repeatedInt64Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 214 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.UInt32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + (msg.repeatedUint32Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 215 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.UInt64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + (msg.repeatedUint64Wrapper as MutableList).add(elem) + } + + tag.fieldNr == 216 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.FloatValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + (msg.repeatedFloatWrapper as MutableList).add(elem) + } + + tag.fieldNr == 217 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.DoubleValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + (msg.repeatedDoubleWrapper as MutableList).add(elem) + } + + tag.fieldNr == 218 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.StringValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + (msg.repeatedStringWrapper as MutableList).add(elem) + } + + tag.fieldNr == 219 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.BytesValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + (msg.repeatedBytesWrapper as MutableList).add(elem) + } + + tag.fieldNr == 301 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[12]) { + msg.optionalDuration = com.google.protobuf.DurationInternal() + } + + decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + } + + tag.fieldNr == 302 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[13]) { + msg.optionalTimestamp = com.google.protobuf.TimestampInternal() + } + + decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + } + + tag.fieldNr == 303 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[14]) { + msg.optionalFieldMask = com.google.protobuf.FieldMaskInternal() + } + + decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + } + + tag.fieldNr == 304 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[15]) { + msg.optionalStruct = com.google.protobuf.StructInternal() + } + + decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.StructInternal::decodeWith) + } + + tag.fieldNr == 305 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[16]) { + msg.optionalAny = com.google.protobuf.AnyInternal() + } + + decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + } + + tag.fieldNr == 306 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[17]) { + msg.optionalValue = com.google.protobuf.ValueInternal() + } + + decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + } + + tag.fieldNr == 307 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.optionalNullValue = com.google.protobuf.NullValue.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 311 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.DurationInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + (msg.repeatedDuration as MutableList).add(elem) + } + + tag.fieldNr == 312 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.TimestampInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + (msg.repeatedTimestamp as MutableList).add(elem) + } + + tag.fieldNr == 313 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.FieldMaskInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + (msg.repeatedFieldmask as MutableList).add(elem) + } + + tag.fieldNr == 324 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.StructInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.StructInternal::decodeWith) + (msg.repeatedStruct as MutableList).add(elem) + } + + tag.fieldNr == 315 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.AnyInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + (msg.repeatedAny as MutableList).add(elem) + } + + tag.fieldNr == 316 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + (msg.repeatedValue as MutableList).add(elem) + } + + tag.fieldNr == 317 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.ListValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.ListValueInternal::decodeWith) + (msg.repeatedListValue as MutableList).add(elem) + } + + tag.fieldNr == 401 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldname1 = decoder.readInt32() + } + + tag.fieldNr == 402 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName2 = decoder.readInt32() + } + + tag.fieldNr == 403 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName3 = decoder.readInt32() + } + + tag.fieldNr == 404 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name4_ = decoder.readInt32() + } + + tag.fieldNr == 405 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field0name5 = decoder.readInt32() + } + + tag.fieldNr == 406 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_0Name6 = decoder.readInt32() + } + + tag.fieldNr == 407 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName7 = decoder.readInt32() + } + + tag.fieldNr == 408 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName8 = decoder.readInt32() + } + + tag.fieldNr == 409 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name9 = decoder.readInt32() + } + + tag.fieldNr == 410 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.Field_Name10 = decoder.readInt32() + } + + tag.fieldNr == 411 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FIELD_NAME11 = decoder.readInt32() + } + + tag.fieldNr == 412 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FIELDName12 = decoder.readInt32() + } + + tag.fieldNr == 413 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg._FieldName13 = decoder.readInt32() + } + + tag.fieldNr == 414 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.__FieldName14 = decoder.readInt32() + } + + tag.fieldNr == 415 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field_Name15 = decoder.readInt32() + } + + tag.fieldNr == 416 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.field__Name16 = decoder.readInt32() + } + + tag.fieldNr == 417 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.fieldName17__ = decoder.readInt32() + } + + tag.fieldNr == 418 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.FieldName18__ = decoder.readInt32() + } + + tag.fieldNr == 111 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint32(decoder.readUInt32()) + } + + tag.fieldNr == 112 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val field = (msg.oneofField as? com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage) ?: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal()).also { + msg.oneofField = it + } + + decoder.readMessage(field.value.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + tag.fieldNr == 113 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofString(decoder.readString()) + } + + tag.fieldNr == 114 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBytes(decoder.readBytes()) + } + + tag.fieldNr == 115 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBool(decoder.readBool()) + } + + tag.fieldNr == 116 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint64(decoder.readUInt64()) + } + + tag.fieldNr == 117 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofFloat(decoder.readFloat()) + } + + tag.fieldNr == 118 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofDouble(decoder.readDouble()) + } + + tag.fieldNr == 119 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofEnum(com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum())) + } + + tag.fieldNr == 120 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.NullValue.fromNumber(decoder.readEnum())) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.computeSize(): Int { + var __result = 0 + if (optionalInt32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(optionalInt32)) + } + + if (optionalInt64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(optionalInt64)) + } + + if (optionalUint32 != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(optionalUint32)) + } + + if (optionalUint64 != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(optionalUint64)) + } + + if (optionalSint32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(optionalSint32)) + } + + if (optionalSint64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(optionalSint64)) + } + + if (optionalFixed32 != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(optionalFixed32)) + } + + if (optionalFixed64 != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(8, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(optionalFixed64)) + } + + if (optionalSfixed32 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(9, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(optionalSfixed32)) + } + + if (optionalSfixed64 != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(10, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(optionalSfixed64)) + } + + if (optionalFloat != 0.0f) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(11, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(optionalFloat)) + } + + if (optionalDouble != 0.0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(12, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(optionalDouble)) + } + + if (optionalBool != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(13, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(optionalBool)) + } + + if (optionalString.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalString).let { kotlinx.rpc.protobuf.internal.WireSize.tag(14, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (optionalBytes.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(optionalBytes).let { kotlinx.rpc.protobuf.internal.WireSize.tag(15, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += optionalNestedMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(18, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[1]) { + __result += optionalForeignMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(19, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG != optionalNestedEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(21, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNestedEnum.number)) + } + + if (com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO != optionalForeignEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(22, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalForeignEnum.number)) + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO != optionalAliasedEnum) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(23, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalAliasedEnum.number)) + } + + if (optionalStringPiece.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalStringPiece).let { kotlinx.rpc.protobuf.internal.WireSize.tag(24, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (optionalCord.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(optionalCord).let { kotlinx.rpc.protobuf.internal.WireSize.tag(25, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[2]) { + __result += recursiveMessage.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(27, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedInt32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt32(repeatedInt32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(31, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedInt64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt64(repeatedInt64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(32, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedUint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(repeatedUint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(33, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedUint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(repeatedUint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(34, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(repeatedSint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(35, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(repeatedSint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(36, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed32(repeatedFixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(37, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed64(repeatedFixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(38, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSfixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed32(repeatedSfixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(39, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedSfixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed64(repeatedSfixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(40, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedFloat.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFloat(repeatedFloat).let { kotlinx.rpc.protobuf.internal.WireSize.tag(41, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedDouble.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedDouble(repeatedDouble).let { kotlinx.rpc.protobuf.internal.WireSize.tag(42, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedBool.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedBool(repeatedBool).let { kotlinx.rpc.protobuf.internal.WireSize.tag(43, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedString.isNotEmpty()) { + __result = repeatedString.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(44, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedBytes.isNotEmpty()) { + __result = repeatedBytes.sumOf { kotlinx.rpc.protobuf.internal.WireSize.bytes(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(45, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedNestedMessage.isNotEmpty()) { + __result = repeatedNestedMessage.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(48, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedForeignMessage.isNotEmpty()) { + __result = repeatedForeignMessage.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(49, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedNestedEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedForeignEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedStringPiece.isNotEmpty()) { + __result = repeatedStringPiece.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(54, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedCord.isNotEmpty()) { + __result = repeatedCord.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(55, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (packedInt32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt32(packedInt32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(75, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedInt64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedInt64(packedInt64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(76, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedUint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt32(packedUint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(77, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedUint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedUInt64(packedUint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(78, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSint32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt32(packedSint32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(79, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSint64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSInt64(packedSint64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(80, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed32(packedFixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(81, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFixed64(packedFixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(82, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSfixed32.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed32(packedSfixed32).let { kotlinx.rpc.protobuf.internal.WireSize.tag(83, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedSfixed64.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedSFixed64(packedSfixed64).let { kotlinx.rpc.protobuf.internal.WireSize.tag(84, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedFloat.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedFloat(packedFloat).let { kotlinx.rpc.protobuf.internal.WireSize.tag(85, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedDouble.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedDouble(packedDouble).let { kotlinx.rpc.protobuf.internal.WireSize.tag(86, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedBool.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedBool(packedBool).let { kotlinx.rpc.protobuf.internal.WireSize.tag(87, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (packedNestedEnum.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (unpackedInt32.isNotEmpty()) { + __result = unpackedInt32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.int32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(89, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedInt64.isNotEmpty()) { + __result = unpackedInt64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.int64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(90, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedUint32.isNotEmpty()) { + __result = unpackedUint32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.uInt32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(91, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedUint64.isNotEmpty()) { + __result = unpackedUint64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.uInt64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(92, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedSint32.isNotEmpty()) { + __result = unpackedSint32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sInt32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(93, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedSint64.isNotEmpty()) { + __result = unpackedSint64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sInt64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(94, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedFixed32.isNotEmpty()) { + __result = unpackedFixed32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.fixed32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(95, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedFixed64.isNotEmpty()) { + __result = unpackedFixed64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.fixed64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(96, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedSfixed32.isNotEmpty()) { + __result = unpackedSfixed32.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sFixed32(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(97, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedSfixed64.isNotEmpty()) { + __result = unpackedSfixed64.sumOf { kotlinx.rpc.protobuf.internal.WireSize.sFixed64(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(98, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedFloat.isNotEmpty()) { + __result = unpackedFloat.sumOf { kotlinx.rpc.protobuf.internal.WireSize.float(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(99, kotlinx.rpc.protobuf.internal.WireType.FIXED32) } + } + + if (unpackedDouble.isNotEmpty()) { + __result = unpackedDouble.sumOf { kotlinx.rpc.protobuf.internal.WireSize.double(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(100, kotlinx.rpc.protobuf.internal.WireType.FIXED64) } + } + + if (unpackedBool.isNotEmpty()) { + __result = unpackedBool.sumOf { kotlinx.rpc.protobuf.internal.WireSize.bool(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(101, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (unpackedNestedEnum.isNotEmpty()) { + __result = unpackedNestedEnum.sumOf { kotlinx.rpc.protobuf.internal.WireSize.enum(it.number) + kotlinx.rpc.protobuf.internal.WireSize.tag(102, kotlinx.rpc.protobuf.internal.WireType.VARINT) } + } + + if (mapInt32Int32.isNotEmpty()) { + __result += mapInt32Int32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt64Int64.isNotEmpty()) { + __result += mapInt64Int64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapUint32Uint32.isNotEmpty()) { + __result += mapUint32Uint32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapUint64Uint64.isNotEmpty()) { + __result += mapUint64Uint64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSint32Sint32.isNotEmpty()) { + __result += mapSint32Sint32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSint64Sint64.isNotEmpty()) { + __result += mapSint64Sint64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapFixed32Fixed32.isNotEmpty()) { + __result += mapFixed32Fixed32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapFixed64Fixed64.isNotEmpty()) { + __result += mapFixed64Fixed64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSfixed32Sfixed32.isNotEmpty()) { + __result += mapSfixed32Sfixed32.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapSfixed64Sfixed64.isNotEmpty()) { + __result += mapSfixed64Sfixed64.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt32Float.isNotEmpty()) { + __result += mapInt32Float.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapInt32Double.isNotEmpty()) { + __result += mapInt32Double.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapBoolBool.isNotEmpty()) { + __result += mapBoolBool.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringString.isNotEmpty()) { + __result += mapStringString.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringBytes.isNotEmpty()) { + __result += mapStringBytes.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringNestedMessage.isNotEmpty()) { + __result += mapStringNestedMessage.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringForeignMessage.isNotEmpty()) { + __result += mapStringForeignMessage.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringNestedEnum.isNotEmpty()) { + __result += mapStringNestedEnum.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (mapStringForeignEnum.isNotEmpty()) { + __result += mapStringForeignEnum.entries.sumOf { kEntry -> + com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + if (presenceMask[3]) { + __result += optionalBoolWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(201, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[4]) { + __result += optionalInt32Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(202, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[5]) { + __result += optionalInt64Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(203, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[6]) { + __result += optionalUint32Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(204, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[7]) { + __result += optionalUint64Wrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(205, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[8]) { + __result += optionalFloatWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(206, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[9]) { + __result += optionalDoubleWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(207, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[10]) { + __result += optionalStringWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(208, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[11]) { + __result += optionalBytesWrapper.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(209, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (repeatedBoolWrapper.isNotEmpty()) { + __result = repeatedBoolWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(211, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedInt32Wrapper.isNotEmpty()) { + __result = repeatedInt32Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(212, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedInt64Wrapper.isNotEmpty()) { + __result = repeatedInt64Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(213, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedUint32Wrapper.isNotEmpty()) { + __result = repeatedUint32Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(214, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedUint64Wrapper.isNotEmpty()) { + __result = repeatedUint64Wrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(215, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedFloatWrapper.isNotEmpty()) { + __result = repeatedFloatWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(216, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedDoubleWrapper.isNotEmpty()) { + __result = repeatedDoubleWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(217, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedStringWrapper.isNotEmpty()) { + __result = repeatedStringWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(218, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedBytesWrapper.isNotEmpty()) { + __result = repeatedBytesWrapper.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(219, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (presenceMask[12]) { + __result += optionalDuration.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(301, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[13]) { + __result += optionalTimestamp.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(302, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[14]) { + __result += optionalFieldMask.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(303, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[15]) { + __result += optionalStruct.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(304, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[16]) { + __result += optionalAny.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(305, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[17]) { + __result += optionalValue.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(306, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(307, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNullValue.number)) + } + + if (repeatedDuration.isNotEmpty()) { + __result = repeatedDuration.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(311, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedTimestamp.isNotEmpty()) { + __result = repeatedTimestamp.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(312, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedFieldmask.isNotEmpty()) { + __result = repeatedFieldmask.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(313, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedStruct.isNotEmpty()) { + __result = repeatedStruct.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(324, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedAny.isNotEmpty()) { + __result = repeatedAny.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(315, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedValue.isNotEmpty()) { + __result = repeatedValue.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(316, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (repeatedListValue.isNotEmpty()) { + __result = repeatedListValue.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(317, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (fieldname1 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(401, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldname1)) + } + + if (fieldName2 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(402, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName2)) + } + + if (FieldName3 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(403, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName3)) + } + + if (field_Name4_ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(404, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name4_)) + } + + if (field0name5 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(405, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field0name5)) + } + + if (field_0Name6 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(406, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_0Name6)) + } + + if (fieldName7 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(407, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName7)) + } + + if (FieldName8 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(408, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName8)) + } + + if (field_Name9 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(409, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name9)) + } + + if (Field_Name10 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(410, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(Field_Name10)) + } + + if (FIELD_NAME11 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(411, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FIELD_NAME11)) + } + + if (FIELDName12 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(412, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FIELDName12)) + } + + if (_FieldName13 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(413, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(_FieldName13)) + } + + if (__FieldName14 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(414, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(__FieldName14)) + } + + if (field_Name15 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(415, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field_Name15)) + } + + if (field__Name16 != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(416, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(field__Name16)) + } + + if (fieldName17__ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(417, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(fieldName17__)) + } + + if (FieldName18__ != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(418, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(FieldName18__)) + } + + oneofField?.also { + when (val value = it) { + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint32 -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(111, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(value.value)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNestedMessage -> { + __result += value.value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(112, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofString -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(113, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBytes -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(114, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofBool -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(115, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value.value)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofUint64 -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(116, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(value.value)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofFloat -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(117, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(value.value)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofDouble -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(118, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value.value)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofEnum -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(119, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.value.number)) + } + + is com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNullValue -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(120, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.value.number)) + } + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal { + return this as? com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (c != 0) { + encoder.writeInt32(fieldNr = 1, value = c) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.c = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.computeSize(): Int { + var __result = 0 + if (c != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(c)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.proto3.ForeignMessageInternal { + return this as? com.google.protobuf_test_messages.proto3.ForeignMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + // no fields to encode +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.computeSize(): Int { + var __result = 0 + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal { + return this as? com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + // no fields to encode +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.computeSize(): Int { + var __result = 0 + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal { + return this as? com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + corecursive.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (a != 0) { + encoder.writeInt32(fieldNr = 1, value = a) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = corecursive.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.a = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.corecursive = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() + } + + decoder.readMessage(msg.corecursive.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.computeSize(): Int { + var __result = 0 + if (a != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(a)) + } + + if (presenceMask[0]) { + __result += corecursive.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal { + return this as? com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeInt64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0u) { + encoder.writeUInt32(fieldNr = 1, value = key) + } + + if (value != 0u) { + encoder.writeUInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readUInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(key)) + } + + if (value != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0uL) { + encoder.writeUInt64(fieldNr = 1, value = key) + } + + if (value != 0uL) { + encoder.writeUInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readUInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(key)) + } + + if (value != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeSInt32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeSInt32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readSInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readSInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeSInt64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeSInt64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readSInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readSInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.sInt64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0u) { + encoder.writeFixed32(fieldNr = 1, value = key) + } + + if (value != 0u) { + encoder.writeFixed32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.key = decoder.readFixed32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readFixed32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(key)) + } + + if (value != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.fixed32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0uL) { + encoder.writeFixed64(fieldNr = 1, value = key) + } + + if (value != 0uL) { + encoder.writeFixed64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.key = decoder.readFixed64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readFixed64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(key)) + } + + if (value != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.fixed64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeSFixed32(fieldNr = 1, value = key) + } + + if (value != 0) { + encoder.writeSFixed32(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.key = decoder.readSFixed32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readSFixed32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(key)) + } + + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.sFixed32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0L) { + encoder.writeSFixed64(fieldNr = 1, value = key) + } + + if (value != 0L) { + encoder.writeSFixed64(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.key = decoder.readSFixed64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readSFixed64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(key)) + } + + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.sFixed64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0.0f) { + encoder.writeFloat(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readFloat() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0.0f) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != 0) { + encoder.writeInt32(fieldNr = 1, value = key) + } + + if (value != 0.0) { + encoder.writeDouble(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readInt32() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readDouble() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.computeSize(): Int { + var __result = 0 + if (key != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(key)) + } + + if (value != 0.0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key != false) { + encoder.writeBool(fieldNr = 1, value = key) + } + + if (value != false) { + encoder.writeBool(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.key = decoder.readBool() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readBool() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.computeSize(): Int { + var __result = 0 + if (key != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(key)) + } + + if (value != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (value.isNotEmpty()) { + encoder.writeString(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (value.isNotEmpty()) { + encoder.writeBytes(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readBytes() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf_test_messages.proto3.ForeignMessageInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf_test_messages.proto3.ForeignMessageInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG != value) { + encoder.writeEnum(fieldNr = 2, value = value.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG != value) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO != value) { + encoder.writeEnum(fieldNr = 2, value = value.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = com.google.protobuf_test_messages.proto3.ForeignEnum.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO != value) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.ForeignEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO + } + + 1 -> { + com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_BAR + } + + 2 -> { + com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_BAZ + } + + else -> { + com.google.protobuf_test_messages.proto3.ForeignEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.FOO + } + + 1 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.BAR + } + + 2 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.BAZ + } + + -1 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG + } + + else -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO + } + + 1 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_BAR + } + + 2 -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_BAZ + } + + else -> { + com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool { + return when (number) { + 0 -> { + com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.kFalse + } + + 1 -> { + com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.kTrue + } + + else -> { + com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.UNRECOGNIZED(number) + } + } +} + diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto new file mode 100644 index 000000000..e3298f085 --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto @@ -0,0 +1,172 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +syntax = "proto3"; + +package conformance; + +option java_package = "com.google.protobuf.conformance"; +option objc_class_prefix = "Conformance"; + +// This defines the conformance testing protocol. This protocol exists between +// the conformance test suite itself and the code being tested. For each test, +// the suite will send a ConformanceRequest message and expect a +// ConformanceResponse message. +// +// You can either run the tests in two different ways: +// +// 1. in-process (using the interface in conformance_test.h). +// +// 2. as a sub-process communicating over a pipe. Information about how to +// do this is in conformance_test_runner.cc. +// +// Pros/cons of the two approaches: +// +// - running as a sub-process is much simpler for languages other than C/C++. +// +// - running as a sub-process may be more tricky in unusual environments like +// iOS apps, where fork/stdin/stdout are not available. + +enum WireFormat { + UNSPECIFIED = 0; + PROTOBUF = 1; + JSON = 2; + JSPB = 3; // Only used inside Google. Opensource testees just skip it. + TEXT_FORMAT = 4; +} + +enum TestCategory { + UNSPECIFIED_TEST = 0; + BINARY_TEST = 1; // Test binary wire format. + JSON_TEST = 2; // Test json wire format. + // Similar to JSON_TEST. However, during parsing json, testee should ignore + // unknown fields. This feature is optional. Each implementation can decide + // whether to support it. See + // https://developers.google.com/protocol-buffers/docs/proto3#json_options + // for more detail. + JSON_IGNORE_UNKNOWN_PARSING_TEST = 3; + // Test jspb wire format. Only used inside Google. Opensource testees just + // skip it. + JSPB_TEST = 4; + // Test text format. For cpp, java and python, testees can already deal with + // this type. Testees of other languages can simply skip it. + TEXT_FORMAT_TEST = 5; +} + +// Meant to encapsulate all types of tests: successes, skips, failures, etc. +// Therefore, this may or may not have a failure message. Failure messages +// may be truncated for our failure lists. +message TestStatus { + string name = 1; + string failure_message = 2; + // What an actual test name matched to in a failure list. Can be wildcarded or + // an exact match without wildcards. + string matched_name = 3; +} + +// The conformance runner will request a list of failures as the first request. +// This will be known by message_type == "conformance.FailureSet", a conformance +// test should return a serialized FailureSet in protobuf_payload. +message FailureSet { + repeated TestStatus test = 2; + reserved 1; +} + +// Represents a single test case's input. The testee should: +// +// 1. parse this proto (which should always succeed) +// 2. parse the protobuf or JSON payload in "payload" (which may fail) +// 3. if the parse succeeded, serialize the message in the requested format. +message ConformanceRequest { + // The payload (whether protobuf of JSON) is always for a + // protobuf_test_messages.proto3.TestAllTypes proto (as defined in + // src/google/protobuf/proto3_test_messages.proto). + oneof payload { + bytes protobuf_payload = 1; + string json_payload = 2; + // Only used inside Google. Opensource testees just skip it. + string jspb_payload = 7; + string text_payload = 8; + } + + // Which format should the testee serialize its message to? + WireFormat requested_output_format = 3; + + // The full name for the test message to use; for the moment, either: + // protobuf_test_messages.proto3.TestAllTypesProto3 or + // protobuf_test_messages.proto2.TestAllTypesProto2 or + // protobuf_test_messages.editions.proto2.TestAllTypesProto2 or + // protobuf_test_messages.editions.proto3.TestAllTypesProto3 or + // protobuf_test_messages.editions.TestAllTypesEdition2023. + string message_type = 4; + + // Each test is given a specific test category. Some category may need + // specific support in testee programs. Refer to the definition of + // TestCategory for more information. + TestCategory test_category = 5; + + // Specify details for how to encode jspb. + JspbEncodingConfig jspb_encoding_options = 6; + + // This can be used in json and text format. If true, testee should print + // unknown fields instead of ignore. This feature is optional. + bool print_unknown_fields = 9; +} + +// Represents a single test case's output. +message ConformanceResponse { + oneof result { + // This string should be set to indicate parsing failed. The string can + // provide more information about the parse error if it is available. + // + // Setting this string does not necessarily mean the testee failed the + // test. Some of the test cases are intentionally invalid input. + string parse_error = 1; + + // If the input was successfully parsed but errors occurred when + // serializing it to the requested output format, set the error message in + // this field. + string serialize_error = 6; + + // This should be set if the test program timed out. The string should + // provide more information about what the child process was doing when it + // was killed. + string timeout_error = 9; + + // This should be set if some other error occurred. This will always + // indicate that the test failed. The string can provide more information + // about the failure. + string runtime_error = 2; + + // If the input was successfully parsed and the requested output was + // protobuf, serialize it to protobuf and set it in this field. + bytes protobuf_payload = 3; + + // If the input was successfully parsed and the requested output was JSON, + // serialize to JSON and set it in this field. + string json_payload = 4; + + // For when the testee skipped the test, likely because a certain feature + // wasn't supported, like JSON input/output. + string skipped = 5; + + // If the input was successfully parsed and the requested output was JSPB, + // serialize to JSPB and set it in this field. JSPB is only used inside + // Google. Opensource testees can just skip it. + string jspb_payload = 7; + + // If the input was successfully parsed and the requested output was + // TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field. + string text_payload = 8; + } +} + +// Encoding options for jspb format. +message JspbEncodingConfig { + // Encode the value field of Any as jspb array if true, otherwise binary. + bool use_jspb_array_any_format = 1; +} diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto new file mode 100644 index 000000000..7affff6fd --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto @@ -0,0 +1,217 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2024 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd + +edition = "2023"; + +package protobuf_test_messages.editions; + +option features.message_encoding = DELIMITED; +option java_package = "com.google.protobuf_test_messages.edition2023"; +option java_multiple_files = true; +option objc_class_prefix = "Editions"; + +message ComplexMessage { + int32 d = 1; +} + +message TestAllTypesEdition2023 { + message NestedMessage { + int32 a = 1; + TestAllTypesEdition2023 corecursive = 2 + [features.message_encoding = LENGTH_PREFIXED]; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + + NestedMessage optional_nested_message = 18 + [features.message_encoding = LENGTH_PREFIXED]; + ForeignMessageEdition2023 optional_foreign_message = 19 + [features.message_encoding = LENGTH_PREFIXED]; + + NestedEnum optional_nested_enum = 21; + ForeignEnumEdition2023 optional_foreign_enum = 22; + + string optional_string_piece = 24 [ctype = STRING_PIECE]; + string optional_cord = 25 [ctype = CORD]; + + TestAllTypesEdition2023 recursive_message = 27 + [features.message_encoding = LENGTH_PREFIXED]; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48 + [features.message_encoding = LENGTH_PREFIXED]; + repeated ForeignMessageEdition2023 repeated_foreign_message = 49 + [features.message_encoding = LENGTH_PREFIXED]; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnumEdition2023 repeated_foreign_enum = 52; + + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; + + // Packed + repeated int32 packed_int32 = 75 [features.repeated_field_encoding = PACKED]; + repeated int64 packed_int64 = 76 [features.repeated_field_encoding = PACKED]; + repeated uint32 packed_uint32 = 77 + [features.repeated_field_encoding = PACKED]; + repeated uint64 packed_uint64 = 78 + [features.repeated_field_encoding = PACKED]; + repeated sint32 packed_sint32 = 79 + [features.repeated_field_encoding = PACKED]; + repeated sint64 packed_sint64 = 80 + [features.repeated_field_encoding = PACKED]; + repeated fixed32 packed_fixed32 = 81 + [features.repeated_field_encoding = PACKED]; + repeated fixed64 packed_fixed64 = 82 + [features.repeated_field_encoding = PACKED]; + repeated sfixed32 packed_sfixed32 = 83 + [features.repeated_field_encoding = PACKED]; + repeated sfixed64 packed_sfixed64 = 84 + [features.repeated_field_encoding = PACKED]; + repeated float packed_float = 85 [features.repeated_field_encoding = PACKED]; + repeated double packed_double = 86 + [features.repeated_field_encoding = PACKED]; + repeated bool packed_bool = 87 [features.repeated_field_encoding = PACKED]; + repeated NestedEnum packed_nested_enum = 88 + [features.repeated_field_encoding = PACKED]; + + // Unpacked + repeated int32 unpacked_int32 = 89 + [features.repeated_field_encoding = EXPANDED]; + repeated int64 unpacked_int64 = 90 + [features.repeated_field_encoding = EXPANDED]; + repeated uint32 unpacked_uint32 = 91 + [features.repeated_field_encoding = EXPANDED]; + repeated uint64 unpacked_uint64 = 92 + [features.repeated_field_encoding = EXPANDED]; + repeated sint32 unpacked_sint32 = 93 + [features.repeated_field_encoding = EXPANDED]; + repeated sint64 unpacked_sint64 = 94 + [features.repeated_field_encoding = EXPANDED]; + repeated fixed32 unpacked_fixed32 = 95 + [features.repeated_field_encoding = EXPANDED]; + repeated fixed64 unpacked_fixed64 = 96 + [features.repeated_field_encoding = EXPANDED]; + repeated sfixed32 unpacked_sfixed32 = 97 + [features.repeated_field_encoding = EXPANDED]; + repeated sfixed64 unpacked_sfixed64 = 98 + [features.repeated_field_encoding = EXPANDED]; + repeated float unpacked_float = 99 + [features.repeated_field_encoding = EXPANDED]; + repeated double unpacked_double = 100 + [features.repeated_field_encoding = EXPANDED]; + repeated bool unpacked_bool = 101 + [features.repeated_field_encoding = EXPANDED]; + repeated NestedEnum unpacked_nested_enum = 102 + [features.repeated_field_encoding = EXPANDED]; + + // Map + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_float = 66; + map map_int32_double = 67; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112 + [features.message_encoding = LENGTH_PREFIXED]; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + } + + // extensions + extensions 120 to 200; + + // groups + message GroupLikeType { + int32 group_int32 = 202; + uint32 group_uint32 = 203; + } + GroupLikeType groupliketype = 201; + GroupLikeType delimited_field = 202; +} + +message ForeignMessageEdition2023 { + int32 c = 1; +} + +enum ForeignEnumEdition2023 { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} + +extend TestAllTypesEdition2023 { + int32 extension_int32 = 120; +} + +message GroupLikeType { + int32 c = 1; +} + +extend TestAllTypesEdition2023 { + GroupLikeType groupliketype = 121; + GroupLikeType delimited_ext = 122; +} diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto new file mode 100644 index 000000000..097e812b4 --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto @@ -0,0 +1,416 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +// +// Test schema for proto2 messages. This test schema is used by: +// +// - conformance tests +// + +// LINT: ALLOW_GROUPS + +syntax = "proto2"; + +package protobuf_test_messages.proto2; + +option java_package = "com.google.protobuf_test_messages.proto2"; +option objc_class_prefix = "Proto2"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; + +option cc_enable_arenas = true; + + +// This proto includes every type of field in both singular and repeated +// forms. +// +// Also, crucially, all messages and enums in this file are eventually +// submessages of this message. So for example, a fuzz test of TestAllTypes +// could trigger bugs that occur in any message type in this file. We verify +// this stays true in a unit test. +message TestAllTypesProto2 { + message NestedMessage { + optional int32 a = 1; + optional TestAllTypesProto2 corecursive = 2; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + optional int32 optional_int32 = 1; + optional int64 optional_int64 = 2; + optional uint32 optional_uint32 = 3; + optional uint64 optional_uint64 = 4; + optional sint32 optional_sint32 = 5; + optional sint64 optional_sint64 = 6; + optional fixed32 optional_fixed32 = 7; + optional fixed64 optional_fixed64 = 8; + optional sfixed32 optional_sfixed32 = 9; + optional sfixed64 optional_sfixed64 = 10; + optional float optional_float = 11; + optional double optional_double = 12; + optional bool optional_bool = 13; + optional string optional_string = 14; + optional bytes optional_bytes = 15; + + optional NestedMessage optional_nested_message = 18; + optional ForeignMessageProto2 optional_foreign_message = 19; + + optional NestedEnum optional_nested_enum = 21; + optional ForeignEnumProto2 optional_foreign_enum = 22; + + optional string optional_string_piece = 24 [ctype = STRING_PIECE]; + optional string optional_cord = 25 [ctype = CORD]; + + optional TestAllTypesProto2 recursive_message = 27; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessageProto2 repeated_foreign_message = 49; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnumProto2 repeated_foreign_enum = 52; + + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; + + // Packed + repeated int32 packed_int32 = 75 [packed = true]; + repeated int64 packed_int64 = 76 [packed = true]; + repeated uint32 packed_uint32 = 77 [packed = true]; + repeated uint64 packed_uint64 = 78 [packed = true]; + repeated sint32 packed_sint32 = 79 [packed = true]; + repeated sint64 packed_sint64 = 80 [packed = true]; + repeated fixed32 packed_fixed32 = 81 [packed = true]; + repeated fixed64 packed_fixed64 = 82 [packed = true]; + repeated sfixed32 packed_sfixed32 = 83 [packed = true]; + repeated sfixed64 packed_sfixed64 = 84 [packed = true]; + repeated float packed_float = 85 [packed = true]; + repeated double packed_double = 86 [packed = true]; + repeated bool packed_bool = 87 [packed = true]; + repeated NestedEnum packed_nested_enum = 88 [packed = true]; + + // Unpacked + repeated int32 unpacked_int32 = 89 [packed = false]; + repeated int64 unpacked_int64 = 90 [packed = false]; + repeated uint32 unpacked_uint32 = 91 [packed = false]; + repeated uint64 unpacked_uint64 = 92 [packed = false]; + repeated sint32 unpacked_sint32 = 93 [packed = false]; + repeated sint64 unpacked_sint64 = 94 [packed = false]; + repeated fixed32 unpacked_fixed32 = 95 [packed = false]; + repeated fixed64 unpacked_fixed64 = 96 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 97 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 98 [packed = false]; + repeated float unpacked_float = 99 [packed = false]; + repeated double unpacked_double = 100 [packed = false]; + repeated bool unpacked_bool = 101 [packed = false]; + repeated NestedEnum unpacked_nested_enum = 102 [packed = false]; + + // Map + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_bool = 104; + map map_int32_float = 66; + map map_int32_double = 67; + map map_int32_nested_message = 103; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + } + + // extensions + extensions 120 to 200; + + // groups + optional group Data = 201 { + optional int32 group_int32 = 202; + optional uint32 group_uint32 = 203; + } + + optional group MultiWordGroupField = 204 { + optional int32 group_int32 = 205; + optional uint32 group_uint32 = 206; + } + + // default values + optional int32 default_int32 = 241 [default = -123456789]; + optional int64 default_int64 = 242 [default = -9123456789123456789]; + optional uint32 default_uint32 = 243 [default = 2123456789]; + optional uint64 default_uint64 = 244 [default = 10123456789123456789]; + optional sint32 default_sint32 = 245 [default = -123456789]; + optional sint64 default_sint64 = 246 [default = -9123456789123456789]; + optional fixed32 default_fixed32 = 247 [default = 2123456789]; + optional fixed64 default_fixed64 = 248 [default = 10123456789123456789]; + optional sfixed32 default_sfixed32 = 249 [default = -123456789]; + optional sfixed64 default_sfixed64 = 250 [default = -9123456789123456789]; + optional float default_float = 251 [default = 9e9]; + optional double default_double = 252 [default = 7e22]; + optional bool default_bool = 253 [default = true]; + optional string default_string = 254 [default = "Rosebud"]; + optional bytes default_bytes = 255 [default = "joshua"]; + + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + optional int32 fieldname1 = 401; + optional int32 field_name2 = 402; + optional int32 _field_name3 = 403; + optional int32 field__name4_ = 404; + optional int32 field0name5 = 405; + optional int32 field_0_name6 = 406; + optional int32 fieldName7 = 407; + optional int32 FieldName8 = 408; + optional int32 field_Name9 = 409; + optional int32 Field_Name10 = 410; + optional int32 FIELD_NAME11 = 411; + optional int32 FIELD_name12 = 412; + optional int32 __field_name13 = 413; + optional int32 __Field_name14 = 414; + optional int32 field__name15 = 415; + optional int32 field__Name16 = 416; + optional int32 field_name17__ = 417; + optional int32 Field_name18__ = 418; + + // Reserved for unknown fields test. + reserved 1000 to 9999; + + optional MessageSetCorrect message_set_correct = 500; + + // message_set test case. + message MessageSetCorrect { + option message_set_wire_format = true; + + extensions 4 to max; + } + + message MessageSetCorrectExtension1 { + extend MessageSetCorrect { + optional MessageSetCorrectExtension1 message_set_extension = 1547769; + } + optional string str = 25; + } + + message MessageSetCorrectExtension2 { + extend MessageSetCorrect { + optional MessageSetCorrectExtension2 message_set_extension = 4135312; + } + optional int32 i = 9; + } + + message ExtensionWithOneof { + oneof oneof_field { + int32 a = 1; + int32 b = 2; + } + extend MessageSetCorrect { + optional ExtensionWithOneof extension_with_oneof = 123456789; + } + } +} + +message ForeignMessageProto2 { + optional int32 c = 1; +} + +enum ForeignEnumProto2 { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} + +extend TestAllTypesProto2 { + optional int32 extension_int32 = 120; +} + +extend TestAllTypesProto2 { + optional group GroupField = 121 { + optional int32 group_int32 = 122; + optional uint32 group_uint32 = 123; + } +} + +message UnknownToTestAllTypes { + optional int32 optional_int32 = 1001; + optional string optional_string = 1002; + optional ForeignMessageProto2 nested_message = 1003; + optional group OptionalGroup = 1004 { + optional int32 a = 1; + } + optional bool optional_bool = 1006; + repeated int32 repeated_int32 = 1011; +} + +message NullHypothesisProto2 {} + +message EnumOnlyProto2 { + enum Bool { + kFalse = 0; + kTrue = 1; + } +} + +message OneStringProto2 { + optional string data = 1; +} + +message ProtoWithKeywords { + optional int32 inline = 1; + optional string concept = 2; + repeated string requires = 3; +} + +message TestAllRequiredTypesProto2 { + message NestedMessage { + required int32 a = 1; + required TestAllRequiredTypesProto2 corecursive = 2; + optional TestAllRequiredTypesProto2 optional_corecursive = 3; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + required int32 required_int32 = 1; + required int64 required_int64 = 2; + required uint32 required_uint32 = 3; + required uint64 required_uint64 = 4; + required sint32 required_sint32 = 5; + required sint64 required_sint64 = 6; + required fixed32 required_fixed32 = 7; + required fixed64 required_fixed64 = 8; + required sfixed32 required_sfixed32 = 9; + required sfixed64 required_sfixed64 = 10; + required float required_float = 11; + required double required_double = 12; + required bool required_bool = 13; + required string required_string = 14; + required bytes required_bytes = 15; + + required NestedMessage required_nested_message = 18; + required ForeignMessageProto2 required_foreign_message = 19; + + required NestedEnum required_nested_enum = 21; + required ForeignEnumProto2 required_foreign_enum = 22; + + required string required_string_piece = 24 [ctype = STRING_PIECE]; + required string required_cord = 25 [ctype = CORD]; + + required TestAllRequiredTypesProto2 recursive_message = 27; + optional TestAllRequiredTypesProto2 optional_recursive_message = 28; + + // extensions + extensions 120 to 200; + + // groups + required group Data = 201 { + required int32 group_int32 = 202; + required uint32 group_uint32 = 203; + } + + // default values + required int32 default_int32 = 241 [default = -123456789]; + required int64 default_int64 = 242 [default = -9123456789123456789]; + required uint32 default_uint32 = 243 [default = 2123456789]; + required uint64 default_uint64 = 244 [default = 10123456789123456789]; + required sint32 default_sint32 = 245 [default = -123456789]; + required sint64 default_sint64 = 246 [default = -9123456789123456789]; + required fixed32 default_fixed32 = 247 [default = 2123456789]; + required fixed64 default_fixed64 = 248 [default = 10123456789123456789]; + required sfixed32 default_sfixed32 = 249 [default = -123456789]; + required sfixed64 default_sfixed64 = 250 [default = -9123456789123456789]; + required float default_float = 251 [default = 9e9]; + required double default_double = 252 [default = 7e22]; + required bool default_bool = 253 [default = true]; + required string default_string = 254 [default = "Rosebud"]; + required bytes default_bytes = 255 [default = "joshua"]; + + // Reserved for unknown fields test. + reserved 1000 to 9999; + + // message_set test case. + message MessageSetCorrect { + option message_set_wire_format = true; + + extensions 4 to max; + } + + message MessageSetCorrectExtension1 { + extend MessageSetCorrect { + optional MessageSetCorrectExtension1 message_set_extension = 1547769; + } + required string str = 25; + } + + message MessageSetCorrectExtension2 { + extend MessageSetCorrect { + optional MessageSetCorrectExtension2 message_set_extension = 4135312; + } + required int32 i = 9; + } +} + +message TestLargeOneof { + message A1 {} + message A2 {} + message A3 {} + message A4 {} + message A5 {} + oneof large_oneof { + A1 a1 = 1; + A2 a2 = 2; + A3 a3 = 3; + A4 a4 = 4; + A5 a5 = 5; + } +} diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto new file mode 100644 index 000000000..25de6c927 --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto @@ -0,0 +1,683 @@ +// clang-format off +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +// +// Test schema for proto2 messages. This test schema is used by: +// +// - conformance tests + +// LINT: ALLOW_GROUPS + +edition = "2023"; + +package protobuf_test_messages.editions.proto2; + +option features.enum_type = CLOSED; +option features.repeated_field_encoding = EXPANDED; +option features.utf8_validation = NONE; +option java_package = "com.google.protobuf_test_messages.editions.proto2"; +option objc_class_prefix = "EditionsProto2"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; +option cc_enable_arenas = true; + +// This proto includes every type of field in both singular and repeated +// forms. +// +// Also, crucially, all messages and enums in this file are eventually +// submessages of this message. So for example, a fuzz test of TestAllTypes +// could trigger bugs that occur in any message type in this file. We verify +// this stays true in a unit test. +message TestAllTypesProto2 { + message NestedMessage { + int32 a = 1; + TestAllTypesProto2 corecursive = 2; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + NestedMessage optional_nested_message = 18; + ForeignMessageProto2 optional_foreign_message = 19; + NestedEnum optional_nested_enum = 21; + ForeignEnumProto2 optional_foreign_enum = 22; + string optional_string_piece = 24 [ + ctype = STRING_PIECE + ]; + + string optional_cord = 25 [ + ctype = CORD + ]; + + TestAllTypesProto2 recursive_message = 27; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessageProto2 repeated_foreign_message = 49; + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnumProto2 repeated_foreign_enum = 52; + repeated string repeated_string_piece = 54 [ + ctype = STRING_PIECE + ]; + + repeated string repeated_cord = 55 [ + ctype = CORD + ]; + + // Packed + repeated int32 packed_int32 = 75 [ + features.repeated_field_encoding = PACKED + ]; + + repeated int64 packed_int64 = 76 [ + features.repeated_field_encoding = PACKED + ]; + + repeated uint32 packed_uint32 = 77 [ + features.repeated_field_encoding = PACKED + ]; + + repeated uint64 packed_uint64 = 78 [ + features.repeated_field_encoding = PACKED + ]; + + repeated sint32 packed_sint32 = 79 [ + features.repeated_field_encoding = PACKED + ]; + + repeated sint64 packed_sint64 = 80 [ + features.repeated_field_encoding = PACKED + ]; + + repeated fixed32 packed_fixed32 = 81 [ + features.repeated_field_encoding = PACKED + ]; + + repeated fixed64 packed_fixed64 = 82 [ + features.repeated_field_encoding = PACKED + ]; + + repeated sfixed32 packed_sfixed32 = 83 [ + features.repeated_field_encoding = PACKED + ]; + + repeated sfixed64 packed_sfixed64 = 84 [ + features.repeated_field_encoding = PACKED + ]; + + repeated float packed_float = 85 [ + features.repeated_field_encoding = PACKED + ]; + + repeated double packed_double = 86 [ + features.repeated_field_encoding = PACKED + ]; + + repeated bool packed_bool = 87 [ + features.repeated_field_encoding = PACKED + ]; + + repeated NestedEnum packed_nested_enum = 88 [ + features.repeated_field_encoding = PACKED + ]; + + // Unpacked + repeated int32 unpacked_int32 = 89; + repeated int64 unpacked_int64 = 90; + repeated uint32 unpacked_uint32 = 91; + repeated uint64 unpacked_uint64 = 92; + repeated sint32 unpacked_sint32 = 93; + repeated sint64 unpacked_sint64 = 94; + repeated fixed32 unpacked_fixed32 = 95; + repeated fixed64 unpacked_fixed64 = 96; + repeated sfixed32 unpacked_sfixed32 = 97; + repeated sfixed64 unpacked_sfixed64 = 98; + repeated float unpacked_float = 99; + repeated double unpacked_double = 100; + repeated bool unpacked_bool = 101; + repeated NestedEnum unpacked_nested_enum = 102; + + // Map + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_bool = 104; + map map_int32_float = 66; + map map_int32_double = 67; + map map_int32_nested_message = 103; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + } + + // extensions + extensions 120 to 200; + + // groups + message Data { + int32 group_int32 = 202; + uint32 group_uint32 = 203; + } + + Data data = 201 [ + features.message_encoding = DELIMITED + ]; + + message MultiWordGroupField { + int32 group_int32 = 205; + uint32 group_uint32 = 206; + } + + MultiWordGroupField multiwordgroupfield = 204 [ + features.message_encoding = DELIMITED + ]; + + // default values + int32 default_int32 = 241 [ + default = -123456789 + ]; + + int64 default_int64 = 242 [ + default = -9123456789123456789 + ]; + + uint32 default_uint32 = 243 [ + default = 2123456789 + ]; + + uint64 default_uint64 = 244 [ + default = 10123456789123456789 + ]; + + sint32 default_sint32 = 245 [ + default = -123456789 + ]; + + sint64 default_sint64 = 246 [ + default = -9123456789123456789 + ]; + + fixed32 default_fixed32 = 247 [ + default = 2123456789 + ]; + + fixed64 default_fixed64 = 248 [ + default = 10123456789123456789 + ]; + + sfixed32 default_sfixed32 = 249 [ + default = -123456789 + ]; + + sfixed64 default_sfixed64 = 250 [ + default = -9123456789123456789 + ]; + + float default_float = 251 [ + default = 9e9 + ]; + + double default_double = 252 [ + default = 7e22 + ]; + + bool default_bool = 253 [ + default = true + ]; + + string default_string = 254 [ + default = "Rosebud" + ]; + + bytes default_bytes = 255 [ + default = "joshua" + ]; + + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + int32 fieldname1 = 401; + int32 field_name2 = 402; + int32 _field_name3 = 403; + int32 field__name4_ = 404; + int32 field0name5 = 405; + int32 field_0_name6 = 406; + int32 fieldName7 = 407; + int32 FieldName8 = 408; + int32 field_Name9 = 409; + int32 Field_Name10 = 410; + int32 FIELD_NAME11 = 411; + int32 FIELD_name12 = 412; + int32 __field_name13 = 413; + int32 __Field_name14 = 414; + int32 field__name15 = 415; + int32 field__Name16 = 416; + int32 field_name17__ = 417; + int32 Field_name18__ = 418; + + // Reserved for unknown fields test. + reserved 1000 to 9999; + + MessageSetCorrect message_set_correct = 500; + + // message_set test case. + message MessageSetCorrect { + option message_set_wire_format = true; + + extensions 4 to max; + } + + message MessageSetCorrectExtension1 { + extend MessageSetCorrect { + MessageSetCorrectExtension1 message_set_extension = 1547769; + } + + string str = 25; + } + + message MessageSetCorrectExtension2 { + extend MessageSetCorrect { + MessageSetCorrectExtension2 message_set_extension = 4135312; + } + + int32 i = 9; + } + + message ExtensionWithOneof { + oneof oneof_field { + int32 a = 1; + int32 b = 2; + } + + extend MessageSetCorrect { + ExtensionWithOneof extension_with_oneof = 123456789; + } + } +} + +message ForeignMessageProto2 { + int32 c = 1; +} + +enum ForeignEnumProto2 { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} + +extend TestAllTypesProto2 { + int32 extension_int32 = 120; +} + +extend TestAllTypesProto2 { + GroupField groupfield = 121 [ + features.message_encoding = DELIMITED + ]; +} + +message GroupField { + int32 group_int32 = 122; + uint32 group_uint32 = 123; +} + +message UnknownToTestAllTypes { + int32 optional_int32 = 1001; + string optional_string = 1002; + ForeignMessageProto2 nested_message = 1003; + + message OptionalGroup { + int32 a = 1; + } + + OptionalGroup optionalgroup = 1004 [ + features.message_encoding = DELIMITED + ]; + + bool optional_bool = 1006; + repeated int32 repeated_int32 = 1011; +} + +message NullHypothesisProto2 { +} + +message EnumOnlyProto2 { + enum Bool { + kFalse = 0; + kTrue = 1; + } +} + +message OneStringProto2 { + string data = 1; +} + +message ProtoWithKeywords { + int32 inline = 1; + string concept = 2; + repeated string requires = 3; +} + +message TestAllRequiredTypesProto2 { + message NestedMessage { + int32 a = 1 [ + features.field_presence = LEGACY_REQUIRED + ]; + + TestAllRequiredTypesProto2 corecursive = 2 [ + features.field_presence = LEGACY_REQUIRED + ]; + + TestAllRequiredTypesProto2 optional_corecursive = 3; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + // Singular + int32 required_int32 = 1 [ + features.field_presence = LEGACY_REQUIRED + ]; + + int64 required_int64 = 2 [ + features.field_presence = LEGACY_REQUIRED + ]; + + uint32 required_uint32 = 3 [ + features.field_presence = LEGACY_REQUIRED + ]; + + uint64 required_uint64 = 4 [ + features.field_presence = LEGACY_REQUIRED + ]; + + sint32 required_sint32 = 5 [ + features.field_presence = LEGACY_REQUIRED + ]; + + sint64 required_sint64 = 6 [ + features.field_presence = LEGACY_REQUIRED + ]; + + fixed32 required_fixed32 = 7 [ + features.field_presence = LEGACY_REQUIRED + ]; + + fixed64 required_fixed64 = 8 [ + features.field_presence = LEGACY_REQUIRED + ]; + + sfixed32 required_sfixed32 = 9 [ + features.field_presence = LEGACY_REQUIRED + ]; + + sfixed64 required_sfixed64 = 10 [ + features.field_presence = LEGACY_REQUIRED + ]; + + float required_float = 11 [ + features.field_presence = LEGACY_REQUIRED + ]; + + double required_double = 12 [ + features.field_presence = LEGACY_REQUIRED + ]; + + bool required_bool = 13 [ + features.field_presence = LEGACY_REQUIRED + ]; + + string required_string = 14 [ + features.field_presence = LEGACY_REQUIRED + ]; + + bytes required_bytes = 15 [ + features.field_presence = LEGACY_REQUIRED + ]; + + NestedMessage required_nested_message = 18 [ + features.field_presence = LEGACY_REQUIRED + ]; + + ForeignMessageProto2 required_foreign_message = 19 [ + features.field_presence = LEGACY_REQUIRED + ]; + + NestedEnum required_nested_enum = 21 [ + features.field_presence = LEGACY_REQUIRED + ]; + + ForeignEnumProto2 required_foreign_enum = 22 [ + features.field_presence = LEGACY_REQUIRED + ]; + + string required_string_piece = 24 [ + features.field_presence = LEGACY_REQUIRED, + ctype = STRING_PIECE + ]; + + string required_cord = 25 [ + features.field_presence = LEGACY_REQUIRED, + ctype = CORD + ]; + + TestAllRequiredTypesProto2 recursive_message = 27 [ + features.field_presence = LEGACY_REQUIRED + ]; + + TestAllRequiredTypesProto2 optional_recursive_message = 28; + + // extensions + extensions 120 to 200; + + // groups + message Data { + int32 group_int32 = 202 [ + features.field_presence = LEGACY_REQUIRED + ]; + + uint32 group_uint32 = 203 [ + features.field_presence = LEGACY_REQUIRED + ]; + } + + Data data = 201 [ + features.field_presence = LEGACY_REQUIRED, + features.message_encoding = DELIMITED + ]; + + // default values + int32 default_int32 = 241 [ + features.field_presence = LEGACY_REQUIRED, + default = -123456789 + ]; + + int64 default_int64 = 242 [ + features.field_presence = LEGACY_REQUIRED, + default = -9123456789123456789 + ]; + + uint32 default_uint32 = 243 [ + features.field_presence = LEGACY_REQUIRED, + default = 2123456789 + ]; + + uint64 default_uint64 = 244 [ + features.field_presence = LEGACY_REQUIRED, + default = 10123456789123456789 + ]; + + sint32 default_sint32 = 245 [ + features.field_presence = LEGACY_REQUIRED, + default = -123456789 + ]; + + sint64 default_sint64 = 246 [ + features.field_presence = LEGACY_REQUIRED, + default = -9123456789123456789 + ]; + + fixed32 default_fixed32 = 247 [ + features.field_presence = LEGACY_REQUIRED, + default = 2123456789 + ]; + + fixed64 default_fixed64 = 248 [ + features.field_presence = LEGACY_REQUIRED, + default = 10123456789123456789 + ]; + + sfixed32 default_sfixed32 = 249 [ + features.field_presence = LEGACY_REQUIRED, + default = -123456789 + ]; + + sfixed64 default_sfixed64 = 250 [ + features.field_presence = LEGACY_REQUIRED, + default = -9123456789123456789 + ]; + + float default_float = 251 [ + features.field_presence = LEGACY_REQUIRED, + default = 9e9 + ]; + + double default_double = 252 [ + features.field_presence = LEGACY_REQUIRED, + default = 7e22 + ]; + + bool default_bool = 253 [ + features.field_presence = LEGACY_REQUIRED, + default = true + ]; + + string default_string = 254 [ + features.field_presence = LEGACY_REQUIRED, + default = "Rosebud" + ]; + + bytes default_bytes = 255 [ + features.field_presence = LEGACY_REQUIRED, + default = "joshua" + ]; + + // Reserved for unknown fields test. + reserved 1000 to 9999; + + // message_set test case. + message MessageSetCorrect { + option message_set_wire_format = true; + + extensions 4 to max; + } + + message MessageSetCorrectExtension1 { + extend MessageSetCorrect { + MessageSetCorrectExtension1 message_set_extension = 1547769; + } + + string str = 25 [ + features.field_presence = LEGACY_REQUIRED + ]; + } + + message MessageSetCorrectExtension2 { + extend MessageSetCorrect { + MessageSetCorrectExtension2 message_set_extension = 4135312; + } + + int32 i = 9 [ + features.field_presence = LEGACY_REQUIRED + ]; + } +} + +message TestLargeOneof { + message A1 { + } + + message A2 { + } + + message A3 { + } + + message A4 { + } + + message A5 { + } + + oneof large_oneof { + A1 a1 = 1; + A2 a2 = 2; + A3 a3 = 3; + A4 a4 = 4; + A5 a5 = 5; + } +} diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto new file mode 100644 index 000000000..b78e63178 --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto @@ -0,0 +1,266 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +// +// Test schema for proto3 messages. This test schema is used by: +// +// - benchmarks +// - fuzz tests +// - conformance tests +// + +syntax = "proto3"; + +package protobuf_test_messages.proto3; + +option java_package = "com.google.protobuf_test_messages.proto3"; +option objc_class_prefix = "Proto3"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; + +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option cc_enable_arenas = true; + +// This proto includes every type of field in both singular and repeated +// forms. +// +// Also, crucially, all messages and enums in this file are eventually +// submessages of this message. So for example, a fuzz test of TestAllTypes +// could trigger bugs that occur in any message type in this file. We verify +// this stays true in a unit test. +message TestAllTypesProto3 { + message NestedMessage { + int32 a = 1; + TestAllTypesProto3 corecursive = 2; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + enum AliasedEnum { + option allow_alias = true; + + ALIAS_FOO = 0; + ALIAS_BAR = 1; + ALIAS_BAZ = 2; + MOO = 2; + moo = 2; + bAz = 2; + } + + // Singular + // test [kotlin] comment + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + + NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; + + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + AliasedEnum optional_aliased_enum = 23; + + string optional_string_piece = 24 [ctype = STRING_PIECE]; + string optional_cord = 25 [ctype = CORD]; + + TestAllTypesProto3 recursive_message = 27; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + + repeated string repeated_string_piece = 54 [ctype = STRING_PIECE]; + repeated string repeated_cord = 55 [ctype = CORD]; + + // Packed + repeated int32 packed_int32 = 75 [packed = true]; + repeated int64 packed_int64 = 76 [packed = true]; + repeated uint32 packed_uint32 = 77 [packed = true]; + repeated uint64 packed_uint64 = 78 [packed = true]; + repeated sint32 packed_sint32 = 79 [packed = true]; + repeated sint64 packed_sint64 = 80 [packed = true]; + repeated fixed32 packed_fixed32 = 81 [packed = true]; + repeated fixed64 packed_fixed64 = 82 [packed = true]; + repeated sfixed32 packed_sfixed32 = 83 [packed = true]; + repeated sfixed64 packed_sfixed64 = 84 [packed = true]; + repeated float packed_float = 85 [packed = true]; + repeated double packed_double = 86 [packed = true]; + repeated bool packed_bool = 87 [packed = true]; + repeated NestedEnum packed_nested_enum = 88 [packed = true]; + + // Unpacked + repeated int32 unpacked_int32 = 89 [packed = false]; + repeated int64 unpacked_int64 = 90 [packed = false]; + repeated uint32 unpacked_uint32 = 91 [packed = false]; + repeated uint64 unpacked_uint64 = 92 [packed = false]; + repeated sint32 unpacked_sint32 = 93 [packed = false]; + repeated sint64 unpacked_sint64 = 94 [packed = false]; + repeated fixed32 unpacked_fixed32 = 95 [packed = false]; + repeated fixed64 unpacked_fixed64 = 96 [packed = false]; + repeated sfixed32 unpacked_sfixed32 = 97 [packed = false]; + repeated sfixed64 unpacked_sfixed64 = 98 [packed = false]; + repeated float unpacked_float = 99 [packed = false]; + repeated double unpacked_double = 100 [packed = false]; + repeated bool unpacked_bool = 101 [packed = false]; + repeated NestedEnum unpacked_nested_enum = 102 [packed = false]; + + // Map + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_float = 66; + map map_int32_double = 67; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + google.protobuf.NullValue oneof_null_value = 120; + } + + // Well-known types + google.protobuf.BoolValue optional_bool_wrapper = 201; + google.protobuf.Int32Value optional_int32_wrapper = 202; + google.protobuf.Int64Value optional_int64_wrapper = 203; + google.protobuf.UInt32Value optional_uint32_wrapper = 204; + google.protobuf.UInt64Value optional_uint64_wrapper = 205; + google.protobuf.FloatValue optional_float_wrapper = 206; + google.protobuf.DoubleValue optional_double_wrapper = 207; + google.protobuf.StringValue optional_string_wrapper = 208; + google.protobuf.BytesValue optional_bytes_wrapper = 209; + + repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; + repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; + repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; + repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; + repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; + repeated google.protobuf.FloatValue repeated_float_wrapper = 216; + repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; + repeated google.protobuf.StringValue repeated_string_wrapper = 218; + repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; + + google.protobuf.Duration optional_duration = 301; + google.protobuf.Timestamp optional_timestamp = 302; + google.protobuf.FieldMask optional_field_mask = 303; + google.protobuf.Struct optional_struct = 304; + google.protobuf.Any optional_any = 305; + google.protobuf.Value optional_value = 306; + google.protobuf.NullValue optional_null_value = 307; + + repeated google.protobuf.Duration repeated_duration = 311; + repeated google.protobuf.Timestamp repeated_timestamp = 312; + repeated google.protobuf.FieldMask repeated_fieldmask = 313; + repeated google.protobuf.Struct repeated_struct = 324; + repeated google.protobuf.Any repeated_any = 315; + repeated google.protobuf.Value repeated_value = 316; + repeated google.protobuf.ListValue repeated_list_value = 317; + + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + int32 fieldname1 = 401; + int32 field_name2 = 402; + int32 _field_name3 = 403; + int32 field__name4_ = 404; + int32 field0name5 = 405; + int32 field_0_name6 = 406; + int32 fieldName7 = 407; + int32 FieldName8 = 408; + int32 field_Name9 = 409; + int32 Field_Name10 = 410; + int32 FIELD_NAME11 = 411; + int32 FIELD_name12 = 412; + int32 __field_name13 = 413; + int32 __Field_name14 = 414; + int32 field__name15 = 415; + int32 field__Name16 = 416; + int32 field_name17__ = 417; + int32 Field_name18__ = 418; + + // Reserved for testing unknown fields + reserved 501 to 510; +} + +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} + +message NullHypothesisProto3 {} + +message EnumOnlyProto3 { + enum Bool { + kFalse = 0; + kTrue = 1; + } +} diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto new file mode 100644 index 000000000..dc2cd2160 --- /dev/null +++ b/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto @@ -0,0 +1,309 @@ +// clang-format off +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file or at +// https://developers.google.com/open-source/licenses/bsd +// +// Test schema for proto3 messages. This test schema is used by: +// +// - benchmarks +// - fuzz tests +// - conformance tests + +edition = "2023"; + +package protobuf_test_messages.editions.proto3; + +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option features.field_presence = IMPLICIT; +option java_package = "com.google.protobuf_test_messages.editions.proto3"; +option objc_class_prefix = "EditionsProto3"; + +// This is the default, but we specify it here explicitly. +option optimize_for = SPEED; +option cc_enable_arenas = true; + +// This proto includes every type of field in both singular and repeated +// forms. +// +// Also, crucially, all messages and enums in this file are eventually +// submessages of this message. So for example, a fuzz test of TestAllTypes +// could trigger bugs that occur in any message type in this file. We verify +// this stays true in a unit test. +message TestAllTypesProto3 { + message NestedMessage { + int32 a = 1; + TestAllTypesProto3 corecursive = 2; + } + + enum NestedEnum { + FOO = 0; + BAR = 1; + BAZ = 2; + NEG = -1; // Intentionally negative. + } + + enum AliasedEnum { + option allow_alias = true; + + ALIAS_FOO = 0; + ALIAS_BAR = 1; + ALIAS_BAZ = 2; + MOO = 2; + moo = 2; + bAz = 2; + } + + // Singular + // test [kotlin] comment + int32 optional_int32 = 1; + int64 optional_int64 = 2; + uint32 optional_uint32 = 3; + uint64 optional_uint64 = 4; + sint32 optional_sint32 = 5; + sint64 optional_sint64 = 6; + fixed32 optional_fixed32 = 7; + fixed64 optional_fixed64 = 8; + sfixed32 optional_sfixed32 = 9; + sfixed64 optional_sfixed64 = 10; + float optional_float = 11; + double optional_double = 12; + bool optional_bool = 13; + string optional_string = 14; + bytes optional_bytes = 15; + NestedMessage optional_nested_message = 18; + ForeignMessage optional_foreign_message = 19; + NestedEnum optional_nested_enum = 21; + ForeignEnum optional_foreign_enum = 22; + AliasedEnum optional_aliased_enum = 23; + string optional_string_piece = 24 [ + ctype = STRING_PIECE + ]; + + string optional_cord = 25 [ + ctype = CORD + ]; + + TestAllTypesProto3 recursive_message = 27; + + // Repeated + repeated int32 repeated_int32 = 31; + repeated int64 repeated_int64 = 32; + repeated uint32 repeated_uint32 = 33; + repeated uint64 repeated_uint64 = 34; + repeated sint32 repeated_sint32 = 35; + repeated sint64 repeated_sint64 = 36; + repeated fixed32 repeated_fixed32 = 37; + repeated fixed64 repeated_fixed64 = 38; + repeated sfixed32 repeated_sfixed32 = 39; + repeated sfixed64 repeated_sfixed64 = 40; + repeated float repeated_float = 41; + repeated double repeated_double = 42; + repeated bool repeated_bool = 43; + repeated string repeated_string = 44; + repeated bytes repeated_bytes = 45; + repeated NestedMessage repeated_nested_message = 48; + repeated ForeignMessage repeated_foreign_message = 49; + repeated NestedEnum repeated_nested_enum = 51; + repeated ForeignEnum repeated_foreign_enum = 52; + repeated string repeated_string_piece = 54 [ + ctype = STRING_PIECE + ]; + + repeated string repeated_cord = 55 [ + ctype = CORD + ]; + + // Packed + repeated int32 packed_int32 = 75; + repeated int64 packed_int64 = 76; + repeated uint32 packed_uint32 = 77; + repeated uint64 packed_uint64 = 78; + repeated sint32 packed_sint32 = 79; + repeated sint64 packed_sint64 = 80; + repeated fixed32 packed_fixed32 = 81; + repeated fixed64 packed_fixed64 = 82; + repeated sfixed32 packed_sfixed32 = 83; + repeated sfixed64 packed_sfixed64 = 84; + repeated float packed_float = 85; + repeated double packed_double = 86; + repeated bool packed_bool = 87; + repeated NestedEnum packed_nested_enum = 88; + + // Unpacked + repeated int32 unpacked_int32 = 89 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated int64 unpacked_int64 = 90 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated uint32 unpacked_uint32 = 91 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated uint64 unpacked_uint64 = 92 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated sint32 unpacked_sint32 = 93 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated sint64 unpacked_sint64 = 94 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated fixed32 unpacked_fixed32 = 95 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated fixed64 unpacked_fixed64 = 96 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated sfixed32 unpacked_sfixed32 = 97 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated sfixed64 unpacked_sfixed64 = 98 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated float unpacked_float = 99 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated double unpacked_double = 100 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated bool unpacked_bool = 101 [ + features.repeated_field_encoding = EXPANDED + ]; + + repeated NestedEnum unpacked_nested_enum = 102 [ + features.repeated_field_encoding = EXPANDED + ]; + + // Map + map map_int32_int32 = 56; + map map_int64_int64 = 57; + map map_uint32_uint32 = 58; + map map_uint64_uint64 = 59; + map map_sint32_sint32 = 60; + map map_sint64_sint64 = 61; + map map_fixed32_fixed32 = 62; + map map_fixed64_fixed64 = 63; + map map_sfixed32_sfixed32 = 64; + map map_sfixed64_sfixed64 = 65; + map map_int32_float = 66; + map map_int32_double = 67; + map map_bool_bool = 68; + map map_string_string = 69; + map map_string_bytes = 70; + map map_string_nested_message = 71; + map map_string_foreign_message = 72; + map map_string_nested_enum = 73; + map map_string_foreign_enum = 74; + + oneof oneof_field { + uint32 oneof_uint32 = 111; + NestedMessage oneof_nested_message = 112; + string oneof_string = 113; + bytes oneof_bytes = 114; + bool oneof_bool = 115; + uint64 oneof_uint64 = 116; + float oneof_float = 117; + double oneof_double = 118; + NestedEnum oneof_enum = 119; + google.protobuf.NullValue oneof_null_value = 120; + } + + // Well-known types + google.protobuf.BoolValue optional_bool_wrapper = 201; + google.protobuf.Int32Value optional_int32_wrapper = 202; + google.protobuf.Int64Value optional_int64_wrapper = 203; + google.protobuf.UInt32Value optional_uint32_wrapper = 204; + google.protobuf.UInt64Value optional_uint64_wrapper = 205; + google.protobuf.FloatValue optional_float_wrapper = 206; + google.protobuf.DoubleValue optional_double_wrapper = 207; + google.protobuf.StringValue optional_string_wrapper = 208; + google.protobuf.BytesValue optional_bytes_wrapper = 209; + repeated google.protobuf.BoolValue repeated_bool_wrapper = 211; + repeated google.protobuf.Int32Value repeated_int32_wrapper = 212; + repeated google.protobuf.Int64Value repeated_int64_wrapper = 213; + repeated google.protobuf.UInt32Value repeated_uint32_wrapper = 214; + repeated google.protobuf.UInt64Value repeated_uint64_wrapper = 215; + repeated google.protobuf.FloatValue repeated_float_wrapper = 216; + repeated google.protobuf.DoubleValue repeated_double_wrapper = 217; + repeated google.protobuf.StringValue repeated_string_wrapper = 218; + repeated google.protobuf.BytesValue repeated_bytes_wrapper = 219; + google.protobuf.Duration optional_duration = 301; + google.protobuf.Timestamp optional_timestamp = 302; + google.protobuf.FieldMask optional_field_mask = 303; + google.protobuf.Struct optional_struct = 304; + google.protobuf.Any optional_any = 305; + google.protobuf.Value optional_value = 306; + google.protobuf.NullValue optional_null_value = 307; + repeated google.protobuf.Duration repeated_duration = 311; + repeated google.protobuf.Timestamp repeated_timestamp = 312; + repeated google.protobuf.FieldMask repeated_fieldmask = 313; + repeated google.protobuf.Struct repeated_struct = 324; + repeated google.protobuf.Any repeated_any = 315; + repeated google.protobuf.Value repeated_value = 316; + repeated google.protobuf.ListValue repeated_list_value = 317; + + // Test field-name-to-JSON-name convention. + // (protobuf says names can be any valid C/C++ identifier.) + int32 fieldname1 = 401; + int32 field_name2 = 402; + int32 _field_name3 = 403; + int32 field__name4_ = 404; + int32 field0name5 = 405; + int32 field_0_name6 = 406; + int32 fieldName7 = 407; + int32 FieldName8 = 408; + int32 field_Name9 = 409; + int32 Field_Name10 = 410; + int32 FIELD_NAME11 = 411; + int32 FIELD_name12 = 412; + int32 __field_name13 = 413; + int32 __Field_name14 = 414; + int32 field__name15 = 415; + int32 field__Name16 = 416; + int32 field_name17__ = 417; + int32 Field_name18__ = 418; + + // Reserved for testing unknown fields + reserved 501 to 510; +} + +message ForeignMessage { + int32 c = 1; +} + +enum ForeignEnum { + FOREIGN_FOO = 0; + FOREIGN_BAR = 1; + FOREIGN_BAZ = 2; +} + +message NullHypothesisProto3 { +} + +message EnumOnlyProto3 { + enum Bool { + kFalse = 0; + kTrue = 1; + } +} From 801fab2a8693ec9b638180a2a00619f050740705 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Fri, 15 Aug 2025 11:04:53 +0200 Subject: [PATCH 2/5] Added support for Well-Known Types (#449) --- .../workflows/protobuf-well-known-types.yml | 27 + gradle-plugin/api/gradle-plugin.api | 10 +- .../kotlinx/rpc/buf/tasks/BufGenerateTask.kt | 4 +- ...gureLocalProtocGenDevelopmentDependency.kt | 28 +- .../rpc/protoc/DefaultProtoSourceSet.kt | 49 +- .../rpc/protoc/DefaultProtocExtension.kt | 64 +- .../kotlinx/rpc/protoc/ProtoSourceSet.kt | 18 +- .../kotlinx/rpc/protoc/ProtocExtension.kt | 15 +- .../kotlin/kotlinx/rpc/protoc/pluginJars.kt | 6 +- .../kotlin/kotlinx/rpc/GrpcJvmProjectTest.kt | 10 +- .../build.gradle.kts | 13 +- .../build.gradle.kts | 10 +- protobuf/protobuf-core/build.gradle.kts | 25 +- .../com/google/protobuf/kotlin/Any.kt | 13 + .../com/google/protobuf/kotlin/Api.kt | 39 + .../com/google/protobuf/kotlin/Duration.kt | 13 + .../com/google/protobuf/kotlin/Empty.kt | 10 + .../com/google/protobuf/kotlin/FieldMask.kt | 12 + .../google/protobuf/kotlin/SourceContext.kt | 12 + .../com/google/protobuf/kotlin/Struct.kt | 63 ++ .../com/google/protobuf/kotlin/Timestamp.kt | 13 + .../com/google/protobuf/kotlin/Type.kt | 139 +++ .../com/google/protobuf/kotlin/Wrappers.kt | 68 ++ .../protobuf/kotlin/_rpc_internal/Any.kt | 103 ++ .../protobuf/kotlin/_rpc_internal/Api.kt | 467 +++++++++ .../protobuf/kotlin/_rpc_internal/Duration.kt | 103 ++ .../protobuf/kotlin/_rpc_internal/Empty.kt | 78 ++ .../kotlin/_rpc_internal/FieldMask.kt | 93 ++ .../kotlin/_rpc_internal/SourceContext.kt | 90 ++ .../protobuf/kotlin/_rpc_internal/Struct.kt | 460 +++++++++ .../kotlin/_rpc_internal/Timestamp.kt | 103 ++ .../protobuf/kotlin/_rpc_internal/Type.kt | 934 ++++++++++++++++++ .../protobuf/kotlin/_rpc_internal/Wrappers.kt | 754 ++++++++++++++ .../com/google/protobuf/kotlin/duration.kt | 15 + .../com/google/protobuf/kotlin/timestamp.kt | 17 + .../commonMain/proto/well-known-types.proto | 34 + .../gen/core/AModelToKotlinCommonGenerator.kt | 5 +- .../rpc/protoc/gen/core/CodeGenerator.kt | 111 ++- .../rpc/protoc/gen/core/ProtocGenPlugin.kt | 15 +- .../rpc/protoc/gen/core/codeRequestToModel.kt | 8 +- .../protoc/gen/grpc/GrpcProtocGenPlugin.kt | 3 +- .../grpc/ModelToGrpcKotlinCommonGenerator.kt | 10 +- .../ModelToProtobufKotlinCommonGenerator.kt | 114 ++- .../rpc/protoc/gen/ProtobufProtocGenPlugin.kt | 3 +- tests/protobuf-conformance/build.gradle.kts | 2 +- 45 files changed, 3975 insertions(+), 208 deletions(-) create mode 100644 .github/workflows/protobuf-well-known-types.yml create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Any.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Api.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Duration.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Empty.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/FieldMask.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/SourceContext.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Struct.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Timestamp.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Type.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Wrappers.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt create mode 100644 protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt create mode 100644 protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt create mode 100644 protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt create mode 100644 protobuf/protobuf-core/src/commonMain/proto/well-known-types.proto diff --git a/.github/workflows/protobuf-well-known-types.yml b/.github/workflows/protobuf-well-known-types.yml new file mode 100644 index 000000000..286e2494b --- /dev/null +++ b/.github/workflows/protobuf-well-known-types.yml @@ -0,0 +1,27 @@ +name: Verify Protobuf Well-Known Types are Up-to-Date + +on: + pull_request: + +permissions: + contents: read + +jobs: + verify-platforms-table: + name: Run Verification + runs-on: ubuntu-latest + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Run Protobuf Conformance Test Generation + run: ./gradlew :protobuf:protobuf-core:bufGenerateCommonMain --info --stacktrace + - name: Check if Well-Known Types are up-to-date + run: | + if [[ -n "$(git status --porcelain | grep protobuf/protobuf-core/)" ]]; then + echo "Well-Known Types are not up-to-date. Please run './gradlew :protobuf:protobuf-core:bufGenerateCommonMain' and commit changes" + exit 1 + fi diff --git a/gradle-plugin/api/gradle-plugin.api b/gradle-plugin/api/gradle-plugin.api index 87a07f8f1..a53d83edc 100644 --- a/gradle-plugin/api/gradle-plugin.api +++ b/gradle-plugin/api/gradle-plugin.api @@ -39,11 +39,7 @@ public class kotlinx/rpc/RpcStrictModeExtension { public final class kotlinx/rpc/VersionsKt { public static final field BUF_TOOL_VERSION Ljava/lang/String; - public static final field GRPC_KOTLIN_VERSION Ljava/lang/String; - public static final field GRPC_VERSION Ljava/lang/String; public static final field LIBRARY_VERSION Ljava/lang/String; - public static final field PLUGIN_VERSION Ljava/lang/String; - public static final field PROTOBUF_VERSION Ljava/lang/String; } public class kotlinx/rpc/buf/BufExtension { @@ -179,17 +175,15 @@ public final class kotlinx/rpc/protoc/ProcessProtoFilesKt$inlined$sam$i$org_grad public abstract interface class kotlinx/rpc/protoc/ProtoSourceSet { public abstract fun getName ()Ljava/lang/String; + public abstract fun getPlugins ()Lorg/gradle/api/NamedDomainObjectContainer; public abstract fun getProto ()Lorg/gradle/api/file/SourceDirectorySet; + public abstract fun plugins (Lorg/gradle/api/Action;)V public fun proto (Lorg/gradle/api/Action;)V - public abstract fun protocPlugin (Lkotlinx/rpc/protoc/ProtocPlugin;)V - public abstract fun protocPlugin (Lorg/gradle/api/NamedDomainObjectProvider;)V } public abstract interface class kotlinx/rpc/protoc/ProtocExtension { public abstract fun buf (Lorg/gradle/api/Action;)V public abstract fun getBuf ()Lkotlinx/rpc/buf/BufExtension; - public abstract fun getPlugins ()Lorg/gradle/api/NamedDomainObjectContainer; - public abstract fun plugins (Lorg/gradle/api/Action;)V } public class kotlinx/rpc/protoc/ProtocPlugin { diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt index 84a101474..dc6d62077 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/buf/tasks/BufGenerateTask.kt @@ -56,6 +56,8 @@ public abstract class BufGenerateTask : BufExecTask() { /** * Whether to include Well-Known Types. * + * Automatically sets [includeImports] to `true`. + * * @see buf generate --include-wkt * @see [BufGenerateExtension.includeWkt] */ @@ -91,7 +93,7 @@ public abstract class BufGenerateTask : BufExecTask() { buildList { add("--output"); add(outputDirectory.get().absolutePath) - if (includeImports.get()) { + if (includeImports.get() || includeWkt.get()) { add("--include-imports") } diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt index d13d82237..c742ec391 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/internal/configureLocalProtocGenDevelopmentDependency.kt @@ -7,6 +7,7 @@ package kotlinx.rpc.internal import kotlinx.rpc.buf.tasks.BufGenerateTask import kotlinx.rpc.protoc.grpcKotlinMultiplatform import kotlinx.rpc.protoc.kotlinMultiplatform +import kotlinx.rpc.protoc.protoSourceSets import kotlinx.rpc.rpcExtension import org.gradle.api.Project import org.gradle.internal.extensions.core.extra @@ -14,25 +15,32 @@ import org.gradle.kotlin.dsl.provideDelegate import org.gradle.kotlin.dsl.withType @InternalRpcApi -public fun Project.configureLocalProtocGenDevelopmentDependency() { +public fun Project.configureLocalProtocGenDevelopmentDependency( + vararg sourceSetSuffix: String = arrayOf("Test"), +) { val globalRootDir: String by extra - rpcExtension().protoc.plugins { - kotlinMultiplatform { - local { - javaJar("$globalRootDir/protoc-gen/protobuf/build/libs/protobuf-$version-all.jar") + // init + rpcExtension().protoc() + + protoSourceSets.all { + plugins { + kotlinMultiplatform { + local { + javaJar("$globalRootDir/protoc-gen/protobuf/build/libs/protobuf-$version-all.jar") + } } - } - grpcKotlinMultiplatform { - local { - javaJar("$globalRootDir/protoc-gen/grpc/build/libs/grpc-$version-all.jar") + grpcKotlinMultiplatform { + local { + javaJar("$globalRootDir/protoc-gen/grpc/build/libs/grpc-$version-all.jar") + } } } } tasks.withType().configureEach { - if (name.endsWith("Test")) { + if (sourceSetSuffix.any { name.endsWith(it) }) { val includedBuild = gradle.includedBuild("protoc-gen") dependsOn(includedBuild.task(":grpc:jar")) dependsOn(includedBuild.task(":protobuf:jar")) diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtoSourceSet.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtoSourceSet.kt index 35107ec4b..5c4d07697 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtoSourceSet.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtoSourceSet.kt @@ -5,6 +5,8 @@ package kotlinx.rpc.protoc import kotlinx.rpc.buf.tasks.BufGenerateTask +import kotlinx.rpc.protoc.ProtocPlugin.Companion.GRPC_KOTLIN_MULTIPLATFORM +import kotlinx.rpc.protoc.ProtocPlugin.Companion.KOTLIN_MULTIPLATFORM import kotlinx.rpc.util.findOrCreate import kotlinx.rpc.util.withKotlinJvmExtension import kotlinx.rpc.util.withKotlinKmpExtension @@ -17,6 +19,9 @@ import org.gradle.api.tasks.SourceSetContainer import org.gradle.kotlin.dsl.add import org.gradle.kotlin.dsl.listProperty import org.gradle.kotlin.dsl.property +import org.gradle.kotlin.dsl.the +import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode +import org.jetbrains.kotlin.gradle.dsl.KotlinBaseExtension import javax.inject.Inject @Suppress("UNCHECKED_CAST") @@ -34,18 +39,48 @@ internal open class DefaultProtoSourceSet @Inject constructor( internal val project: Project, override val name: String, ) : ProtoSourceSet { - val languageSourceSets: ListProperty = project.objects.listProperty() - val protocPlugins: ListProperty = project.objects.listProperty().convention(emptyList()) - val generateTask: Property = project.objects.property() + override val plugins: NamedDomainObjectContainer = + project.objects.domainObjectContainer(ProtocPlugin::class.java) { name -> + ProtocPlugin(name, project) + } - override fun protocPlugin(plugin: NamedDomainObjectProvider) { - protocPlugins.add(plugin.name) + override fun plugins(action: Action>) { + action.execute(plugins) } - override fun protocPlugin(plugin: ProtocPlugin) { - protocPlugins.add(plugin.name) + init { + val explicitApiModeEnabled = project.provider { + project.the().explicitApi != ExplicitApiMode.Disabled + } + + plugins.create(KOTLIN_MULTIPLATFORM) { + local { + javaJar(project.kotlinMultiplatformProtocPluginJarPath) + } + + options.put("debugOutput", "protoc-gen-kotlin-multiplatform.log") + + if (this@DefaultProtoSourceSet.name.lowercase().endsWith("main")) { + options.put("explicitApiModeEnabled", explicitApiModeEnabled) + } + } + + plugins.create(GRPC_KOTLIN_MULTIPLATFORM) { + local { + javaJar(project.grpcKotlinMultiplatformProtocPluginJarPath) + } + + options.put("debugOutput", "protoc-gen-grpc-kotlin-multiplatform.log") + + if (this@DefaultProtoSourceSet.name.lowercase().endsWith("main")) { + options.put("explicitApiModeEnabled", explicitApiModeEnabled) + } + } } + val languageSourceSets: ListProperty = project.objects.listProperty() + val generateTask: Property = project.objects.property() + override val proto: SourceDirectorySet = project.objects.sourceDirectorySet( PROTO_SOURCE_DIRECTORY_NAME, "Proto sources", diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt index f895d8880..e2297cb4f 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/DefaultProtocExtension.kt @@ -13,12 +13,9 @@ import kotlinx.rpc.buf.tasks.registerBufExecTask import kotlinx.rpc.buf.tasks.registerBufGenerateTask import kotlinx.rpc.buf.tasks.registerGenerateBufGenYamlTask import kotlinx.rpc.buf.tasks.registerGenerateBufYamlTask -import kotlinx.rpc.protoc.ProtocPlugin.Companion.GRPC_KOTLIN_MULTIPLATFORM -import kotlinx.rpc.protoc.ProtocPlugin.Companion.KOTLIN_MULTIPLATFORM import kotlinx.rpc.util.ensureDirectoryExists import org.gradle.api.Action import org.gradle.api.GradleException -import org.gradle.api.NamedDomainObjectContainer import org.gradle.api.Project import org.gradle.api.file.ConfigurableFileTree import org.gradle.api.model.ObjectFactory @@ -41,15 +38,6 @@ internal open class DefaultProtocExtension @Inject constructor( objects: ObjectFactory, private val project: Project, ) : ProtocExtension { - override val plugins: NamedDomainObjectContainer = - objects.domainObjectContainer(ProtocPlugin::class.java) { name -> - ProtocPlugin(name, project) - } - - override fun plugins(action: Action>) { - action.execute(plugins) - } - override val buf: BufExtension = project.objects.newInstance() override fun buf(action: Action) { action.execute(buf) @@ -60,13 +48,10 @@ internal open class DefaultProtocExtension @Inject constructor( project.configureKotlinMultiplatformPluginJarConfiguration() project.configureGrpcKotlinMultiplatformPluginJarConfiguration() - createDefaultProtocPlugins() - - project.protoSourceSets.all { - protocPlugin(plugins.kotlinMultiplatform) - protocPlugin(plugins.grpcKotlinMultiplatform) - } - + // ignore for bufGenerate task caching + project.normalization.runtimeClasspath.ignore("**/protoc-gen-kotlin-multiplatform.log") + project.normalization.runtimeClasspath.ignore("**/protoc-gen-grpc-kotlin-multiplatform.log") + project.normalization.runtimeClasspath.ignore("**/.keep") project.protoSourceSets.all { if (this !is DefaultProtoSourceSet) { @@ -92,16 +77,8 @@ internal open class DefaultProtocExtension @Inject constructor( val pairSourceSet = protoSourceSet.correspondingMainSourceSetOrNull() - val mainProtocPlugins = pairSourceSet?.protocPlugins ?: provider { emptyList() } - val protocPluginNames = protoSourceSet.protocPlugins - .zip(mainProtocPlugins) { left, right -> left + right } - .map { it.distinct() } - - val includedProtocPlugins = protocPluginNames.map { list -> - list.map { pluginName -> - this@DefaultProtocExtension.plugins.findByName(pluginName) - ?: throw GradleException("Protoc plugin $pluginName not found") - } + val includedProtocPlugins = provider { + protoSourceSet.plugins.distinct() } val protoFiles = protoSourceSet.proto @@ -303,35 +280,6 @@ internal open class DefaultProtocExtension @Inject constructor( } } - private fun createDefaultProtocPlugins() { - val explicitApiModeEnabled = project.provider { - project.the().explicitApi != ExplicitApiMode.Disabled - } - - plugins.create(KOTLIN_MULTIPLATFORM) { - local { - javaJar(project.kotlinMultiplatformProtocPluginJarPath) - } - - options.put("debugOutput", "protoc-gen-kotlin-multiplatform.log") - options.put("explicitApiModeEnabled", explicitApiModeEnabled) - } - - plugins.create(GRPC_KOTLIN_MULTIPLATFORM) { - local { - javaJar(project.grpcKotlinMultiplatformProtocPluginJarPath) - } - - options.put("debugOutput", "protoc-gen-grpc-kotlin-multiplatform.log") - options.put("explicitApiModeEnabled", explicitApiModeEnabled) - } - - // ignore for bufGenerate task caching - project.normalization.runtimeClasspath.ignore("**/protoc-gen-kotlin-multiplatform.log") - project.normalization.runtimeClasspath.ignore("**/protoc-gen-grpc-kotlin-multiplatform.log") - project.normalization.runtimeClasspath.ignore("**/.keep") - } - private fun DefaultProtoSourceSet.correspondingMainSourceSetOrNull(): DefaultProtoSourceSet? { return when { name.lowercase().endsWith("main") -> { diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtoSourceSet.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtoSourceSet.kt index 455e6182f..1087d3ddf 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtoSourceSet.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtoSourceSet.kt @@ -21,24 +21,14 @@ public interface ProtoSourceSet { public val name: String /** - * Adds a new protoc plugin. - * - * Example: - * ```kotlin - * protocPlugin(rpc.protoc.plugins.myPlugin) - * ``` + * Container of protoc plugins to be applied to the source set. */ - public fun protocPlugin(plugin: NamedDomainObjectProvider) + public val plugins: NamedDomainObjectContainer /** - * Adds a new protoc plugin. - * - * Example: - * ```kotlin - * protocPlugin(rpc.protoc.plugins.myPlugin.get()) - * ``` + * Configures the protoc plugins. */ - public fun protocPlugin(plugin: ProtocPlugin) + public fun plugins(action: Action>) /** * Default [SourceDirectorySet] for proto files. diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtocExtension.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtocExtension.kt index ff8e843f9..b1ed62e3e 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtocExtension.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/ProtocExtension.kt @@ -6,12 +6,11 @@ package kotlinx.rpc.protoc import kotlinx.rpc.buf.BufExtension import org.gradle.api.Action -import org.gradle.api.NamedDomainObjectContainer /** - * Configuration for the gRPC capabilities. + * Configuration for the Protoc capabilities. * - * To enable the gRPC capabilities, add the following minimal code to your `build.gradle.kts`: + * To enable the Protoc capabilities, add the following minimal code to your `build.gradle.kts`: * ```kotlin * rpc { * protoc() @@ -19,16 +18,6 @@ import org.gradle.api.NamedDomainObjectContainer * ``` */ public interface ProtocExtension { - /** - * List of protoc plugins to be applied to the project. - */ - public val plugins: NamedDomainObjectContainer - - /** - * Configures the protoc plugins. - */ - public fun plugins(action: Action>) - /** * Configuration for the Buf build tool. */ diff --git a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/pluginJars.kt b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/pluginJars.kt index f12033e8e..b325146f5 100644 --- a/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/pluginJars.kt +++ b/gradle-plugin/src/main/kotlin/kotlinx/rpc/protoc/pluginJars.kt @@ -52,9 +52,9 @@ internal fun Project.configureGrpcKotlinMultiplatformPluginJarConfiguration() { ) } -private fun Project.jarPathAccessor(name: String): Provider = - project.configurations.named(name) - .map { it.singleFile.absolutePath } +private fun Project.jarPathAccessor(name: String): Provider = project.provider { + configurations.named(name).get().singleFile.absolutePath +} private fun Project.configureJarConfiguration(configurationName: String, pluginArtifactName: String) { configurations.create(configurationName) diff --git a/gradle-plugin/src/test/kotlin/kotlinx/rpc/GrpcJvmProjectTest.kt b/gradle-plugin/src/test/kotlin/kotlinx/rpc/GrpcJvmProjectTest.kt index 66d55d109..4103cfda5 100644 --- a/gradle-plugin/src/test/kotlin/kotlinx/rpc/GrpcJvmProjectTest.kt +++ b/gradle-plugin/src/test/kotlin/kotlinx/rpc/GrpcJvmProjectTest.kt @@ -135,16 +135,16 @@ class GrpcJvmProjectTest : GrpcBaseTest() { version: v2 clean: true plugins: - - local: [protoc-gen-kotlin-multiplatform] - out: kotlin-multiplatform - opt: - - debugOutput=protoc-gen-kotlin-multiplatform.log - - explicitApiModeEnabled=true - local: [protoc-gen-grpc-kotlin-multiplatform] out: grpc-kotlin-multiplatform opt: - debugOutput=protoc-gen-grpc-kotlin-multiplatform.log - explicitApiModeEnabled=true + - local: [protoc-gen-kotlin-multiplatform] + out: kotlin-multiplatform + opt: + - debugOutput=protoc-gen-kotlin-multiplatform.log + - explicitApiModeEnabled=true - local: [path, to, protoc-gen-myplugin.exe] out: myPlugin opt: diff --git a/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/can_add_custom_protoc_plugins/build.gradle.kts b/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/can_add_custom_protoc_plugins/build.gradle.kts index 437f5e141..e6e1a3eac 100644 --- a/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/can_add_custom_protoc_plugins/build.gradle.kts +++ b/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/can_add_custom_protoc_plugins/build.gradle.kts @@ -11,7 +11,11 @@ plugins { } rpc { - protoc { + protoc() +} + +protoSourceSets { + main { plugins { create("myPlugin") { local { @@ -35,10 +39,3 @@ rpc { } } } - -protoSourceSets { - main { - protocPlugin(rpc.protoc.plugins.named("myPlugin")) - protocPlugin(rpc.protoc.plugins.named("myRemotePlugin")) - } -} diff --git a/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/custom_protoc_plugins_must_declare_an_artifact/build.gradle.kts b/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/custom_protoc_plugins_must_declare_an_artifact/build.gradle.kts index beec798d6..44c4b5591 100644 --- a/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/custom_protoc_plugins_must_declare_an_artifact/build.gradle.kts +++ b/gradle-plugin/src/test/resources/projects/GrpcJvmProjectTest/custom_protoc_plugins_must_declare_an_artifact/build.gradle.kts @@ -11,15 +11,13 @@ plugins { } rpc { - protoc { - plugins { - create("myPlugin") {} - } - } + protoc() } protoSourceSets { main { - protocPlugin(rpc.protoc.plugins.named("myPlugin")) + plugins { + create("myPlugin") {} + } } } diff --git a/protobuf/protobuf-core/build.gradle.kts b/protobuf/protobuf-core/build.gradle.kts index a8cf01755..abb946b07 100644 --- a/protobuf/protobuf-core/build.gradle.kts +++ b/protobuf/protobuf-core/build.gradle.kts @@ -4,6 +4,8 @@ @file:OptIn(InternalRpcApi::class) +import org.jetbrains.kotlin.gradle.dsl.KotlinVersion +import kotlinx.rpc.buf.tasks.BufGenerateTask import kotlinx.rpc.internal.InternalRpcApi import kotlinx.rpc.internal.configureLocalProtocGenDevelopmentDependency import util.configureCLibCInterop @@ -14,19 +16,23 @@ plugins { } kotlin { + compilerOptions { + apiVersion = KotlinVersion.KOTLIN_2_1 + } + sourceSets { commonMain { dependencies { api(projects.utils) api(projects.protobuf.protobufInputStream) + api(projects.grpc.grpcCodec) + api(libs.kotlinx.io.core) } } commonTest { dependencies { - implementation(projects.grpc.grpcCodec) - implementation(libs.kotlin.test) implementation(libs.coroutines.test) } @@ -66,4 +72,17 @@ protoSourceSets { } } -configureLocalProtocGenDevelopmentDependency() +configureLocalProtocGenDevelopmentDependency("Main", "Test") + +val generatedCodeDir = layout.projectDirectory + .dir("src") + .dir("commonMain") + .dir("generated-code") + .asFile + +tasks.withType().configureEach { + if (name.contains("Main")) { + includeWkt = true + outputDirectory = generatedCodeDir + } +} diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Any.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Any.kt new file mode 100644 index 000000000..a34ae1320 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Any.kt @@ -0,0 +1,13 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.AnyInternal.CODEC::class) +public interface Any { + public val typeUrl: String + public val value: ByteArray + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Api.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Api.kt new file mode 100644 index 000000000..12466025b --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Api.kt @@ -0,0 +1,39 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.ApiInternal.CODEC::class) +public interface Api { + public val name: String + public val methods: List + public val options: List + public val version: String + public val sourceContext: com.google.protobuf.kotlin.SourceContext + public val mixins: List + public val syntax: com.google.protobuf.kotlin.Syntax + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.MethodInternal.CODEC::class) +public interface Method { + public val name: String + public val requestTypeUrl: String + public val requestStreaming: Boolean + public val responseTypeUrl: String + public val responseStreaming: Boolean + public val options: List + public val syntax: com.google.protobuf.kotlin.Syntax + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.MixinInternal.CODEC::class) +public interface Mixin { + public val name: String + public val root: String + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Duration.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Duration.kt new file mode 100644 index 000000000..f0fa480c3 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Duration.kt @@ -0,0 +1,13 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.DurationInternal.CODEC::class) +public interface Duration { + public val seconds: Long + public val nanos: Int + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Empty.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Empty.kt new file mode 100644 index 000000000..0f618e7fb --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Empty.kt @@ -0,0 +1,10 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.EmptyInternal.CODEC::class) +public interface Empty { + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/FieldMask.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/FieldMask.kt new file mode 100644 index 000000000..ea41057f4 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/FieldMask.kt @@ -0,0 +1,12 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.FieldMaskInternal.CODEC::class) +public interface FieldMask { + public val paths: List + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/SourceContext.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/SourceContext.kt new file mode 100644 index 000000000..ebc8e81a0 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/SourceContext.kt @@ -0,0 +1,12 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.SourceContextInternal.CODEC::class) +public interface SourceContext { + public val fileName: String + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Struct.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Struct.kt new file mode 100644 index 000000000..1469b0ecc --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Struct.kt @@ -0,0 +1,63 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlin.jvm.JvmInline +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.StructInternal.CODEC::class) +public interface Struct { + public val fields: Map + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.ValueInternal.CODEC::class) +public interface Value { + public val kind: com.google.protobuf.kotlin.Value.Kind? + + public sealed interface Kind { + @JvmInline + public value class NullValue( + public val value: com.google.protobuf.kotlin.NullValue, + ): Kind + + @JvmInline + public value class NumberValue(public val value: Double): Kind + + @JvmInline + public value class StringValue(public val value: String): Kind + + @JvmInline + public value class BoolValue(public val value: Boolean): Kind + + @JvmInline + public value class StructValue( + public val value: com.google.protobuf.kotlin.Struct, + ): Kind + + @JvmInline + public value class ListValue( + public val value: com.google.protobuf.kotlin.ListValue, + ): Kind + } + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.ListValueInternal.CODEC::class) +public interface ListValue { + public val values: List + + public companion object +} + +public sealed class NullValue(public open val number: Int) { + public object NULL_VALUE: NullValue(number = 0) + + public data class UNRECOGNIZED(override val number: Int): NullValue(number) + + public companion object { + public val entries: List by lazy { listOf(NULL_VALUE) } + } +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Timestamp.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Timestamp.kt new file mode 100644 index 000000000..f05bbf2b4 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Timestamp.kt @@ -0,0 +1,13 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.TimestampInternal.CODEC::class) +public interface Timestamp { + public val seconds: Long + public val nanos: Int + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Type.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Type.kt new file mode 100644 index 000000000..a58b713f8 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Type.kt @@ -0,0 +1,139 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.TypeInternal.CODEC::class) +public interface Type { + public val name: String + public val fields: List + public val oneofs: List + public val options: List + public val sourceContext: com.google.protobuf.kotlin.SourceContext + public val syntax: com.google.protobuf.kotlin.Syntax + public val edition: String + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.FieldInternal.CODEC::class) +public interface Field { + public val kind: com.google.protobuf.kotlin.Field.Kind + public val cardinality: com.google.protobuf.kotlin.Field.Cardinality + public val number: Int + public val name: String + public val typeUrl: String + public val oneofIndex: Int + public val packed: Boolean + public val options: List + public val jsonName: String + public val defaultValue: String + + public sealed class Kind(public open val number: Int) { + public object TYPE_UNKNOWN: Kind(number = 0) + + public object TYPE_DOUBLE: Kind(number = 1) + + public object TYPE_FLOAT: Kind(number = 2) + + public object TYPE_INT64: Kind(number = 3) + + public object TYPE_UINT64: Kind(number = 4) + + public object TYPE_INT32: Kind(number = 5) + + public object TYPE_FIXED64: Kind(number = 6) + + public object TYPE_FIXED32: Kind(number = 7) + + public object TYPE_BOOL: Kind(number = 8) + + public object TYPE_STRING: Kind(number = 9) + + public object TYPE_GROUP: Kind(number = 10) + + public object TYPE_MESSAGE: Kind(number = 11) + + public object TYPE_BYTES: Kind(number = 12) + + public object TYPE_UINT32: Kind(number = 13) + + public object TYPE_ENUM: Kind(number = 14) + + public object TYPE_SFIXED32: Kind(number = 15) + + public object TYPE_SFIXED64: Kind(number = 16) + + public object TYPE_SINT32: Kind(number = 17) + + public object TYPE_SINT64: Kind(number = 18) + + public data class UNRECOGNIZED(override val number: Int): Kind(number) + + public companion object { + public val entries: List by lazy { listOf(TYPE_UNKNOWN, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INT64, TYPE_UINT64, TYPE_INT32, TYPE_FIXED64, TYPE_FIXED32, TYPE_BOOL, TYPE_STRING, TYPE_GROUP, TYPE_MESSAGE, TYPE_BYTES, TYPE_UINT32, TYPE_ENUM, TYPE_SFIXED32, TYPE_SFIXED64, TYPE_SINT32, TYPE_SINT64) } + } + } + + public sealed class Cardinality(public open val number: Int) { + public object CARDINALITY_UNKNOWN: Cardinality(number = 0) + + public object CARDINALITY_OPTIONAL: Cardinality(number = 1) + + public object CARDINALITY_REQUIRED: Cardinality(number = 2) + + public object CARDINALITY_REPEATED: Cardinality(number = 3) + + public data class UNRECOGNIZED(override val number: Int): Cardinality(number) + + public companion object { + public val entries: List by lazy { listOf(CARDINALITY_UNKNOWN, CARDINALITY_OPTIONAL, CARDINALITY_REQUIRED, CARDINALITY_REPEATED) } + } + } + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.EnumInternal.CODEC::class) +public interface Enum { + public val name: String + public val enumvalue: List + public val options: List + public val sourceContext: com.google.protobuf.kotlin.SourceContext + public val syntax: com.google.protobuf.kotlin.Syntax + public val edition: String + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.EnumValueInternal.CODEC::class) +public interface EnumValue { + public val name: String + public val number: Int + public val options: List + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.OptionInternal.CODEC::class) +public interface Option { + public val name: String + public val value: com.google.protobuf.kotlin.Any + + public companion object +} + +public sealed class Syntax(public open val number: Int) { + public object SYNTAX_PROTO2: Syntax(number = 0) + + public object SYNTAX_PROTO3: Syntax(number = 1) + + public object SYNTAX_EDITIONS: Syntax(number = 2) + + public data class UNRECOGNIZED(override val number: Int): Syntax(number) + + public companion object { + public val entries: List by lazy { listOf(SYNTAX_PROTO2, SYNTAX_PROTO3, SYNTAX_EDITIONS) } + } +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Wrappers.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Wrappers.kt new file mode 100644 index 000000000..b5b8dab74 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/Wrappers.kt @@ -0,0 +1,68 @@ +@file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.DoubleValueInternal.CODEC::class) +public interface DoubleValue { + public val value: Double + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.FloatValueInternal.CODEC::class) +public interface FloatValue { + public val value: Float + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.Int64ValueInternal.CODEC::class) +public interface Int64Value { + public val value: Long + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.UInt64ValueInternal.CODEC::class) +public interface UInt64Value { + public val value: ULong + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.Int32ValueInternal.CODEC::class) +public interface Int32Value { + public val value: Int + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.UInt32ValueInternal.CODEC::class) +public interface UInt32Value { + public val value: UInt + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.BoolValueInternal.CODEC::class) +public interface BoolValue { + public val value: Boolean + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.StringValueInternal.CODEC::class) +public interface StringValue { + public val value: String + + public companion object +} + +@kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf.kotlin.BytesValueInternal.CODEC::class) +public interface BytesValue { + public val value: ByteArray + + public companion object +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt new file mode 100644 index 000000000..5c77b4984 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt @@ -0,0 +1,103 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class AnyInternal: com.google.protobuf.kotlin.Any, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var typeUrl: String by MsgFieldDelegate { "" } + public override var value: ByteArray by MsgFieldDelegate { byteArrayOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Any): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Any { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.AnyInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.AnyInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Any.Companion.invoke(body: com.google.protobuf.kotlin.AnyInternal.() -> Unit): com.google.protobuf.kotlin.Any { + val msg = com.google.protobuf.kotlin.AnyInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.AnyInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.AnyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (typeUrl.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = typeUrl) + } + + if (value.isNotEmpty()) { + encoder.writeBytes(fieldNr = 2, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.AnyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.AnyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.typeUrl = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readBytes() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.AnyInternal.computeSize(): Int { + var __result = 0 + if (typeUrl.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(typeUrl).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Any.asInternal(): com.google.protobuf.kotlin.AnyInternal { + return this as? com.google.protobuf.kotlin.AnyInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt new file mode 100644 index 000000000..73bd6d811 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt @@ -0,0 +1,467 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class ApiInternal: com.google.protobuf.kotlin.Api, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + public const val sourceContext: Int = 0 + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var methods: List by MsgFieldDelegate { mutableListOf() } + public override var options: List by MsgFieldDelegate { mutableListOf() } + public override var version: String by MsgFieldDelegate { "" } + public override var sourceContext: com.google.protobuf.kotlin.SourceContext by MsgFieldDelegate(PresenceIndices.sourceContext) { com.google.protobuf.kotlin.SourceContextInternal() } + public override var mixins: List by MsgFieldDelegate { mutableListOf() } + public override var syntax: com.google.protobuf.kotlin.Syntax by MsgFieldDelegate { com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Api): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Api { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.ApiInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.ApiInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class MethodInternal: com.google.protobuf.kotlin.Method, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var requestTypeUrl: String by MsgFieldDelegate { "" } + public override var requestStreaming: Boolean by MsgFieldDelegate { false } + public override var responseTypeUrl: String by MsgFieldDelegate { "" } + public override var responseStreaming: Boolean by MsgFieldDelegate { false } + public override var options: List by MsgFieldDelegate { mutableListOf() } + public override var syntax: com.google.protobuf.kotlin.Syntax by MsgFieldDelegate { com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Method): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Method { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.MethodInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.MethodInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class MixinInternal: com.google.protobuf.kotlin.Mixin, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var root: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Mixin): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Mixin { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.MixinInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.MixinInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Api.Companion.invoke(body: com.google.protobuf.kotlin.ApiInternal.() -> Unit): com.google.protobuf.kotlin.Api { + val msg = com.google.protobuf.kotlin.ApiInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Method.Companion.invoke(body: com.google.protobuf.kotlin.MethodInternal.() -> Unit): com.google.protobuf.kotlin.Method { + val msg = com.google.protobuf.kotlin.MethodInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Mixin.Companion.invoke(body: com.google.protobuf.kotlin.MixinInternal.() -> Unit): com.google.protobuf.kotlin.Mixin { + val msg = com.google.protobuf.kotlin.MixinInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ApiInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + sourceContext.asInternal().checkRequiredFields() + } + + methods.forEach { + it.asInternal().checkRequiredFields() + } + + options.forEach { + it.asInternal().checkRequiredFields() + } + + mixins.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ApiInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (methods.isNotEmpty()) { + methods.forEach { + encoder.writeMessage(fieldNr = 2, value = it.asInternal()) { encodeWith(it) } + } + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 3, value = it.asInternal()) { encodeWith(it) } + } + } + + if (version.isNotEmpty()) { + encoder.writeString(fieldNr = 4, value = version) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 5, value = sourceContext.asInternal()) { encodeWith(it) } + } + + if (mixins.isNotEmpty()) { + mixins.forEach { + encoder.writeMessage(fieldNr = 6, value = it.asInternal()) { encodeWith(it) } + } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + encoder.writeEnum(fieldNr = 7, value = syntax.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ApiInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.MethodInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.MethodInternal::decodeWith) + (msg.methods as MutableList).add(elem) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.version = decoder.readString() + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.sourceContext = com.google.protobuf.kotlin.SourceContextInternal() + } + + decoder.readMessage(msg.sourceContext.asInternal(), com.google.protobuf.kotlin.SourceContextInternal::decodeWith) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.MixinInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.MixinInternal::decodeWith) + (msg.mixins as MutableList).add(elem) + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.syntax = com.google.protobuf.kotlin.Syntax.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.ApiInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (methods.isNotEmpty()) { + __result = methods.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (version.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(version).let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += sourceContext.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (mixins.isNotEmpty()) { + __result = mixins.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(syntax.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Api.asInternal(): com.google.protobuf.kotlin.ApiInternal { + return this as? com.google.protobuf.kotlin.ApiInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MethodInternal.checkRequiredFields() { + // no required fields to check + options.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MethodInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (requestTypeUrl.isNotEmpty()) { + encoder.writeString(fieldNr = 2, value = requestTypeUrl) + } + + if (requestStreaming != false) { + encoder.writeBool(fieldNr = 3, value = requestStreaming) + } + + if (responseTypeUrl.isNotEmpty()) { + encoder.writeString(fieldNr = 4, value = responseTypeUrl) + } + + if (responseStreaming != false) { + encoder.writeBool(fieldNr = 5, value = responseStreaming) + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 6, value = it.asInternal()) { encodeWith(it) } + } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + encoder.writeEnum(fieldNr = 7, value = syntax.number) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MethodInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.requestTypeUrl = decoder.readString() + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.requestStreaming = decoder.readBool() + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.responseTypeUrl = decoder.readString() + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.responseStreaming = decoder.readBool() + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.syntax = com.google.protobuf.kotlin.Syntax.fromNumber(decoder.readEnum()) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.MethodInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (requestTypeUrl.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(requestTypeUrl).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (requestStreaming != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(requestStreaming)) + } + + if (responseTypeUrl.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(responseTypeUrl).let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (responseStreaming != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(responseStreaming)) + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(syntax.number)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Method.asInternal(): com.google.protobuf.kotlin.MethodInternal { + return this as? com.google.protobuf.kotlin.MethodInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MixinInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MixinInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (root.isNotEmpty()) { + encoder.writeString(fieldNr = 2, value = root) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MixinInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.root = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.MixinInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (root.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(root).let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Mixin.asInternal(): com.google.protobuf.kotlin.MixinInternal { + return this as? com.google.protobuf.kotlin.MixinInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt new file mode 100644 index 000000000..0854939e1 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt @@ -0,0 +1,103 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class DurationInternal: com.google.protobuf.kotlin.Duration, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var seconds: Long by MsgFieldDelegate { 0L } + public override var nanos: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Duration): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Duration { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.DurationInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.DurationInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Duration.Companion.invoke(body: com.google.protobuf.kotlin.DurationInternal.() -> Unit): com.google.protobuf.kotlin.Duration { + val msg = com.google.protobuf.kotlin.DurationInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DurationInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DurationInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (seconds != 0L) { + encoder.writeInt64(fieldNr = 1, value = seconds) + } + + if (nanos != 0) { + encoder.writeInt32(fieldNr = 2, value = nanos) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DurationInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DurationInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.seconds = decoder.readInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.nanos = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.DurationInternal.computeSize(): Int { + var __result = 0 + if (seconds != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(seconds)) + } + + if (nanos != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(nanos)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Duration.asInternal(): com.google.protobuf.kotlin.DurationInternal { + return this as? com.google.protobuf.kotlin.DurationInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt new file mode 100644 index 000000000..09a799f72 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt @@ -0,0 +1,78 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class EmptyInternal: com.google.protobuf.kotlin.Empty, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Empty): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Empty { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.EmptyInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.EmptyInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Empty.Companion.invoke(body: com.google.protobuf.kotlin.EmptyInternal.() -> Unit): com.google.protobuf.kotlin.Empty { + val msg = com.google.protobuf.kotlin.EmptyInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EmptyInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EmptyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + // no fields to encode +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EmptyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EmptyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.EmptyInternal.computeSize(): Int { + var __result = 0 + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Empty.asInternal(): com.google.protobuf.kotlin.EmptyInternal { + return this as? com.google.protobuf.kotlin.EmptyInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt new file mode 100644 index 000000000..cd95b2bc8 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt @@ -0,0 +1,93 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class FieldMaskInternal: com.google.protobuf.kotlin.FieldMask, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var paths: List by MsgFieldDelegate { mutableListOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.FieldMask): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.FieldMask { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.FieldMaskInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.FieldMaskInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.FieldMask.Companion.invoke(body: com.google.protobuf.kotlin.FieldMaskInternal.() -> Unit): com.google.protobuf.kotlin.FieldMask { + val msg = com.google.protobuf.kotlin.FieldMaskInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldMaskInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldMaskInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (paths.isNotEmpty()) { + paths.forEach { + encoder.writeString(1, it) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldMaskInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldMaskInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.paths as MutableList).add(elem) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.FieldMaskInternal.computeSize(): Int { + var __result = 0 + if (paths.isNotEmpty()) { + __result = paths.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldMask.asInternal(): com.google.protobuf.kotlin.FieldMaskInternal { + return this as? com.google.protobuf.kotlin.FieldMaskInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt new file mode 100644 index 000000000..f3fce414c --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt @@ -0,0 +1,90 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class SourceContextInternal: com.google.protobuf.kotlin.SourceContext, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var fileName: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.SourceContext): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.SourceContext { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.SourceContextInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.SourceContextInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.SourceContext.Companion.invoke(body: com.google.protobuf.kotlin.SourceContextInternal.() -> Unit): com.google.protobuf.kotlin.SourceContext { + val msg = com.google.protobuf.kotlin.SourceContextInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.SourceContextInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.SourceContextInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (fileName.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = fileName) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.SourceContextInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.SourceContextInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.fileName = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.SourceContextInternal.computeSize(): Int { + var __result = 0 + if (fileName.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(fileName).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.SourceContext.asInternal(): com.google.protobuf.kotlin.SourceContextInternal { + return this as? com.google.protobuf.kotlin.SourceContextInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt new file mode 100644 index 000000000..6ab75dd51 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt @@ -0,0 +1,460 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class StructInternal: com.google.protobuf.kotlin.Struct, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var fields: Map by MsgFieldDelegate { mutableMapOf() } + + public class FieldsEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + public const val value: Int = 0 + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public var key: String by MsgFieldDelegate { "" } + public var value: com.google.protobuf.kotlin.Value by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf.kotlin.ValueInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Struct): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Struct { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.StructInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.StructInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class ValueInternal: com.google.protobuf.kotlin.Value, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var kind: com.google.protobuf.kotlin.Value.Kind? = null + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Value): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Value { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.ValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.ValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class ListValueInternal: com.google.protobuf.kotlin.ListValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var values: List by MsgFieldDelegate { mutableListOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.ListValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.ListValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.ListValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.ListValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Struct.Companion.invoke(body: com.google.protobuf.kotlin.StructInternal.() -> Unit): com.google.protobuf.kotlin.Struct { + val msg = com.google.protobuf.kotlin.StructInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Value.Companion.invoke(body: com.google.protobuf.kotlin.ValueInternal.() -> Unit): com.google.protobuf.kotlin.Value { + val msg = com.google.protobuf.kotlin.ValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.ListValue.Companion.invoke(body: com.google.protobuf.kotlin.ListValueInternal.() -> Unit): com.google.protobuf.kotlin.ListValue { + val msg = com.google.protobuf.kotlin.ListValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.checkRequiredFields() { + // no required fields to check + fields.values.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (fields.isNotEmpty()) { + fields.forEach { kEntry -> + com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + .also { entry -> + encoder.writeMessage(fieldNr = 1, value = entry.asInternal()) { encodeWith(it) } + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + with(com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal()) { + decoder.readMessage(this.asInternal(), com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal::decodeWith) + (msg.fields as MutableMap)[key] = value + } + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.StructInternal.computeSize(): Int { + var __result = 0 + if (fields.isNotEmpty()) { + __result += fields.entries.sumOf { kEntry -> + com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal().apply { + key = kEntry.key + value = kEntry.value + } + ._size + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Struct.asInternal(): com.google.protobuf.kotlin.StructInternal { + return this as? com.google.protobuf.kotlin.StructInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ValueInternal.checkRequiredFields() { + // no required fields to check + kind?.also { + when { + it is com.google.protobuf.kotlin.Value.Kind.StructValue -> { + it.value.asInternal().checkRequiredFields() + } + + it is com.google.protobuf.kotlin.Value.Kind.ListValue -> { + it.value.asInternal().checkRequiredFields() + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + kind?.also { + when (val value = it) { + is com.google.protobuf.kotlin.Value.Kind.NullValue -> { + encoder.writeEnum(fieldNr = 1, value = value.value.number) + } + + is com.google.protobuf.kotlin.Value.Kind.NumberValue -> { + encoder.writeDouble(fieldNr = 2, value = value.value) + } + + is com.google.protobuf.kotlin.Value.Kind.StringValue -> { + encoder.writeString(fieldNr = 3, value = value.value) + } + + is com.google.protobuf.kotlin.Value.Kind.BoolValue -> { + encoder.writeBool(fieldNr = 4, value = value.value) + } + + is com.google.protobuf.kotlin.Value.Kind.StructValue -> { + encoder.writeMessage(fieldNr = 5, value = value.value.asInternal()) { encodeWith(it) } + } + + is com.google.protobuf.kotlin.Value.Kind.ListValue -> { + encoder.writeMessage(fieldNr = 6, value = value.value.asInternal()) { encodeWith(it) } + } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.kind = com.google.protobuf.kotlin.Value.Kind.NullValue(com.google.protobuf.kotlin.NullValue.fromNumber(decoder.readEnum())) + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.kind = com.google.protobuf.kotlin.Value.Kind.NumberValue(decoder.readDouble()) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.kind = com.google.protobuf.kotlin.Value.Kind.StringValue(decoder.readString()) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.kind = com.google.protobuf.kotlin.Value.Kind.BoolValue(decoder.readBool()) + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val field = (msg.kind as? com.google.protobuf.kotlin.Value.Kind.StructValue) ?: com.google.protobuf.kotlin.Value.Kind.StructValue(com.google.protobuf.kotlin.StructInternal()).also { + msg.kind = it + } + + decoder.readMessage(field.value.asInternal(), com.google.protobuf.kotlin.StructInternal::decodeWith) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val field = (msg.kind as? com.google.protobuf.kotlin.Value.Kind.ListValue) ?: com.google.protobuf.kotlin.Value.Kind.ListValue(com.google.protobuf.kotlin.ListValueInternal()).also { + msg.kind = it + } + + decoder.readMessage(field.value.asInternal(), com.google.protobuf.kotlin.ListValueInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.ValueInternal.computeSize(): Int { + var __result = 0 + kind?.also { + when (val value = it) { + is com.google.protobuf.kotlin.Value.Kind.NullValue -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(value.value.number)) + } + + is com.google.protobuf.kotlin.Value.Kind.NumberValue -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value.value)) + } + + is com.google.protobuf.kotlin.Value.Kind.StringValue -> { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value.value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.kotlin.Value.Kind.BoolValue -> { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value.value)) + } + + is com.google.protobuf.kotlin.Value.Kind.StructValue -> { + __result += value.value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + is com.google.protobuf.kotlin.Value.Kind.ListValue -> { + __result += value.value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Value.asInternal(): com.google.protobuf.kotlin.ValueInternal { + return this as? com.google.protobuf.kotlin.ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ListValueInternal.checkRequiredFields() { + // no required fields to check + values.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ListValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (values.isNotEmpty()) { + values.forEach { + encoder.writeMessage(fieldNr = 1, value = it.asInternal()) { encodeWith(it) } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ListValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ListValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) + (msg.values as MutableList).add(elem) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.ListValueInternal.computeSize(): Int { + var __result = 0 + if (values.isNotEmpty()) { + __result = values.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.ListValue.asInternal(): com.google.protobuf.kotlin.ListValueInternal { + return this as? com.google.protobuf.kotlin.ListValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (key.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = key) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.key = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf.kotlin.ValueInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.computeSize(): Int { + var __result = 0 + if (key.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(key).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.asInternal(): com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal { + return this +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.NullValue.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.NullValue { + return when (number) { + 0 -> { + com.google.protobuf.kotlin.NullValue.NULL_VALUE + } + + else -> { + com.google.protobuf.kotlin.NullValue.UNRECOGNIZED(number) + } + } +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt new file mode 100644 index 000000000..27053f95c --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt @@ -0,0 +1,103 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class TimestampInternal: com.google.protobuf.kotlin.Timestamp, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var seconds: Long by MsgFieldDelegate { 0L } + public override var nanos: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Timestamp): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Timestamp { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.TimestampInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.TimestampInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Timestamp.Companion.invoke(body: com.google.protobuf.kotlin.TimestampInternal.() -> Unit): com.google.protobuf.kotlin.Timestamp { + val msg = com.google.protobuf.kotlin.TimestampInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TimestampInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TimestampInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (seconds != 0L) { + encoder.writeInt64(fieldNr = 1, value = seconds) + } + + if (nanos != 0) { + encoder.writeInt32(fieldNr = 2, value = nanos) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TimestampInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TimestampInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.seconds = decoder.readInt64() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.nanos = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.TimestampInternal.computeSize(): Int { + var __result = 0 + if (seconds != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(seconds)) + } + + if (nanos != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(nanos)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Timestamp.asInternal(): com.google.protobuf.kotlin.TimestampInternal { + return this as? com.google.protobuf.kotlin.TimestampInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt new file mode 100644 index 000000000..6887ef660 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt @@ -0,0 +1,934 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class TypeInternal: com.google.protobuf.kotlin.Type, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + public const val sourceContext: Int = 0 + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var fields: List by MsgFieldDelegate { mutableListOf() } + public override var oneofs: List by MsgFieldDelegate { mutableListOf() } + public override var options: List by MsgFieldDelegate { mutableListOf() } + public override var sourceContext: com.google.protobuf.kotlin.SourceContext by MsgFieldDelegate(PresenceIndices.sourceContext) { com.google.protobuf.kotlin.SourceContextInternal() } + public override var syntax: com.google.protobuf.kotlin.Syntax by MsgFieldDelegate { com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 } + public override var edition: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Type): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Type { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.TypeInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.TypeInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class FieldInternal: com.google.protobuf.kotlin.Field, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var kind: com.google.protobuf.kotlin.Field.Kind by MsgFieldDelegate { com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN } + public override var cardinality: com.google.protobuf.kotlin.Field.Cardinality by MsgFieldDelegate { com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_UNKNOWN } + public override var number: Int by MsgFieldDelegate { 0 } + public override var name: String by MsgFieldDelegate { "" } + public override var typeUrl: String by MsgFieldDelegate { "" } + public override var oneofIndex: Int by MsgFieldDelegate { 0 } + public override var packed: Boolean by MsgFieldDelegate { false } + public override var options: List by MsgFieldDelegate { mutableListOf() } + public override var jsonName: String by MsgFieldDelegate { "" } + public override var defaultValue: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Field): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Field { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.FieldInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.FieldInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class EnumInternal: com.google.protobuf.kotlin.Enum, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + public const val sourceContext: Int = 0 + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var enumvalue: List by MsgFieldDelegate { mutableListOf() } + public override var options: List by MsgFieldDelegate { mutableListOf() } + public override var sourceContext: com.google.protobuf.kotlin.SourceContext by MsgFieldDelegate(PresenceIndices.sourceContext) { com.google.protobuf.kotlin.SourceContextInternal() } + public override var syntax: com.google.protobuf.kotlin.Syntax by MsgFieldDelegate { com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 } + public override var edition: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Enum): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Enum { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.EnumInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.EnumInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class EnumValueInternal: com.google.protobuf.kotlin.EnumValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var number: Int by MsgFieldDelegate { 0 } + public override var options: List by MsgFieldDelegate { mutableListOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.EnumValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.EnumValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.EnumValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.EnumValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class OptionInternal: com.google.protobuf.kotlin.Option, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { + private object PresenceIndices { + public const val value: Int = 0 + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var name: String by MsgFieldDelegate { "" } + public override var value: com.google.protobuf.kotlin.Any by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf.kotlin.AnyInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Option): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Option { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.OptionInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.OptionInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.Type.Companion.invoke(body: com.google.protobuf.kotlin.TypeInternal.() -> Unit): com.google.protobuf.kotlin.Type { + val msg = com.google.protobuf.kotlin.TypeInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Field.Companion.invoke(body: com.google.protobuf.kotlin.FieldInternal.() -> Unit): com.google.protobuf.kotlin.Field { + val msg = com.google.protobuf.kotlin.FieldInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Enum.Companion.invoke(body: com.google.protobuf.kotlin.EnumInternal.() -> Unit): com.google.protobuf.kotlin.Enum { + val msg = com.google.protobuf.kotlin.EnumInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.EnumValue.Companion.invoke(body: com.google.protobuf.kotlin.EnumValueInternal.() -> Unit): com.google.protobuf.kotlin.EnumValue { + val msg = com.google.protobuf.kotlin.EnumValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Option.Companion.invoke(body: com.google.protobuf.kotlin.OptionInternal.() -> Unit): com.google.protobuf.kotlin.Option { + val msg = com.google.protobuf.kotlin.OptionInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TypeInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + sourceContext.asInternal().checkRequiredFields() + } + + fields.forEach { + it.asInternal().checkRequiredFields() + } + + options.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TypeInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (fields.isNotEmpty()) { + fields.forEach { + encoder.writeMessage(fieldNr = 2, value = it.asInternal()) { encodeWith(it) } + } + } + + if (oneofs.isNotEmpty()) { + oneofs.forEach { + encoder.writeString(3, it) + } + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 4, value = it.asInternal()) { encodeWith(it) } + } + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 5, value = sourceContext.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + encoder.writeEnum(fieldNr = 6, value = syntax.number) + } + + if (edition.isNotEmpty()) { + encoder.writeString(fieldNr = 7, value = edition) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.TypeInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TypeInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.FieldInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.FieldInternal::decodeWith) + (msg.fields as MutableList).add(elem) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = decoder.readString() + (msg.oneofs as MutableList).add(elem) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.sourceContext = com.google.protobuf.kotlin.SourceContextInternal() + } + + decoder.readMessage(msg.sourceContext.asInternal(), com.google.protobuf.kotlin.SourceContextInternal::decodeWith) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.syntax = com.google.protobuf.kotlin.Syntax.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.edition = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.TypeInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (fields.isNotEmpty()) { + __result = fields.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (oneofs.isNotEmpty()) { + __result = oneofs.sumOf { kotlinx.rpc.protobuf.internal.WireSize.string(it) + kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (presenceMask[0]) { + __result += sourceContext.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(syntax.number)) + } + + if (edition.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(edition).let { kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Type.asInternal(): com.google.protobuf.kotlin.TypeInternal { + return this as? com.google.protobuf.kotlin.TypeInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldInternal.checkRequiredFields() { + // no required fields to check + options.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN != kind) { + encoder.writeEnum(fieldNr = 1, value = kind.number) + } + + if (com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_UNKNOWN != cardinality) { + encoder.writeEnum(fieldNr = 2, value = cardinality.number) + } + + if (number != 0) { + encoder.writeInt32(fieldNr = 3, value = number) + } + + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 4, value = name) + } + + if (typeUrl.isNotEmpty()) { + encoder.writeString(fieldNr = 6, value = typeUrl) + } + + if (oneofIndex != 0) { + encoder.writeInt32(fieldNr = 7, value = oneofIndex) + } + + if (packed != false) { + encoder.writeBool(fieldNr = 8, value = packed) + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 9, value = it.asInternal()) { encodeWith(it) } + } + } + + if (jsonName.isNotEmpty()) { + encoder.writeString(fieldNr = 10, value = jsonName) + } + + if (defaultValue.isNotEmpty()) { + encoder.writeString(fieldNr = 11, value = defaultValue) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FieldInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.kind = com.google.protobuf.kotlin.Field.Kind.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.cardinality = com.google.protobuf.kotlin.Field.Cardinality.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.number = decoder.readInt32() + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.typeUrl = decoder.readString() + } + + tag.fieldNr == 7 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.oneofIndex = decoder.readInt32() + } + + tag.fieldNr == 8 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.packed = decoder.readBool() + } + + tag.fieldNr == 9 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + tag.fieldNr == 10 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.jsonName = decoder.readString() + } + + tag.fieldNr == 11 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.defaultValue = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.FieldInternal.computeSize(): Int { + var __result = 0 + if (com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN != kind) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(kind.number)) + } + + if (com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_UNKNOWN != cardinality) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(cardinality.number)) + } + + if (number != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(number)) + } + + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (typeUrl.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(typeUrl).let { kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (oneofIndex != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(7, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(oneofIndex)) + } + + if (packed != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(8, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(packed)) + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(9, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (jsonName.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(jsonName).let { kotlinx.rpc.protobuf.internal.WireSize.tag(10, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (defaultValue.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(defaultValue).let { kotlinx.rpc.protobuf.internal.WireSize.tag(11, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Field.asInternal(): com.google.protobuf.kotlin.FieldInternal { + return this as? com.google.protobuf.kotlin.FieldInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + sourceContext.asInternal().checkRequiredFields() + } + + enumvalue.forEach { + it.asInternal().checkRequiredFields() + } + + options.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (enumvalue.isNotEmpty()) { + enumvalue.forEach { + encoder.writeMessage(fieldNr = 2, value = it.asInternal()) { encodeWith(it) } + } + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 3, value = it.asInternal()) { encodeWith(it) } + } + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 4, value = sourceContext.asInternal()) { encodeWith(it) } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + encoder.writeEnum(fieldNr = 5, value = syntax.number) + } + + if (edition.isNotEmpty()) { + encoder.writeString(fieldNr = 6, value = edition) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.EnumValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.EnumValueInternal::decodeWith) + (msg.enumvalue as MutableList).add(elem) + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + tag.fieldNr == 4 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.sourceContext = com.google.protobuf.kotlin.SourceContextInternal() + } + + decoder.readMessage(msg.sourceContext.asInternal(), com.google.protobuf.kotlin.SourceContextInternal::decodeWith) + } + + tag.fieldNr == 5 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.syntax = com.google.protobuf.kotlin.Syntax.fromNumber(decoder.readEnum()) + } + + tag.fieldNr == 6 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.edition = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.EnumInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (enumvalue.isNotEmpty()) { + __result = enumvalue.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + if (presenceMask[0]) { + __result += sourceContext.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(4, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 != syntax) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(5, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(syntax.number)) + } + + if (edition.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(edition).let { kotlinx.rpc.protobuf.internal.WireSize.tag(6, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Enum.asInternal(): com.google.protobuf.kotlin.EnumInternal { + return this as? com.google.protobuf.kotlin.EnumInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumValueInternal.checkRequiredFields() { + // no required fields to check + options.forEach { + it.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (number != 0) { + encoder.writeInt32(fieldNr = 2, value = number) + } + + if (options.isNotEmpty()) { + options.forEach { + encoder.writeMessage(fieldNr = 3, value = it.asInternal()) { encodeWith(it) } + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.number = decoder.readInt32() + } + + tag.fieldNr == 3 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + val elem = com.google.protobuf.kotlin.OptionInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.OptionInternal::decodeWith) + (msg.options as MutableList).add(elem) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.EnumValueInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (number != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(number)) + } + + if (options.isNotEmpty()) { + __result = options.sumOf { it.asInternal()._size + kotlinx.rpc.protobuf.internal.WireSize.tag(3, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.EnumValue.asInternal(): com.google.protobuf.kotlin.EnumValueInternal { + return this as? com.google.protobuf.kotlin.EnumValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.OptionInternal.checkRequiredFields() { + // no required fields to check + if (presenceMask[0]) { + value.asInternal().checkRequiredFields() + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.OptionInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (name.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = name) + } + + if (presenceMask[0]) { + encoder.writeMessage(fieldNr = 2, value = value.asInternal()) { encodeWith(it) } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.OptionInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.OptionInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.name = decoder.readString() + } + + tag.fieldNr == 2 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + if (!msg.presenceMask[0]) { + msg.value = com.google.protobuf.kotlin.AnyInternal() + } + + decoder.readMessage(msg.value.asInternal(), com.google.protobuf.kotlin.AnyInternal::decodeWith) + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.OptionInternal.computeSize(): Int { + var __result = 0 + if (name.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(name).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + if (presenceMask[0]) { + __result += value.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(2, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Option.asInternal(): com.google.protobuf.kotlin.OptionInternal { + return this as? com.google.protobuf.kotlin.OptionInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Syntax.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Syntax { + return when (number) { + 0 -> { + com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 + } + + 1 -> { + com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO3 + } + + 2 -> { + com.google.protobuf.kotlin.Syntax.SYNTAX_EDITIONS + } + + else -> { + com.google.protobuf.kotlin.Syntax.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Field.Kind.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Kind { + return when (number) { + 0 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN + } + + 1 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_DOUBLE + } + + 2 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_FLOAT + } + + 3 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_INT64 + } + + 4 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_UINT64 + } + + 5 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_INT32 + } + + 6 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_FIXED64 + } + + 7 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_FIXED32 + } + + 8 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_BOOL + } + + 9 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_STRING + } + + 10 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_GROUP + } + + 11 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_MESSAGE + } + + 12 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_BYTES + } + + 13 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_UINT32 + } + + 14 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_ENUM + } + + 15 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_SFIXED32 + } + + 16 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_SFIXED64 + } + + 17 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_SINT32 + } + + 18 -> { + com.google.protobuf.kotlin.Field.Kind.TYPE_SINT64 + } + + else -> { + com.google.protobuf.kotlin.Field.Kind.UNRECOGNIZED(number) + } + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Field.Cardinality.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Cardinality { + return when (number) { + 0 -> { + com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_UNKNOWN + } + + 1 -> { + com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_OPTIONAL + } + + 2 -> { + com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_REQUIRED + } + + 3 -> { + com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_REPEATED + } + + else -> { + com.google.protobuf.kotlin.Field.Cardinality.UNRECOGNIZED(number) + } + } +} + diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt new file mode 100644 index 000000000..222bee21c --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt @@ -0,0 +1,754 @@ +@file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) +package com.google.protobuf.kotlin + +import kotlinx.rpc.internal.utils.* +import kotlinx.rpc.protobuf.input.stream.asInputStream +import kotlinx.rpc.protobuf.internal.* + +public class DoubleValueInternal: com.google.protobuf.kotlin.DoubleValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: Double by MsgFieldDelegate { 0.0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.DoubleValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.DoubleValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.DoubleValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.DoubleValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class FloatValueInternal: com.google.protobuf.kotlin.FloatValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: Float by MsgFieldDelegate { 0.0f } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.FloatValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.FloatValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.FloatValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.FloatValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class Int64ValueInternal: com.google.protobuf.kotlin.Int64Value, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Int64Value): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Int64Value { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.Int64ValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.Int64ValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class UInt64ValueInternal: com.google.protobuf.kotlin.UInt64Value, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: ULong by MsgFieldDelegate { 0uL } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.UInt64Value): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.UInt64Value { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.UInt64ValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.UInt64ValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class Int32ValueInternal: com.google.protobuf.kotlin.Int32Value, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.Int32Value): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.Int32Value { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.Int32ValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.Int32ValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class UInt32ValueInternal: com.google.protobuf.kotlin.UInt32Value, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: UInt by MsgFieldDelegate { 0u } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.UInt32Value): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.UInt32Value { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.UInt32ValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.UInt32ValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class BoolValueInternal: com.google.protobuf.kotlin.BoolValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: Boolean by MsgFieldDelegate { false } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.BoolValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.BoolValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.BoolValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.BoolValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class StringValueInternal: com.google.protobuf.kotlin.StringValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.StringValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.StringValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.StringValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.StringValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public class BytesValueInternal: com.google.protobuf.kotlin.BytesValue, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi + public override val _size: Int by lazy { computeSize() } + + public override var value: ByteArray by MsgFieldDelegate { byteArrayOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { + public override fun encode(value: com.google.protobuf.kotlin.BytesValue): kotlinx.rpc.protobuf.input.stream.InputStream { + val buffer = kotlinx.io.Buffer() + val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) + kotlinx.rpc.protobuf.internal.checkForPlatformEncodeException { + value.asInternal().encodeWith(encoder) + } + encoder.flush() + return buffer.asInputStream() + } + + public override fun decode(stream: kotlinx.rpc.protobuf.input.stream.InputStream): com.google.protobuf.kotlin.BytesValue { + kotlinx.rpc.protobuf.internal.WireDecoder(stream).use { + val msg = com.google.protobuf.kotlin.BytesValueInternal() + kotlinx.rpc.protobuf.internal.checkForPlatformDecodeException { + com.google.protobuf.kotlin.BytesValueInternal.decodeWith(msg, it) + } + msg.checkRequiredFields() + return msg + } + } + } + + @kotlinx.rpc.internal.utils.InternalRpcApi + public companion object +} + +public operator fun com.google.protobuf.kotlin.DoubleValue.Companion.invoke(body: com.google.protobuf.kotlin.DoubleValueInternal.() -> Unit): com.google.protobuf.kotlin.DoubleValue { + val msg = com.google.protobuf.kotlin.DoubleValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.FloatValue.Companion.invoke(body: com.google.protobuf.kotlin.FloatValueInternal.() -> Unit): com.google.protobuf.kotlin.FloatValue { + val msg = com.google.protobuf.kotlin.FloatValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Int64Value.Companion.invoke(body: com.google.protobuf.kotlin.Int64ValueInternal.() -> Unit): com.google.protobuf.kotlin.Int64Value { + val msg = com.google.protobuf.kotlin.Int64ValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.UInt64Value.Companion.invoke(body: com.google.protobuf.kotlin.UInt64ValueInternal.() -> Unit): com.google.protobuf.kotlin.UInt64Value { + val msg = com.google.protobuf.kotlin.UInt64ValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.Int32Value.Companion.invoke(body: com.google.protobuf.kotlin.Int32ValueInternal.() -> Unit): com.google.protobuf.kotlin.Int32Value { + val msg = com.google.protobuf.kotlin.Int32ValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.UInt32Value.Companion.invoke(body: com.google.protobuf.kotlin.UInt32ValueInternal.() -> Unit): com.google.protobuf.kotlin.UInt32Value { + val msg = com.google.protobuf.kotlin.UInt32ValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.BoolValue.Companion.invoke(body: com.google.protobuf.kotlin.BoolValueInternal.() -> Unit): com.google.protobuf.kotlin.BoolValue { + val msg = com.google.protobuf.kotlin.BoolValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.StringValue.Companion.invoke(body: com.google.protobuf.kotlin.StringValueInternal.() -> Unit): com.google.protobuf.kotlin.StringValue { + val msg = com.google.protobuf.kotlin.StringValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +public operator fun com.google.protobuf.kotlin.BytesValue.Companion.invoke(body: com.google.protobuf.kotlin.BytesValueInternal.() -> Unit): com.google.protobuf.kotlin.BytesValue { + val msg = com.google.protobuf.kotlin.BytesValueInternal().apply(body) + msg.checkRequiredFields() + return msg +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DoubleValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DoubleValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0.0) { + encoder.writeDouble(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DoubleValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DoubleValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED64 -> { + msg.value = decoder.readDouble() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.DoubleValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0.0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED64) + kotlinx.rpc.protobuf.internal.WireSize.double(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.DoubleValue.asInternal(): com.google.protobuf.kotlin.DoubleValueInternal { + return this as? com.google.protobuf.kotlin.DoubleValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FloatValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FloatValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0.0f) { + encoder.writeFloat(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FloatValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FloatValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.FIXED32 -> { + msg.value = decoder.readFloat() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.FloatValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0.0f) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.FIXED32) + kotlinx.rpc.protobuf.internal.WireSize.float(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.FloatValue.asInternal(): com.google.protobuf.kotlin.FloatValueInternal { + return this as? com.google.protobuf.kotlin.FloatValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int64ValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0L) { + encoder.writeInt64(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.Int64ValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0L) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int64Value.asInternal(): com.google.protobuf.kotlin.Int64ValueInternal { + return this as? com.google.protobuf.kotlin.Int64ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt64ValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0uL) { + encoder.writeUInt64(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt64() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.UInt64ValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0uL) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt64(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt64Value.asInternal(): com.google.protobuf.kotlin.UInt64ValueInternal { + return this as? com.google.protobuf.kotlin.UInt64ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int32ValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0) { + encoder.writeInt32(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.Int32ValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.Int32Value.asInternal(): com.google.protobuf.kotlin.Int32ValueInternal { + return this as? com.google.protobuf.kotlin.Int32ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt32ValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != 0u) { + encoder.writeUInt32(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readUInt32() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.UInt32ValueInternal.computeSize(): Int { + var __result = 0 + if (value != 0u) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.uInt32(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.UInt32Value.asInternal(): com.google.protobuf.kotlin.UInt32ValueInternal { + return this as? com.google.protobuf.kotlin.UInt32ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BoolValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BoolValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value != false) { + encoder.writeBool(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BoolValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BoolValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { + msg.value = decoder.readBool() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.BoolValueInternal.computeSize(): Int { + var __result = 0 + if (value != false) { + __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.bool(value)) + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BoolValue.asInternal(): com.google.protobuf.kotlin.BoolValueInternal { + return this as? com.google.protobuf.kotlin.BoolValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StringValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StringValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value.isNotEmpty()) { + encoder.writeString(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StringValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StringValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readString() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.StringValueInternal.computeSize(): Int { + var __result = 0 + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.string(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.StringValue.asInternal(): com.google.protobuf.kotlin.StringValueInternal { + return this as? com.google.protobuf.kotlin.StringValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BytesValueInternal.checkRequiredFields() { + // no required fields to check +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BytesValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { + if (value.isNotEmpty()) { + encoder.writeBytes(fieldNr = 1, value = value) + } +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BytesValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BytesValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { + while (true) { + val tag = decoder.readTag() ?: break // EOF, we read the whole message + when { + tag.fieldNr == 1 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { + msg.value = decoder.readBytes() + } + + else -> { + // we are currently just skipping unknown fields (KRPC-191) + decoder.skipValue(tag.wireType) + } + } + } +} + +private fun com.google.protobuf.kotlin.BytesValueInternal.computeSize(): Int { + var __result = 0 + if (value.isNotEmpty()) { + __result += kotlinx.rpc.protobuf.internal.WireSize.bytes(value).let { kotlinx.rpc.protobuf.internal.WireSize.tag(1, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + } + + return __result +} + +@kotlinx.rpc.internal.utils.InternalRpcApi +internal fun com.google.protobuf.kotlin.BytesValue.asInternal(): com.google.protobuf.kotlin.BytesValueInternal { + return this as? com.google.protobuf.kotlin.BytesValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") +} + diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt new file mode 100644 index 000000000..1020e592c --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt @@ -0,0 +1,15 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package com.google.protobuf.kotlin + +import kotlin.time.Duration.Companion.nanoseconds +import kotlin.time.Duration.Companion.seconds + +public fun Duration.toKotlinDuration(): kotlin.time.Duration = seconds.seconds + nanos.nanoseconds + +public fun kotlin.time.Duration.toProtobufDuration(): Duration = Duration { + seconds = this@toProtobufDuration.inWholeSeconds + nanos = (this@toProtobufDuration.inWholeNanoseconds - seconds.seconds.inWholeNanoseconds).toInt() +} diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt new file mode 100644 index 000000000..b930ebf14 --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +@file:OptIn(ExperimentalTime::class) + +package com.google.protobuf.kotlin + +import kotlin.time.ExperimentalTime +import kotlin.time.Instant + +public fun Timestamp.toInstant(): Instant = Instant.fromEpochSeconds(seconds, nanos) + +public fun Instant.toTimestamp(): Timestamp = Timestamp { + seconds = epochSeconds + nanos = nanosecondsOfSecond +} diff --git a/protobuf/protobuf-core/src/commonMain/proto/well-known-types.proto b/protobuf/protobuf-core/src/commonMain/proto/well-known-types.proto new file mode 100644 index 000000000..9bfdb4aec --- /dev/null +++ b/protobuf/protobuf-core/src/commonMain/proto/well-known-types.proto @@ -0,0 +1,34 @@ +edition = "2023"; + +// https://protobuf.dev/reference/protobuf/google.protobuf + +// Any +import "google/protobuf/any.proto"; + +// Api, Method, Mixin +import "google/protobuf/api.proto"; + +// Duration +import "google/protobuf/duration.proto"; + +// Timestamp +import "google/protobuf/timestamp.proto"; + +// Empty +import "google/protobuf/empty.proto"; + +// DoubleValue, FloatValue, Int64Value, UInt64Value, Int32Value, +// UInt32Value, BoolValue, StringValue, BytesValue +import "google/protobuf/wrappers.proto"; + +// Type, Field, Kind, Cardinality, Enum, EnumValue, Option, Syntax +import "google/protobuf/type.proto"; + +// FieldMask +import "google/protobuf/field_mask.proto"; + +// SourceContext +import "google/protobuf/source_context.proto"; + +// Struct, Value, NullValue, ListValue +import "google/protobuf/struct.proto"; diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt index 1ccd0277b..e7d9f4623 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt @@ -22,6 +22,7 @@ const val WITH_CODEC_ANNO = "kotlinx.rpc.grpc.codec.WithCodec" abstract class AModelToKotlinCommonGenerator( protected val model: Model, protected val logger: Logger, + private val explicitApiModeEnabled: Boolean, ) { protected abstract fun CodeGenerator.generatePublicDeclaredEntities(fileDeclaration: FileDeclaration) protected abstract fun CodeGenerator.generateInternalDeclaredEntities(fileDeclaration: FileDeclaration) @@ -50,7 +51,7 @@ abstract class AModelToKotlinCommonGenerator( private fun FileDeclaration.generatePublicKotlinFile(): FileGenerator { currentPackage = packageName - return file(logger = logger) { + return file(logger = logger, explicitApiModeEnabled = explicitApiModeEnabled) { filename = this@generatePublicKotlinFile.name packageName = this@generatePublicKotlinFile.packageName.safeFullName() packagePath = this@generatePublicKotlinFile.packageName.safeFullName() @@ -74,7 +75,7 @@ abstract class AModelToKotlinCommonGenerator( private fun FileDeclaration.generateInternalKotlinFile(): FileGenerator { currentPackage = packageName - return file(logger = logger) { + return file(logger = logger, explicitApiModeEnabled = explicitApiModeEnabled) { filename = this@generateInternalKotlinFile.name packageName = this@generateInternalKotlinFile.packageName.safeFullName() packagePath = diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt index 55c25776b..ef80a99cf 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/CodeGenerator.kt @@ -7,15 +7,16 @@ package kotlinx.rpc.protoc.gen.core import org.slf4j.Logger import org.slf4j.helpers.NOPLogger - open class CodeGenerator( private val indent: String, private val builder: StringBuilder = StringBuilder(), protected val logger: Logger = NOPLogger.NOP_LOGGER, + protected val explicitApiModeEnabled: Boolean, ) { private var isEmpty: Boolean = true private var result: String? = null private var lastIsDeclaration: Boolean = false + private var needsNewLineAfterDeclaration: Boolean = true @Suppress("FunctionName") private fun _append( @@ -27,7 +28,10 @@ open class CodeGenerator( var addedNewLineBefore = false if (lastIsDeclaration) { - builder.appendLine() + if (needsNewLineAfterDeclaration) { + builder.appendLine() + } + lastIsDeclaration = false addedNewLineBefore = true } else if (newLineIfAbsent) { @@ -49,6 +53,7 @@ open class CodeGenerator( } isEmpty = false + needsNewLineAfterDeclaration = true } private fun append(value: String) { @@ -64,7 +69,7 @@ open class CodeGenerator( } private fun withNextIndent(block: CodeGenerator.() -> Unit) { - CodeGenerator("$indent$ONE_INDENT", builder, logger).block() + CodeGenerator("$indent$ONE_INDENT", builder, logger, explicitApiModeEnabled).block() } fun scope( @@ -126,12 +131,18 @@ open class CodeGenerator( block: (CodeGenerator.() -> Unit)? = null, ) { if (block == null) { - newLine() - lastIsDeclaration = true + if (nlAfterClosed) { + newLine() + } + lastIsDeclaration = nlAfterClosed return } - val nested = CodeGenerator("$indent$ONE_INDENT", logger = logger).apply(block) + val nested = CodeGenerator( + indent = "$indent$ONE_INDENT", + logger = logger, + explicitApiModeEnabled = explicitApiModeEnabled, + ).apply(block) if (nested.isEmpty) { newLine() @@ -160,16 +171,38 @@ open class CodeGenerator( name: String, modifiers: String = "", contextReceiver: String = "", - type: String = "", - delegate: Boolean = false, + annotations: List = emptyList(), + type: String, + propertyInitializer: PropertyInitializer = PropertyInitializer.PLAIN, value: String = "", + isVar: Boolean = false, + needsNewLineAfterDeclaration: Boolean = true, block: (CodeGenerator.() -> Unit)? = null, ) { - val modifiersString = if (modifiers.isEmpty()) "" else "$modifiers " + for (annotation in annotations) { + addLine(annotation) + } + + val modifiersString = (if (modifiers.isEmpty()) "" else "$modifiers ").withVisibility() val contextString = if (contextReceiver.isEmpty()) "" else "$contextReceiver." val typeString = if (type.isEmpty()) "" else ": $type" - val delegateString = if (delegate) " by " else " = " - scope("${modifiersString}val $contextString$name$typeString$delegateString$value", block = block) + val initializer = when (propertyInitializer) { + PropertyInitializer.GETTER -> " get() = " + PropertyInitializer.DELEGATE -> " by " + PropertyInitializer.PLAIN -> " = " + }.takeIf { value.isNotEmpty() } ?: "" + val varString = if (isVar) "var" else "val" + + scope( + "${modifiersString}$varString $contextString$name$typeString$initializer$value", + block = block, + ) + + this.needsNewLineAfterDeclaration = needsNewLineAfterDeclaration + } + + enum class PropertyInitializer { + GETTER, DELEGATE, PLAIN; } fun function( @@ -179,15 +212,15 @@ open class CodeGenerator( args: String = "", contextReceiver: String = "", annotations: List = emptyList(), - returnType: String = "", + returnType: String, block: (CodeGenerator.() -> Unit)? = null, ) { for (annotation in annotations) { addLine(annotation) } - val modifiersString = if (modifiers.isEmpty()) "" else "$modifiers " + val modifiersString = (if (modifiers.isEmpty()) "" else "$modifiers ").withVisibility() val contextString = if (contextReceiver.isEmpty()) "" else "$contextReceiver." - val returnTypeString = if (returnType.isEmpty()) "" else ": $returnType" + val returnTypeString = if (returnType.isEmpty() || returnType == "Unit") "" else ": $returnType" val typeParametersString = if (typeParameters.isEmpty()) "" else " <$typeParameters>" scope("${modifiersString}fun$typeParametersString $contextString$name($args)$returnTypeString", block = block) } @@ -251,7 +284,7 @@ open class CodeGenerator( addLine(annotation) } - val modifiersString = if (modifiers.isEmpty()) "" else "$modifiers " + val modifiersString = (if (modifiers.isEmpty()) "" else "$modifiers ").withVisibility() val firstLine = "$modifiersString${declarationType.strValue}${if (name.isNotEmpty()) " " else ""}$name" addLine(firstLine) @@ -263,7 +296,25 @@ open class CodeGenerator( val constructorArgsTransformed = constructorArgs.map { (arg, default) -> val defaultString = default?.let { " = $it" } ?: "" - "$arg$defaultString" + val modifierString = when { + !explicitApiModeEnabled -> "" + + arg.contains("val") || arg.contains("var") -> when { + modifiers.contains("internal") || + modifiers.contains("private") || + arg.contains("private ") || + arg.contains("protected ") || + arg.contains("internal ") || + arg.contains("public ") || + arg.contains("override ") -> "" + + else -> "public " + } + + else -> "" + } + + "$modifierString$arg$defaultString" } val constructorModifiersTransformed = if (constructorModifiers.isEmpty()) "" else @@ -313,6 +364,20 @@ open class CodeGenerator( return result!! } + fun String.withVisibility(): String { + return if (explicitApiModeEnabled) { + when { + contains("public") -> this + contains("protected") -> this + contains("private") -> this + contains("internal") -> this + else -> "public $this" + } + } else { + this + } + } + companion object { private const val ONE_INDENT = " " } @@ -324,7 +389,8 @@ class FileGenerator( var packagePath: String? = packageName, var fileOptIns: List = emptyList(), logger: Logger = NOPLogger.NOP_LOGGER, -) : CodeGenerator("", logger = logger) { + explicitApiModeEnabled: Boolean, +) : CodeGenerator("", logger = logger, explicitApiModeEnabled = explicitApiModeEnabled) { private val imports = mutableListOf() fun importPackage(name: String) { @@ -369,6 +435,13 @@ fun file( name: String? = null, packageName: String? = null, logger: Logger = NOPLogger.NOP_LOGGER, + explicitApiModeEnabled: Boolean, block: FileGenerator.() -> Unit, -): FileGenerator = FileGenerator(name, packageName, packageName, emptyList(), logger) - .apply(block) +): FileGenerator = FileGenerator( + filename = name, + packageName = packageName, + packagePath = packageName, + fileOptIns = emptyList(), + logger = logger, + explicitApiModeEnabled = explicitApiModeEnabled, +).apply(block) diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt index d21513fa6..fa59e88e0 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/ProtocGenPlugin.kt @@ -22,9 +22,11 @@ import java.io.File abstract class ProtocGenPlugin { companion object { private const val DEBUG_OUTPUT_OPTION = "debugOutput" + private const val EXPLICIT_API_MODE_ENABLED_OPTION = "explicitApiModeEnabled" } private var debugOutput: String? = null + private var explicitApiModeEnabled: Boolean = false private val logger: Logger by lazy { val debugOutput = debugOutput ?: return@lazy NOPLogger.NOP_LOGGER @@ -57,6 +59,7 @@ abstract class ProtocGenPlugin { } debugOutput = parameters[DEBUG_OUTPUT_OPTION] + explicitApiModeEnabled = parameters[EXPLICIT_API_MODE_ENABLED_OPTION]?.toBooleanStrictOrNull() ?: false val files = input.runGeneration() .map { file -> @@ -93,8 +96,16 @@ abstract class ProtocGenPlugin { } private fun CodeGeneratorRequest.runGeneration(): List { - return generateKotlinByModel(this.toModel(), logger) + return generateKotlinByModel( + model = this.toModel(), + logger = logger, + explicitApiModeEnabled = explicitApiModeEnabled, + ) } - protected abstract fun generateKotlinByModel(model: Model, logger: Logger): List + protected abstract fun generateKotlinByModel( + model: Model, + logger: Logger, + explicitApiModeEnabled: Boolean, + ): List } diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt index 13ee912ee..adbcaca1c 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/codeRequestToModel.kt @@ -285,11 +285,17 @@ private fun Descriptors.FileDescriptor.kotlinFileName(): String { } private fun Descriptors.FileDescriptor.kotlinPackage(): String { - return if (options.hasJavaPackage()) { + val requestedPackage = if (options.hasJavaPackage()) { options.javaPackage } else { `package` } + + if (requestedPackage == "com.google.protobuf") { + return "com.google.protobuf.kotlin" + } + + return requestedPackage } private fun Descriptors.FileDescriptor.protoFileNameToKotlinName(): String { diff --git a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/GrpcProtocGenPlugin.kt b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/GrpcProtocGenPlugin.kt index 85dcb7274..a42a354ff 100644 --- a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/GrpcProtocGenPlugin.kt +++ b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/GrpcProtocGenPlugin.kt @@ -13,7 +13,8 @@ object GrpcProtocGenPlugin : ProtocGenPlugin() { override fun generateKotlinByModel( model: Model, logger: Logger, + explicitApiModeEnabled: Boolean, ): List { - return ModelToGrpcKotlinCommonGenerator(model, logger).generateKotlinFiles() + return ModelToGrpcKotlinCommonGenerator(model, logger, explicitApiModeEnabled).generateKotlinFiles() } } diff --git a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt index 0177b063e..e7e51a13e 100644 --- a/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt +++ b/protoc-gen/grpc/src/main/kotlin/kotlinx/rpc/protoc/gen/grpc/ModelToGrpcKotlinCommonGenerator.kt @@ -14,7 +14,8 @@ import org.slf4j.Logger class ModelToGrpcKotlinCommonGenerator( model: Model, logger: Logger, -) : AModelToKotlinCommonGenerator(model, logger) { + explicitApiModeEnabled: Boolean, +) : AModelToKotlinCommonGenerator(model, logger, explicitApiModeEnabled) { override val FileDeclaration.hasPublicGeneratedContent: Boolean get() = serviceDeclarations.isNotEmpty() override val FileDeclaration.hasInternalGeneratedContent: Boolean get() = false @@ -30,8 +31,11 @@ class ModelToGrpcKotlinCommonGenerator( @Suppress("detekt.LongMethod") private fun CodeGenerator.generatePublicService(service: ServiceDeclaration) { - code("@kotlinx.rpc.grpc.annotations.Grpc") - clazz(service.name.simpleName, declarationType = CodeGenerator.DeclarationType.Interface) { + clazz( + name = service.name.simpleName, + declarationType = CodeGenerator.DeclarationType.Interface, + annotations = listOf("@kotlinx.rpc.grpc.annotations.Grpc") + ) { service.methods.forEach { method -> val inputType = method.inputType val outputType = method.outputType diff --git a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt index 5d8b1f215..b089b9084 100644 --- a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt +++ b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt @@ -24,7 +24,8 @@ import org.slf4j.Logger class ModelToProtobufKotlinCommonGenerator( model: Model, logger: Logger, -) : AModelToKotlinCommonGenerator(model, logger) { + explicitApiModeEnabled: Boolean, +) : AModelToKotlinCommonGenerator(model, logger, explicitApiModeEnabled) { override val FileDeclaration.hasPublicGeneratedContent: Boolean get() = enumDeclarations.isNotEmpty() || messageDeclarations.isNotEmpty() @@ -63,11 +64,6 @@ class ModelToProtobufKotlinCommonGenerator( } } - - private fun MessageDeclaration.fields() = actualFields.map { - it.transformToFieldDeclaration() to it - } - @Suppress("detekt.CyclomaticComplexMethod") private fun CodeGenerator.generatePublicMessage(declaration: MessageDeclaration) { if (!declaration.isUserFacing) return @@ -77,12 +73,17 @@ class ModelToProtobufKotlinCommonGenerator( declarationType = CodeGenerator.DeclarationType.Interface, annotations = listOf("@$WITH_CODEC_ANNO(${declaration.internalClassFullName()}.CODEC::class)") ) { - declaration.fields().forEach { (fieldDeclaration, _) -> - code("val $fieldDeclaration") - newLine() + declaration.actualFields.forEachIndexed { i, field -> + property( + name = field.name, + type = field.typeFqName(), + needsNewLineAfterDeclaration = i == declaration.actualFields.lastIndex, + ) } - newLine() + if (declaration.actualFields.isNotEmpty()) { + newLine() + } declaration.oneOfDeclarations.forEach { oneOf -> generateOneOfPublic(oneOf) @@ -104,9 +105,6 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generateInternalMessage(declaration: MessageDeclaration) { val internalClassName = declaration.internalClassName() - val annotations = buildList { - add("@$INTERNAL_RPC_API_ANNO") - } val superTypes = buildList { if (declaration.isUserFacing) { add(declaration.name.safeFullName()) @@ -116,35 +114,52 @@ class ModelToProtobufKotlinCommonGenerator( clazz( name = internalClassName, - annotations = annotations, declarationType = CodeGenerator.DeclarationType.Class, superTypes = superTypes, ) { generatePresenceIndicesObject(declaration) - code("override val _size: Int by lazy { computeSize() }") + property( + name = "_size", + modifiers = "override", + annotations = listOf("@$INTERNAL_RPC_API_ANNO"), + type = "Int", + propertyInitializer = CodeGenerator.PropertyInitializer.DELEGATE, + value = "lazy { computeSize() }" + ) - val override = if (declaration.isUserFacing) "override " else "" - declaration.fields().forEach { (fieldDeclaration, field) -> + val override = if (declaration.isUserFacing) "override" else "" + declaration.actualFields.forEachIndexed { i, field -> val value = when { field.nullable -> { - "= null" + "null" } field.type is FieldType.Message -> - "by MsgFieldDelegate(PresenceIndices.${field.name}) { " + + "MsgFieldDelegate(PresenceIndices.${field.name}) { " + "${(field.type as FieldType.Message).dec.value.internalClassFullName()}() " + "}" else -> { - val fieldPresence = if (field.presenceIdx != null) "PresenceIndices.${field.name}" else "" - "by MsgFieldDelegate($fieldPresence) { ${field.type.defaultValue} }" + val fieldPresence = if (field.presenceIdx != null) "(PresenceIndices.${field.name})" else "" + "MsgFieldDelegate$fieldPresence { ${field.type.defaultValue} }" } } - code("$override var $fieldDeclaration $value") - newLine() + property( + name = field.name, + modifiers = override, + value = value, + isVar = true, + type = field.typeFqName(), + propertyInitializer = if (field.nullable) { + CodeGenerator.PropertyInitializer.PLAIN + } else { + CodeGenerator.PropertyInitializer.DELEGATE + }, + needsNewLineAfterDeclaration = i == declaration.actualFields.lastIndex, + ) } declaration.nestedDeclarations.forEach { nested -> @@ -154,7 +169,12 @@ class ModelToProtobufKotlinCommonGenerator( generateCodecObject(declaration) // required for decodeWith extension - code("companion object") + clazz( + name = "", + modifiers = "companion", + annotations = listOf("@$INTERNAL_RPC_API_ANNO"), + declarationType = CodeGenerator.DeclarationType.Object + ) } } @@ -162,11 +182,11 @@ class ModelToProtobufKotlinCommonGenerator( if (declaration.presenceMaskSize == 0) { return } - scope("private object PresenceIndices") { - declaration.fields().forEach { (_, field) -> + + clazz("PresenceIndices", "private", declarationType = CodeGenerator.DeclarationType.Object) { + declaration.actualFields.forEach { field -> if (field.presenceIdx != null) { - code("const val ${field.name} = ${field.presenceIdx}") - newLine() + property(field.name, modifiers = "const", value = field.presenceIdx.toString(), type = "Int") } } } @@ -178,7 +198,12 @@ class ModelToProtobufKotlinCommonGenerator( val msgFqName = declaration.name.safeFullName() val inputStreamFqName = "kotlinx.rpc.protobuf.input.stream.InputStream" val bufferFqName = "kotlinx.io.Buffer" - scope("object CODEC : kotlinx.rpc.grpc.codec.MessageCodec<$msgFqName>") { + clazz( + name = "CODEC", + annotations = listOf("@$INTERNAL_RPC_API_ANNO"), + declarationType = CodeGenerator.DeclarationType.Object, + superTypes = listOf("kotlinx.rpc.grpc.codec.MessageCodec<$msgFqName>"), + ) { function("encode", modifiers = "override", args = "value: $msgFqName", returnType = inputStreamFqName) { code("val buffer = $bufferFqName()") code("val encoder = $PB_PKG.WireEncoder(buffer)") @@ -226,12 +251,13 @@ class ModelToProtobufKotlinCommonGenerator( modifiers = "internal", args = "msg: ${declaration.internalClassFullName()}, decoder: $PB_PKG.WireDecoder", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), - contextReceiver = "${declaration.internalClassFullName()}.Companion" + contextReceiver = "${declaration.internalClassFullName()}.Companion", + returnType = "Unit", ) { whileBlock("true") { code("val tag = decoder.readTag() ?: break // EOF, we read the whole message") whenBlock { - declaration.fields().forEach { (_, field) -> readMatchCase(field) } + declaration.actualFields.forEach { field -> readMatchCase(field) } whenCase("else") { code("// we are currently just skipping unknown fields (KRPC-191)") code("decoder.skipValue(tag.wireType)") @@ -388,13 +414,14 @@ class ModelToProtobufKotlinCommonGenerator( annotations = listOf("@$INTERNAL_RPC_API_ANNO"), args = "encoder: $PB_PKG.WireEncoder", contextReceiver = declaration.internalClassFullName(), + returnType = "Unit", ) { - if (declaration.fields().isEmpty()) { + if (declaration.actualFields.isEmpty()) { code("// no fields to encode") return@function } - declaration.fields().forEach { (_, field) -> + declaration.actualFields.forEach { field -> val fieldName = field.name if (field.nullable) { scope("$fieldName?.also") { @@ -518,6 +545,7 @@ class ModelToProtobufKotlinCommonGenerator( modifiers = "internal", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), contextReceiver = declaration.internalClassFullName(), + returnType = "Unit", ) { val requiredFields = declaration.actualFields.filter { it.dec.isRequired } @@ -765,10 +793,6 @@ class ModelToProtobufKotlinCommonGenerator( is FieldType.Message -> null } - private fun FieldDeclaration.transformToFieldDeclaration(): String { - return "${name}: ${typeFqName()}" - } - private fun CodeGenerator.generateOneOfPublic(declaration: OneOfDeclaration) { val interfaceName = declaration.name.simpleName @@ -818,16 +842,22 @@ class ModelToProtobufKotlinCommonGenerator( clazz("", modifiers = "companion", declarationType = CodeGenerator.DeclarationType.Object) { declaration.aliases.forEach { alias: EnumDeclaration.Alias -> - code( - "val ${alias.name.simpleName}: $className " + - "get() = ${alias.original.name.simpleName}" + property( + name = alias.name.simpleName, + type = className, + propertyInitializer = CodeGenerator.PropertyInitializer.GETTER, + value = alias.original.name.simpleName, ) } val entryNamesSorted = entriesSorted.joinToString(", ") { it.name.simpleName } - code("val entries: List<$className> by lazy { listOf($entryNamesSorted) }") + property( + name = "entries", + type = "List<$className>", + propertyInitializer = CodeGenerator.PropertyInitializer.DELEGATE, + value = "lazy { listOf($entryNamesSorted) }" + ) } - } } } diff --git a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ProtobufProtocGenPlugin.kt b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ProtobufProtocGenPlugin.kt index 813a2516d..9f73e9930 100644 --- a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ProtobufProtocGenPlugin.kt +++ b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ProtobufProtocGenPlugin.kt @@ -13,7 +13,8 @@ object ProtobufProtocGenPlugin : ProtocGenPlugin() { override fun generateKotlinByModel( model: Model, logger: Logger, + explicitApiModeEnabled: Boolean, ): List { - return ModelToProtobufKotlinCommonGenerator(model, logger).generateKotlinFiles() + return ModelToProtobufKotlinCommonGenerator(model, logger, explicitApiModeEnabled).generateKotlinFiles() } } diff --git a/tests/protobuf-conformance/build.gradle.kts b/tests/protobuf-conformance/build.gradle.kts index 5baa1b3f1..97382204e 100644 --- a/tests/protobuf-conformance/build.gradle.kts +++ b/tests/protobuf-conformance/build.gradle.kts @@ -31,7 +31,7 @@ val generatedCodeDir = project.layout.projectDirectory tasks.withType().configureEach { if (name.endsWith("Test")) { - outputDirectory.set(generatedCodeDir) + outputDirectory = generatedCodeDir } } From f00660efd6520cbb9a53db316a535a7bc330bca4 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 14 Aug 2025 12:34:07 +0200 Subject: [PATCH 3/5] Update generator to work with proto3 conformance --- .../protobuf/kotlin/_rpc_internal/Any.kt | 8 +- .../protobuf/kotlin/_rpc_internal/Api.kt | 24 +- .../protobuf/kotlin/_rpc_internal/Duration.kt | 8 +- .../protobuf/kotlin/_rpc_internal/Empty.kt | 8 +- .../kotlin/_rpc_internal/FieldMask.kt | 8 +- .../kotlin/_rpc_internal/SourceContext.kt | 8 +- .../protobuf/kotlin/_rpc_internal/Struct.kt | 34 +- .../kotlin/_rpc_internal/Timestamp.kt | 8 +- .../protobuf/kotlin/_rpc_internal/Type.kt | 46 +- .../protobuf/kotlin/_rpc_internal/Wrappers.kt | 72 +- .../kotlinx/rpc/protobuf/internal/WireSize.kt | 3 + .../gen/core/AModelToKotlinCommonGenerator.kt | 1 + .../ModelToProtobufKotlinCommonGenerator.kt | 48 +- .../conformance/_rpc_internal/Conformance.kt | 110 ++- .../proto3/TestMessagesProto3Editions.kt | 75 +- .../TestMessagesProto3Editions.kt | 895 ++++++++++-------- .../proto3/TestMessagesProto3.kt | 75 +- .../_rpc_internal/TestMessagesProto3.kt | 895 ++++++++++-------- 18 files changed, 1264 insertions(+), 1062 deletions(-) diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt index 5c77b4984..61f9897aa 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt @@ -47,12 +47,12 @@ public operator fun com.google.protobuf.kotlin.Any.Companion.invoke(body: com.go } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.AnyInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.AnyInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.AnyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.AnyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (typeUrl.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = typeUrl) } @@ -63,7 +63,7 @@ internal fun com.google.protobuf.kotlin.AnyInternal.encodeWith(encoder: kotlinx. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.AnyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.AnyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.AnyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.AnyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -97,7 +97,7 @@ private fun com.google.protobuf.kotlin.AnyInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Any.asInternal(): com.google.protobuf.kotlin.AnyInternal { +public fun com.google.protobuf.kotlin.Any.asInternal(): com.google.protobuf.kotlin.AnyInternal { return this as? com.google.protobuf.kotlin.AnyInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt index 73bd6d811..8fd59f481 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt @@ -143,7 +143,7 @@ public operator fun com.google.protobuf.kotlin.Mixin.Companion.invoke(body: com. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ApiInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.ApiInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { sourceContext.asInternal().checkRequiredFields() @@ -163,7 +163,7 @@ internal fun com.google.protobuf.kotlin.ApiInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ApiInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.ApiInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -200,7 +200,7 @@ internal fun com.google.protobuf.kotlin.ApiInternal.encodeWith(encoder: kotlinx. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ApiInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ApiInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -284,12 +284,12 @@ private fun com.google.protobuf.kotlin.ApiInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Api.asInternal(): com.google.protobuf.kotlin.ApiInternal { +public fun com.google.protobuf.kotlin.Api.asInternal(): com.google.protobuf.kotlin.ApiInternal { return this as? com.google.protobuf.kotlin.ApiInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MethodInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.MethodInternal.checkRequiredFields() { // no required fields to check options.forEach { it.asInternal().checkRequiredFields() @@ -297,7 +297,7 @@ internal fun com.google.protobuf.kotlin.MethodInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MethodInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.MethodInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -330,7 +330,7 @@ internal fun com.google.protobuf.kotlin.MethodInternal.encodeWith(encoder: kotli } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MethodInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MethodInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -406,17 +406,17 @@ private fun com.google.protobuf.kotlin.MethodInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Method.asInternal(): com.google.protobuf.kotlin.MethodInternal { +public fun com.google.protobuf.kotlin.Method.asInternal(): com.google.protobuf.kotlin.MethodInternal { return this as? com.google.protobuf.kotlin.MethodInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MixinInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.MixinInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MixinInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.MixinInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -427,7 +427,7 @@ internal fun com.google.protobuf.kotlin.MixinInternal.encodeWith(encoder: kotlin } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MixinInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.MixinInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -461,7 +461,7 @@ private fun com.google.protobuf.kotlin.MixinInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Mixin.asInternal(): com.google.protobuf.kotlin.MixinInternal { +public fun com.google.protobuf.kotlin.Mixin.asInternal(): com.google.protobuf.kotlin.MixinInternal { return this as? com.google.protobuf.kotlin.MixinInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt index 0854939e1..a21fd44ae 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt @@ -47,12 +47,12 @@ public operator fun com.google.protobuf.kotlin.Duration.Companion.invoke(body: c } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DurationInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.DurationInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DurationInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.DurationInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (seconds != 0L) { encoder.writeInt64(fieldNr = 1, value = seconds) } @@ -63,7 +63,7 @@ internal fun com.google.protobuf.kotlin.DurationInternal.encodeWith(encoder: kot } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DurationInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DurationInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.DurationInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DurationInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -97,7 +97,7 @@ private fun com.google.protobuf.kotlin.DurationInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Duration.asInternal(): com.google.protobuf.kotlin.DurationInternal { +public fun com.google.protobuf.kotlin.Duration.asInternal(): com.google.protobuf.kotlin.DurationInternal { return this as? com.google.protobuf.kotlin.DurationInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt index 09a799f72..710388e37 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt @@ -44,17 +44,17 @@ public operator fun com.google.protobuf.kotlin.Empty.Companion.invoke(body: com. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EmptyInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.EmptyInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EmptyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.EmptyInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { // no fields to encode } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EmptyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EmptyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.EmptyInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EmptyInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -72,7 +72,7 @@ private fun com.google.protobuf.kotlin.EmptyInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Empty.asInternal(): com.google.protobuf.kotlin.EmptyInternal { +public fun com.google.protobuf.kotlin.Empty.asInternal(): com.google.protobuf.kotlin.EmptyInternal { return this as? com.google.protobuf.kotlin.EmptyInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt index cd95b2bc8..cb0235951 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt @@ -46,12 +46,12 @@ public operator fun com.google.protobuf.kotlin.FieldMask.Companion.invoke(body: } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldMaskInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.FieldMaskInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldMaskInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.FieldMaskInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (paths.isNotEmpty()) { paths.forEach { encoder.writeString(1, it) @@ -60,7 +60,7 @@ internal fun com.google.protobuf.kotlin.FieldMaskInternal.encodeWith(encoder: ko } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldMaskInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldMaskInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.FieldMaskInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldMaskInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -87,7 +87,7 @@ private fun com.google.protobuf.kotlin.FieldMaskInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldMask.asInternal(): com.google.protobuf.kotlin.FieldMaskInternal { +public fun com.google.protobuf.kotlin.FieldMask.asInternal(): com.google.protobuf.kotlin.FieldMaskInternal { return this as? com.google.protobuf.kotlin.FieldMaskInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt index f3fce414c..4c79763a7 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt @@ -46,19 +46,19 @@ public operator fun com.google.protobuf.kotlin.SourceContext.Companion.invoke(bo } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.SourceContextInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.SourceContextInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.SourceContextInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.SourceContextInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (fileName.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = fileName) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.SourceContextInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.SourceContextInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.SourceContextInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.SourceContextInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -84,7 +84,7 @@ private fun com.google.protobuf.kotlin.SourceContextInternal.computeSize(): Int } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.SourceContext.asInternal(): com.google.protobuf.kotlin.SourceContextInternal { +public fun com.google.protobuf.kotlin.SourceContext.asInternal(): com.google.protobuf.kotlin.SourceContextInternal { return this as? com.google.protobuf.kotlin.SourceContextInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt index 6ab75dd51..b9a7eb645 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt @@ -141,7 +141,7 @@ public operator fun com.google.protobuf.kotlin.ListValue.Companion.invoke(body: } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.StructInternal.checkRequiredFields() { // no required fields to check fields.values.forEach { it.asInternal().checkRequiredFields() @@ -149,7 +149,7 @@ internal fun com.google.protobuf.kotlin.StructInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.StructInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (fields.isNotEmpty()) { fields.forEach { kEntry -> com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal().apply { @@ -164,7 +164,7 @@ internal fun com.google.protobuf.kotlin.StructInternal.encodeWith(encoder: kotli } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.StructInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -199,12 +199,12 @@ private fun com.google.protobuf.kotlin.StructInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Struct.asInternal(): com.google.protobuf.kotlin.StructInternal { +public fun com.google.protobuf.kotlin.Struct.asInternal(): com.google.protobuf.kotlin.StructInternal { return this as? com.google.protobuf.kotlin.StructInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.ValueInternal.checkRequiredFields() { // no required fields to check kind?.also { when { @@ -220,7 +220,7 @@ internal fun com.google.protobuf.kotlin.ValueInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { kind?.also { when (val value = it) { is com.google.protobuf.kotlin.Value.Kind.NullValue -> { @@ -251,7 +251,7 @@ internal fun com.google.protobuf.kotlin.ValueInternal.encodeWith(encoder: kotlin } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -329,12 +329,12 @@ private fun com.google.protobuf.kotlin.ValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Value.asInternal(): com.google.protobuf.kotlin.ValueInternal { +public fun com.google.protobuf.kotlin.Value.asInternal(): com.google.protobuf.kotlin.ValueInternal { return this as? com.google.protobuf.kotlin.ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ListValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.ListValueInternal.checkRequiredFields() { // no required fields to check values.forEach { it.asInternal().checkRequiredFields() @@ -342,7 +342,7 @@ internal fun com.google.protobuf.kotlin.ListValueInternal.checkRequiredFields() } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ListValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.ListValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (values.isNotEmpty()) { values.forEach { encoder.writeMessage(fieldNr = 1, value = it.asInternal()) { encodeWith(it) } @@ -351,7 +351,7 @@ internal fun com.google.protobuf.kotlin.ListValueInternal.encodeWith(encoder: ko } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ListValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ListValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.ListValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.ListValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -379,12 +379,12 @@ private fun com.google.protobuf.kotlin.ListValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.ListValue.asInternal(): com.google.protobuf.kotlin.ListValueInternal { +public fun com.google.protobuf.kotlin.ListValue.asInternal(): com.google.protobuf.kotlin.ListValueInternal { return this as? com.google.protobuf.kotlin.ListValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -392,7 +392,7 @@ internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -403,7 +403,7 @@ internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.encod } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -441,12 +441,12 @@ private fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.comput } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.asInternal(): com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal { +public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.asInternal(): com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.NullValue.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.NullValue { +public fun com.google.protobuf.kotlin.NullValue.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.NullValue { return when (number) { 0 -> { com.google.protobuf.kotlin.NullValue.NULL_VALUE diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt index 27053f95c..c3b2f51ea 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt @@ -47,12 +47,12 @@ public operator fun com.google.protobuf.kotlin.Timestamp.Companion.invoke(body: } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TimestampInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.TimestampInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TimestampInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.TimestampInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (seconds != 0L) { encoder.writeInt64(fieldNr = 1, value = seconds) } @@ -63,7 +63,7 @@ internal fun com.google.protobuf.kotlin.TimestampInternal.encodeWith(encoder: ko } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TimestampInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TimestampInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.TimestampInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TimestampInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -97,7 +97,7 @@ private fun com.google.protobuf.kotlin.TimestampInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Timestamp.asInternal(): com.google.protobuf.kotlin.TimestampInternal { +public fun com.google.protobuf.kotlin.Timestamp.asInternal(): com.google.protobuf.kotlin.TimestampInternal { return this as? com.google.protobuf.kotlin.TimestampInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt index 6887ef660..1b883b0f4 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt @@ -241,7 +241,7 @@ public operator fun com.google.protobuf.kotlin.Option.Companion.invoke(body: com } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TypeInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.TypeInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { sourceContext.asInternal().checkRequiredFields() @@ -257,7 +257,7 @@ internal fun com.google.protobuf.kotlin.TypeInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TypeInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.TypeInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -294,7 +294,7 @@ internal fun com.google.protobuf.kotlin.TypeInternal.encodeWith(encoder: kotlinx } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.TypeInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TypeInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.TypeInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.TypeInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -377,12 +377,12 @@ private fun com.google.protobuf.kotlin.TypeInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Type.asInternal(): com.google.protobuf.kotlin.TypeInternal { +public fun com.google.protobuf.kotlin.Type.asInternal(): com.google.protobuf.kotlin.TypeInternal { return this as? com.google.protobuf.kotlin.TypeInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.FieldInternal.checkRequiredFields() { // no required fields to check options.forEach { it.asInternal().checkRequiredFields() @@ -390,7 +390,7 @@ internal fun com.google.protobuf.kotlin.FieldInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.FieldInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN != kind) { encoder.writeEnum(fieldNr = 1, value = kind.number) } @@ -435,7 +435,7 @@ internal fun com.google.protobuf.kotlin.FieldInternal.encodeWith(encoder: kotlin } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FieldInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.FieldInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FieldInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -535,12 +535,12 @@ private fun com.google.protobuf.kotlin.FieldInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Field.asInternal(): com.google.protobuf.kotlin.FieldInternal { +public fun com.google.protobuf.kotlin.Field.asInternal(): com.google.protobuf.kotlin.FieldInternal { return this as? com.google.protobuf.kotlin.FieldInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.EnumInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { sourceContext.asInternal().checkRequiredFields() @@ -556,7 +556,7 @@ internal fun com.google.protobuf.kotlin.EnumInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.EnumInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -587,7 +587,7 @@ internal fun com.google.protobuf.kotlin.EnumInternal.encodeWith(encoder: kotlinx } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.EnumInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -661,12 +661,12 @@ private fun com.google.protobuf.kotlin.EnumInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Enum.asInternal(): com.google.protobuf.kotlin.EnumInternal { +public fun com.google.protobuf.kotlin.Enum.asInternal(): com.google.protobuf.kotlin.EnumInternal { return this as? com.google.protobuf.kotlin.EnumInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.EnumValueInternal.checkRequiredFields() { // no required fields to check options.forEach { it.asInternal().checkRequiredFields() @@ -674,7 +674,7 @@ internal fun com.google.protobuf.kotlin.EnumValueInternal.checkRequiredFields() } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.EnumValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -691,7 +691,7 @@ internal fun com.google.protobuf.kotlin.EnumValueInternal.encodeWith(encoder: ko } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.EnumValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.EnumValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -735,12 +735,12 @@ private fun com.google.protobuf.kotlin.EnumValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.EnumValue.asInternal(): com.google.protobuf.kotlin.EnumValueInternal { +public fun com.google.protobuf.kotlin.EnumValue.asInternal(): com.google.protobuf.kotlin.EnumValueInternal { return this as? com.google.protobuf.kotlin.EnumValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.OptionInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.OptionInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -748,7 +748,7 @@ internal fun com.google.protobuf.kotlin.OptionInternal.checkRequiredFields() { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.OptionInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.OptionInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -759,7 +759,7 @@ internal fun com.google.protobuf.kotlin.OptionInternal.encodeWith(encoder: kotli } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.OptionInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.OptionInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.OptionInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.OptionInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -797,12 +797,12 @@ private fun com.google.protobuf.kotlin.OptionInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Option.asInternal(): com.google.protobuf.kotlin.OptionInternal { +public fun com.google.protobuf.kotlin.Option.asInternal(): com.google.protobuf.kotlin.OptionInternal { return this as? com.google.protobuf.kotlin.OptionInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Syntax.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Syntax { +public fun com.google.protobuf.kotlin.Syntax.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Syntax { return when (number) { 0 -> { com.google.protobuf.kotlin.Syntax.SYNTAX_PROTO2 @@ -823,7 +823,7 @@ internal fun com.google.protobuf.kotlin.Syntax.Companion.fromNumber(number: Int) } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Field.Kind.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Kind { +public fun com.google.protobuf.kotlin.Field.Kind.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Kind { return when (number) { 0 -> { com.google.protobuf.kotlin.Field.Kind.TYPE_UNKNOWN @@ -908,7 +908,7 @@ internal fun com.google.protobuf.kotlin.Field.Kind.Companion.fromNumber(number: } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Field.Cardinality.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Cardinality { +public fun com.google.protobuf.kotlin.Field.Cardinality.Companion.fromNumber(number: Int): com.google.protobuf.kotlin.Field.Cardinality { return when (number) { 0 -> { com.google.protobuf.kotlin.Field.Cardinality.CARDINALITY_UNKNOWN diff --git a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt index 222bee21c..19f862504 100644 --- a/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt +++ b/protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt @@ -366,19 +366,19 @@ public operator fun com.google.protobuf.kotlin.BytesValue.Companion.invoke(body: } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DoubleValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.DoubleValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DoubleValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.DoubleValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0.0) { encoder.writeDouble(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DoubleValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DoubleValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.DoubleValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.DoubleValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -404,24 +404,24 @@ private fun com.google.protobuf.kotlin.DoubleValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.DoubleValue.asInternal(): com.google.protobuf.kotlin.DoubleValueInternal { +public fun com.google.protobuf.kotlin.DoubleValue.asInternal(): com.google.protobuf.kotlin.DoubleValueInternal { return this as? com.google.protobuf.kotlin.DoubleValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FloatValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.FloatValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FloatValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.FloatValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0.0f) { encoder.writeFloat(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FloatValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FloatValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.FloatValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.FloatValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -447,24 +447,24 @@ private fun com.google.protobuf.kotlin.FloatValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.FloatValue.asInternal(): com.google.protobuf.kotlin.FloatValueInternal { +public fun com.google.protobuf.kotlin.FloatValue.asInternal(): com.google.protobuf.kotlin.FloatValueInternal { return this as? com.google.protobuf.kotlin.FloatValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int64ValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.Int64ValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.Int64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0L) { encoder.writeInt64(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.Int64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -490,24 +490,24 @@ private fun com.google.protobuf.kotlin.Int64ValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int64Value.asInternal(): com.google.protobuf.kotlin.Int64ValueInternal { +public fun com.google.protobuf.kotlin.Int64Value.asInternal(): com.google.protobuf.kotlin.Int64ValueInternal { return this as? com.google.protobuf.kotlin.Int64ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt64ValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.UInt64ValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.UInt64ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0uL) { encoder.writeUInt64(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.UInt64ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt64ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -533,24 +533,24 @@ private fun com.google.protobuf.kotlin.UInt64ValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt64Value.asInternal(): com.google.protobuf.kotlin.UInt64ValueInternal { +public fun com.google.protobuf.kotlin.UInt64Value.asInternal(): com.google.protobuf.kotlin.UInt64ValueInternal { return this as? com.google.protobuf.kotlin.UInt64ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int32ValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.Int32ValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.Int32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0) { encoder.writeInt32(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.Int32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.Int32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -576,24 +576,24 @@ private fun com.google.protobuf.kotlin.Int32ValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.Int32Value.asInternal(): com.google.protobuf.kotlin.Int32ValueInternal { +public fun com.google.protobuf.kotlin.Int32Value.asInternal(): com.google.protobuf.kotlin.Int32ValueInternal { return this as? com.google.protobuf.kotlin.Int32ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt32ValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.UInt32ValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.UInt32ValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != 0u) { encoder.writeUInt32(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.UInt32ValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.UInt32ValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -619,24 +619,24 @@ private fun com.google.protobuf.kotlin.UInt32ValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.UInt32Value.asInternal(): com.google.protobuf.kotlin.UInt32ValueInternal { +public fun com.google.protobuf.kotlin.UInt32Value.asInternal(): com.google.protobuf.kotlin.UInt32ValueInternal { return this as? com.google.protobuf.kotlin.UInt32ValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BoolValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.BoolValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BoolValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.BoolValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value != false) { encoder.writeBool(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BoolValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BoolValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.BoolValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BoolValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -662,24 +662,24 @@ private fun com.google.protobuf.kotlin.BoolValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BoolValue.asInternal(): com.google.protobuf.kotlin.BoolValueInternal { +public fun com.google.protobuf.kotlin.BoolValue.asInternal(): com.google.protobuf.kotlin.BoolValueInternal { return this as? com.google.protobuf.kotlin.BoolValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StringValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.StringValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StringValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.StringValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StringValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StringValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.StringValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.StringValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -705,24 +705,24 @@ private fun com.google.protobuf.kotlin.StringValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.StringValue.asInternal(): com.google.protobuf.kotlin.StringValueInternal { +public fun com.google.protobuf.kotlin.StringValue.asInternal(): com.google.protobuf.kotlin.StringValueInternal { return this as? com.google.protobuf.kotlin.StringValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BytesValueInternal.checkRequiredFields() { +public fun com.google.protobuf.kotlin.BytesValueInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BytesValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +public fun com.google.protobuf.kotlin.BytesValueInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (value.isNotEmpty()) { encoder.writeBytes(fieldNr = 1, value = value) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BytesValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BytesValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +public fun com.google.protobuf.kotlin.BytesValueInternal.Companion.decodeWith(msg: com.google.protobuf.kotlin.BytesValueInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -748,7 +748,7 @@ private fun com.google.protobuf.kotlin.BytesValueInternal.computeSize(): Int { } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.kotlin.BytesValue.asInternal(): com.google.protobuf.kotlin.BytesValueInternal { +public fun com.google.protobuf.kotlin.BytesValue.asInternal(): com.google.protobuf.kotlin.BytesValueInternal { return this as? com.google.protobuf.kotlin.BytesValueInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireSize.kt b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireSize.kt index c1193697a..d20491cf1 100644 --- a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireSize.kt +++ b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireSize.kt @@ -102,3 +102,6 @@ public fun WireSize.packedSFixed32(value: List): Int = value.size * 32 @InternalRpcApi public fun WireSize.packedSFixed64(value: List): Int = value.size * 64 + +@InternalRpcApi +public fun WireSize.packedBool(value: List): Int = packedSInt32(value.map { if (it) 1 else 0 }) diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt index e7d9f4623..7ad517f14 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/AModelToKotlinCommonGenerator.kt @@ -4,6 +4,7 @@ package kotlinx.rpc.protoc.gen.core +import kotlinx.rpc.protoc.gen.core.model.EnumDeclaration import kotlinx.rpc.protoc.gen.core.model.FieldDeclaration import kotlinx.rpc.protoc.gen.core.model.FieldType import kotlinx.rpc.protoc.gen.core.model.FileDeclaration diff --git a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt index b089b9084..4755dcdd1 100644 --- a/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt +++ b/protoc-gen/protobuf/src/main/kotlin/kotlinx/rpc/protoc/gen/ModelToProtobufKotlinCommonGenerator.kt @@ -20,6 +20,7 @@ import kotlinx.rpc.protoc.gen.core.model.Model import kotlinx.rpc.protoc.gen.core.model.OneOfDeclaration import kotlinx.rpc.protoc.gen.core.model.WireType import org.slf4j.Logger +import kotlin.collections.map class ModelToProtobufKotlinCommonGenerator( model: Model, @@ -184,9 +185,15 @@ class ModelToProtobufKotlinCommonGenerator( } clazz("PresenceIndices", "private", declarationType = CodeGenerator.DeclarationType.Object) { - declaration.actualFields.forEach { field -> + declaration.actualFields.forEachIndexed { i, field -> if (field.presenceIdx != null) { - property(field.name, modifiers = "const", value = field.presenceIdx.toString(), type = "Int") + property( + field.name, + modifiers = "const", + value = field.presenceIdx.toString(), + type = "Int", + needsNewLineAfterDeclaration = i == declaration.actualFields.lastIndex, + ) } } } @@ -248,7 +255,6 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generateMessageDecoder(declaration: MessageDeclaration) = function( name = "decodeWith", - modifiers = "internal", args = "msg: ${declaration.internalClassFullName()}, decoder: $PB_PKG.WireDecoder", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), contextReceiver = "${declaration.internalClassFullName()}.Companion", @@ -358,7 +364,13 @@ class ModelToProtobufKotlinCommonGenerator( } is FieldType.List -> if (isPacked) { - code("$lvalue = decoder.readPacked${fieldType.value.decodeEncodeFuncName()}()") + val conversion = if (fieldType.value is FieldType.Enum){ + ".map { ${(fieldType.value as FieldType.Enum).dec.name.safeFullName()}.fromNumber(it) }" + } else { + "" + } + + code("$lvalue = decoder.readPacked${fieldType.value.decodeEncodeFuncName()}()$conversion") } else { when (val elemType = fieldType.value) { is FieldType.Message -> { @@ -410,7 +422,6 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generateMessageEncoder(declaration: MessageDeclaration) = function( name = "encodeWith", - modifiers = "internal", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), args = "encoder: $PB_PKG.WireEncoder", contextReceiver = declaration.internalClassFullName(), @@ -461,14 +472,20 @@ class ModelToProtobufKotlinCommonGenerator( when (type) { is FieldType.IntegralType -> code("encoder.write${encFunc!!}(fieldNr = $number, value = $valueVar)") is FieldType.List -> { + val packedValueVar = if (type.value is FieldType.Enum) { + "$valueVar.map { it.number }" + } else { + valueVar + } + encFunc = type.value.decodeEncodeFuncName() when { isPacked && packedWithFixedSize -> - code("encoder.writePacked${encFunc!!}(fieldNr = $number, value = $valueVar)") + code("encoder.writePacked${encFunc!!}(fieldNr = $number, value = $packedValueVar)") isPacked && !packedWithFixedSize -> code( - "encoder.writePacked${encFunc!!}(fieldNr = $number, value = $valueVar, fieldSize = ${ + "encoder.writePacked${encFunc!!}(fieldNr = $number, value = $packedValueVar, fieldSize = ${ type.valueSizeCall(valueVar, number, true) })" ) @@ -480,7 +497,8 @@ class ModelToProtobufKotlinCommonGenerator( else -> { require(encFunc != null) { "No encode function for list type: $type" } scope("$valueVar.forEach") { - code("encoder.write${encFunc}($number, it)") + val enumSuffix = if (type.value is FieldType.Enum) ".number" else "" + code("encoder.write${encFunc}($number, it$enumSuffix)") } } } @@ -517,8 +535,7 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generateInternalEnumConstructor(enum: EnumDeclaration) { function( - "fromNumber", - modifiers = "internal", + name = "fromNumber", args = "number: Int", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), contextReceiver = "${enum.name.safeFullName()}.Companion", @@ -542,7 +559,6 @@ class ModelToProtobufKotlinCommonGenerator( */ private fun CodeGenerator.generateRequiredCheck(declaration: MessageDeclaration) = function( name = "checkRequiredFields", - modifiers = "internal", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), contextReceiver = declaration.internalClassFullName(), returnType = "Unit", @@ -643,7 +659,6 @@ class ModelToProtobufKotlinCommonGenerator( // to avoid edge-cases when generating other code that uses the asInternal() extension. function( "asInternal", - modifiers = "internal", annotations = listOf("@$INTERNAL_RPC_API_ANNO"), contextReceiver = ctxReceiver, returnType = internalClassName, @@ -723,7 +738,14 @@ class ModelToProtobufKotlinCommonGenerator( private fun FieldType.valueSizeCall(variable: String, number: Int, isPacked: Boolean = false): String { val sizeFunName = decodeEncodeFuncName()?.replaceFirstChar { it.lowercase() } - val sizeFunc = "$PB_PKG.WireSize.$sizeFunName($variable)" + + val convertedVariable = if (isPacked && this is FieldType.List && value is FieldType.Enum) { + "${variable}.map { it.number }" + } else { + variable + } + + val sizeFunc = "$PB_PKG.WireSize.$sizeFunName($convertedVariable)" return when (this) { is FieldType.IntegralType -> sizeFunc diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt index 527deece2..944dec0b7 100644 --- a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt @@ -5,13 +5,16 @@ import kotlinx.rpc.internal.utils.* import kotlinx.rpc.protobuf.input.stream.asInputStream import kotlinx.rpc.protobuf.internal.* -@kotlinx.rpc.internal.utils.InternalRpcApi class TestStatusInternal: com.google.protobuf.conformance.TestStatus, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var name: String by MsgFieldDelegate() { "" } - override var failureMessage: String by MsgFieldDelegate() { "" } - override var matchedName: String by MsgFieldDelegate() { "" } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var name: String by MsgFieldDelegate { "" } + override var failureMessage: String by MsgFieldDelegate { "" } + override var matchedName: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf.conformance.TestStatus): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -34,14 +37,18 @@ class TestStatusInternal: com.google.protobuf.conformance.TestStatus, kotlinx.rp } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class FailureSetInternal: com.google.protobuf.conformance.FailureSet, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var test: List by MsgFieldDelegate() { mutableListOf() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var test: List by MsgFieldDelegate { mutableListOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf.conformance.FailureSet): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -64,23 +71,27 @@ class FailureSetInternal: com.google.protobuf.conformance.FailureSet, kotlinx.rp } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class ConformanceRequestInternal: com.google.protobuf.conformance.ConformanceRequest, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val jspbEncodingOptions = 0 + const val jspbEncodingOptions: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var requestedOutputFormat: com.google.protobuf.conformance.WireFormat by MsgFieldDelegate() { com.google.protobuf.conformance.WireFormat.UNSPECIFIED } - override var messageType: String by MsgFieldDelegate() { "" } - override var testCategory: com.google.protobuf.conformance.TestCategory by MsgFieldDelegate() { com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST } - override var jspbEncodingOptions: com.google.protobuf.conformance.JspbEncodingConfig by MsgFieldDelegate(PresenceIndices.jspbEncodingOptions) { com.google.protobuf.conformance.JspbEncodingConfigInternal() } - override var printUnknownFields: Boolean by MsgFieldDelegate() { false } - override var payload: com.google.protobuf.conformance.ConformanceRequest.Payload? = null - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var requestedOutputFormat: com.google.protobuf.conformance.WireFormat by MsgFieldDelegate { com.google.protobuf.conformance.WireFormat.UNSPECIFIED } + override var messageType: String by MsgFieldDelegate { "" } + override var testCategory: com.google.protobuf.conformance.TestCategory by MsgFieldDelegate { com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST } + override var jspbEncodingOptions: com.google.protobuf.conformance.JspbEncodingConfig by MsgFieldDelegate(PresenceIndices.jspbEncodingOptions) { com.google.protobuf.conformance.JspbEncodingConfigInternal() } + override var printUnknownFields: Boolean by MsgFieldDelegate { false } + override var payload: com.google.protobuf.conformance.ConformanceRequest.Payload? = null + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf.conformance.ConformanceRequest): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -103,14 +114,18 @@ class ConformanceRequestInternal: com.google.protobuf.conformance.ConformanceReq } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class ConformanceResponseInternal: com.google.protobuf.conformance.ConformanceResponse, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var result: com.google.protobuf.conformance.ConformanceResponse.Result? = null - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var result: com.google.protobuf.conformance.ConformanceResponse.Result? = null + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf.conformance.ConformanceResponse): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -133,14 +148,18 @@ class ConformanceResponseInternal: com.google.protobuf.conformance.ConformanceRe } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class JspbEncodingConfigInternal: com.google.protobuf.conformance.JspbEncodingConfig, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var useJspbArrayAnyFormat: Boolean by MsgFieldDelegate() { false } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var useJspbArrayAnyFormat: Boolean by MsgFieldDelegate { false } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf.conformance.JspbEncodingConfig): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -163,6 +182,7 @@ class JspbEncodingConfigInternal: com.google.protobuf.conformance.JspbEncodingCo } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } @@ -197,12 +217,12 @@ operator fun com.google.protobuf.conformance.JspbEncodingConfig.Companion.invoke } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.TestStatusInternal.checkRequiredFields() { +fun com.google.protobuf.conformance.TestStatusInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.TestStatusInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf.conformance.TestStatusInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (name.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = name) } @@ -217,7 +237,7 @@ internal fun com.google.protobuf.conformance.TestStatusInternal.encodeWith(encod } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.TestStatusInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.TestStatusInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf.conformance.TestStatusInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.TestStatusInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -259,12 +279,12 @@ private fun com.google.protobuf.conformance.TestStatusInternal.computeSize(): In } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.TestStatus.asInternal(): com.google.protobuf.conformance.TestStatusInternal { +fun com.google.protobuf.conformance.TestStatus.asInternal(): com.google.protobuf.conformance.TestStatusInternal { return this as? com.google.protobuf.conformance.TestStatusInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.FailureSetInternal.checkRequiredFields() { +fun com.google.protobuf.conformance.FailureSetInternal.checkRequiredFields() { // no required fields to check test.forEach { it.asInternal().checkRequiredFields() @@ -272,7 +292,7 @@ internal fun com.google.protobuf.conformance.FailureSetInternal.checkRequiredFie } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.FailureSetInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf.conformance.FailureSetInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (test.isNotEmpty()) { test.forEach { encoder.writeMessage(fieldNr = 2, value = it.asInternal()) { encodeWith(it) } @@ -281,7 +301,7 @@ internal fun com.google.protobuf.conformance.FailureSetInternal.encodeWith(encod } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.FailureSetInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.FailureSetInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf.conformance.FailureSetInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.FailureSetInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -309,12 +329,12 @@ private fun com.google.protobuf.conformance.FailureSetInternal.computeSize(): In } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.FailureSet.asInternal(): com.google.protobuf.conformance.FailureSetInternal { +fun com.google.protobuf.conformance.FailureSet.asInternal(): com.google.protobuf.conformance.FailureSetInternal { return this as? com.google.protobuf.conformance.FailureSetInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceRequestInternal.checkRequiredFields() { +fun com.google.protobuf.conformance.ConformanceRequestInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { jspbEncodingOptions.asInternal().checkRequiredFields() @@ -322,7 +342,7 @@ internal fun com.google.protobuf.conformance.ConformanceRequestInternal.checkReq } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceRequestInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf.conformance.ConformanceRequestInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (com.google.protobuf.conformance.WireFormat.UNSPECIFIED != requestedOutputFormat) { encoder.writeEnum(fieldNr = 3, value = requestedOutputFormat.number) } @@ -365,7 +385,7 @@ internal fun com.google.protobuf.conformance.ConformanceRequestInternal.encodeWi } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceRequestInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceRequestInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf.conformance.ConformanceRequestInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceRequestInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -463,17 +483,17 @@ private fun com.google.protobuf.conformance.ConformanceRequestInternal.computeSi } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceRequest.asInternal(): com.google.protobuf.conformance.ConformanceRequestInternal { +fun com.google.protobuf.conformance.ConformanceRequest.asInternal(): com.google.protobuf.conformance.ConformanceRequestInternal { return this as? com.google.protobuf.conformance.ConformanceRequestInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceResponseInternal.checkRequiredFields() { +fun com.google.protobuf.conformance.ConformanceResponseInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceResponseInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf.conformance.ConformanceResponseInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { result?.also { when (val value = it) { is com.google.protobuf.conformance.ConformanceResponse.Result.ParseError -> { @@ -516,7 +536,7 @@ internal fun com.google.protobuf.conformance.ConformanceResponseInternal.encodeW } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceResponseInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceResponseInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf.conformance.ConformanceResponseInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.ConformanceResponseInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -610,24 +630,24 @@ private fun com.google.protobuf.conformance.ConformanceResponseInternal.computeS } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.ConformanceResponse.asInternal(): com.google.protobuf.conformance.ConformanceResponseInternal { +fun com.google.protobuf.conformance.ConformanceResponse.asInternal(): com.google.protobuf.conformance.ConformanceResponseInternal { return this as? com.google.protobuf.conformance.ConformanceResponseInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.checkRequiredFields() { +fun com.google.protobuf.conformance.JspbEncodingConfigInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf.conformance.JspbEncodingConfigInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (useJspbArrayAnyFormat != false) { encoder.writeBool(fieldNr = 1, value = useJspbArrayAnyFormat) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.JspbEncodingConfigInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.JspbEncodingConfigInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf.conformance.JspbEncodingConfigInternal.Companion.decodeWith(msg: com.google.protobuf.conformance.JspbEncodingConfigInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -653,12 +673,12 @@ private fun com.google.protobuf.conformance.JspbEncodingConfigInternal.computeSi } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.JspbEncodingConfig.asInternal(): com.google.protobuf.conformance.JspbEncodingConfigInternal { +fun com.google.protobuf.conformance.JspbEncodingConfig.asInternal(): com.google.protobuf.conformance.JspbEncodingConfigInternal { return this as? com.google.protobuf.conformance.JspbEncodingConfigInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.WireFormat.Companion.fromNumber(number: Int): com.google.protobuf.conformance.WireFormat { +fun com.google.protobuf.conformance.WireFormat.Companion.fromNumber(number: Int): com.google.protobuf.conformance.WireFormat { return when (number) { 0 -> { com.google.protobuf.conformance.WireFormat.UNSPECIFIED @@ -687,7 +707,7 @@ internal fun com.google.protobuf.conformance.WireFormat.Companion.fromNumber(num } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf.conformance.TestCategory.Companion.fromNumber(number: Int): com.google.protobuf.conformance.TestCategory { +fun com.google.protobuf.conformance.TestCategory.Companion.fromNumber(number: Int): com.google.protobuf.conformance.TestCategory { return when (number) { 0 -> { com.google.protobuf.conformance.TestCategory.UNSPECIFIED_TEST diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt index 555f22469..7298f4a98 100644 --- a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt @@ -1,7 +1,7 @@ @file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) package com.google.protobuf_test_messages.editions.proto3 -import com.google.protobuf.* +import com.google.protobuf.kotlin.* import kotlin.jvm.JvmInline import kotlinx.rpc.internal.utils.* @@ -98,38 +98,38 @@ interface TestAllTypesProto3 { val mapStringForeignMessage: Map val mapStringNestedEnum: Map val mapStringForeignEnum: Map - val optionalBoolWrapper: com.google.protobuf.BoolValue - val optionalInt32Wrapper: com.google.protobuf.Int32Value - val optionalInt64Wrapper: com.google.protobuf.Int64Value - val optionalUint32Wrapper: com.google.protobuf.UInt32Value - val optionalUint64Wrapper: com.google.protobuf.UInt64Value - val optionalFloatWrapper: com.google.protobuf.FloatValue - val optionalDoubleWrapper: com.google.protobuf.DoubleValue - val optionalStringWrapper: com.google.protobuf.StringValue - val optionalBytesWrapper: com.google.protobuf.BytesValue - val repeatedBoolWrapper: List - val repeatedInt32Wrapper: List - val repeatedInt64Wrapper: List - val repeatedUint32Wrapper: List - val repeatedUint64Wrapper: List - val repeatedFloatWrapper: List - val repeatedDoubleWrapper: List - val repeatedStringWrapper: List - val repeatedBytesWrapper: List - val optionalDuration: com.google.protobuf.Duration - val optionalTimestamp: com.google.protobuf.Timestamp - val optionalFieldMask: com.google.protobuf.FieldMask - val optionalStruct: com.google.protobuf.Struct - val optionalAny: com.google.protobuf.Any - val optionalValue: com.google.protobuf.Value - val optionalNullValue: com.google.protobuf.NullValue - val repeatedDuration: List - val repeatedTimestamp: List - val repeatedFieldmask: List - val repeatedStruct: List - val repeatedAny: List - val repeatedValue: List - val repeatedListValue: List + val optionalBoolWrapper: com.google.protobuf.kotlin.BoolValue + val optionalInt32Wrapper: com.google.protobuf.kotlin.Int32Value + val optionalInt64Wrapper: com.google.protobuf.kotlin.Int64Value + val optionalUint32Wrapper: com.google.protobuf.kotlin.UInt32Value + val optionalUint64Wrapper: com.google.protobuf.kotlin.UInt64Value + val optionalFloatWrapper: com.google.protobuf.kotlin.FloatValue + val optionalDoubleWrapper: com.google.protobuf.kotlin.DoubleValue + val optionalStringWrapper: com.google.protobuf.kotlin.StringValue + val optionalBytesWrapper: com.google.protobuf.kotlin.BytesValue + val repeatedBoolWrapper: List + val repeatedInt32Wrapper: List + val repeatedInt64Wrapper: List + val repeatedUint32Wrapper: List + val repeatedUint64Wrapper: List + val repeatedFloatWrapper: List + val repeatedDoubleWrapper: List + val repeatedStringWrapper: List + val repeatedBytesWrapper: List + val optionalDuration: com.google.protobuf.kotlin.Duration + val optionalTimestamp: com.google.protobuf.kotlin.Timestamp + val optionalFieldMask: com.google.protobuf.kotlin.FieldMask + val optionalStruct: com.google.protobuf.kotlin.Struct + val optionalAny: com.google.protobuf.kotlin.Any + val optionalValue: com.google.protobuf.kotlin.Value + val optionalNullValue: com.google.protobuf.kotlin.NullValue + val repeatedDuration: List + val repeatedTimestamp: List + val repeatedFieldmask: List + val repeatedStruct: List + val repeatedAny: List + val repeatedValue: List + val repeatedListValue: List val fieldname1: Int val fieldName2: Int val FieldName3: Int @@ -183,7 +183,9 @@ interface TestAllTypesProto3 { ): OneofField @JvmInline - value class OneofNullValue(val value: com.google.protobuf.NullValue): OneofField + value class OneofNullValue( + val value: com.google.protobuf.kotlin.NullValue, + ): OneofField } @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.CODEC::class) @@ -221,8 +223,11 @@ interface TestAllTypesProto3 { companion object { val MOO: AliasedEnum get() = ALIAS_BAZ + val moo: AliasedEnum get() = ALIAS_BAZ + val bAz: AliasedEnum get() = ALIAS_BAZ + val entries: List by lazy { listOf(ALIAS_FOO, ALIAS_BAR, ALIAS_BAZ) } } } @@ -239,13 +244,11 @@ interface ForeignMessage { @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.CODEC::class) interface NullHypothesisProto3 { - companion object } @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.CODEC::class) interface EnumOnlyProto3 { - sealed class Bool(open val number: Int) { object kFalse: Bool(number = 0) diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt index 7614fc00b..f6c06b031 100644 --- a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt @@ -1,187 +1,192 @@ @file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) package com.google.protobuf_test_messages.editions.proto3 -import com.google.protobuf.* +import com.google.protobuf.kotlin.* import kotlinx.rpc.internal.utils.* import kotlinx.rpc.protobuf.input.stream.asInputStream import kotlinx.rpc.protobuf.internal.* -@kotlinx.rpc.internal.utils.InternalRpcApi class TestAllTypesProto3Internal: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 18) { private object PresenceIndices { - const val optionalNestedMessage = 0 - const val optionalForeignMessage = 1 - const val recursiveMessage = 2 - const val optionalBoolWrapper = 3 - const val optionalInt32Wrapper = 4 - const val optionalInt64Wrapper = 5 - const val optionalUint32Wrapper = 6 - const val optionalUint64Wrapper = 7 - const val optionalFloatWrapper = 8 - const val optionalDoubleWrapper = 9 - const val optionalStringWrapper = 10 - const val optionalBytesWrapper = 11 - const val optionalDuration = 12 - const val optionalTimestamp = 13 - const val optionalFieldMask = 14 - const val optionalStruct = 15 - const val optionalAny = 16 - const val optionalValue = 17 + const val optionalNestedMessage: Int = 0 + const val optionalForeignMessage: Int = 1 + const val recursiveMessage: Int = 2 + const val optionalBoolWrapper: Int = 3 + const val optionalInt32Wrapper: Int = 4 + const val optionalInt64Wrapper: Int = 5 + const val optionalUint32Wrapper: Int = 6 + const val optionalUint64Wrapper: Int = 7 + const val optionalFloatWrapper: Int = 8 + const val optionalDoubleWrapper: Int = 9 + const val optionalStringWrapper: Int = 10 + const val optionalBytesWrapper: Int = 11 + const val optionalDuration: Int = 12 + const val optionalTimestamp: Int = 13 + const val optionalFieldMask: Int = 14 + const val optionalStruct: Int = 15 + const val optionalAny: Int = 16 + const val optionalValue: Int = 17 } - override val _size: Int by lazy { computeSize() } - override var optionalInt32: Int by MsgFieldDelegate() { 0 } - override var optionalInt64: Long by MsgFieldDelegate() { 0L } - override var optionalUint32: UInt by MsgFieldDelegate() { 0u } - override var optionalUint64: ULong by MsgFieldDelegate() { 0uL } - override var optionalSint32: Int by MsgFieldDelegate() { 0 } - override var optionalSint64: Long by MsgFieldDelegate() { 0L } - override var optionalFixed32: UInt by MsgFieldDelegate() { 0u } - override var optionalFixed64: ULong by MsgFieldDelegate() { 0uL } - override var optionalSfixed32: Int by MsgFieldDelegate() { 0 } - override var optionalSfixed64: Long by MsgFieldDelegate() { 0L } - override var optionalFloat: Float by MsgFieldDelegate() { 0.0f } - override var optionalDouble: Double by MsgFieldDelegate() { 0.0 } - override var optionalBool: Boolean by MsgFieldDelegate() { false } - override var optionalString: String by MsgFieldDelegate() { "" } - override var optionalBytes: ByteArray by MsgFieldDelegate() { byteArrayOf() } - override var optionalNestedMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } - override var optionalForeignMessage: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } - override var optionalNestedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } - override var optionalForeignEnum: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } - override var optionalAliasedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } - override var optionalStringPiece: String by MsgFieldDelegate() { "" } - override var optionalCord: String by MsgFieldDelegate() { "" } - override var recursiveMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } - override var repeatedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBool: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedString: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBytes: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedNestedMessage: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedForeignMessage: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedForeignEnum: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStringPiece: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedCord: List by MsgFieldDelegate() { mutableListOf() } - override var packedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var packedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var packedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var packedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var packedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var packedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var packedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var packedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var packedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var packedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var packedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var packedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var packedBool: List by MsgFieldDelegate() { mutableListOf() } - override var packedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedBool: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var mapInt32Int32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt64Int64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapUint32Uint32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapUint64Uint64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSint32Sint32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSint64Sint64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapFixed32Fixed32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapFixed64Fixed64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSfixed32Sfixed32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSfixed64Sfixed64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt32Float: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt32Double: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapBoolBool: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringString: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringBytes: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringNestedMessage: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringForeignMessage: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringNestedEnum: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringForeignEnum: Map by MsgFieldDelegate() { mutableMapOf() } - override var optionalBoolWrapper: com.google.protobuf.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.BoolValueInternal() } - override var optionalInt32Wrapper: com.google.protobuf.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.Int32ValueInternal() } - override var optionalInt64Wrapper: com.google.protobuf.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.Int64ValueInternal() } - override var optionalUint32Wrapper: com.google.protobuf.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.UInt32ValueInternal() } - override var optionalUint64Wrapper: com.google.protobuf.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.UInt64ValueInternal() } - override var optionalFloatWrapper: com.google.protobuf.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.FloatValueInternal() } - override var optionalDoubleWrapper: com.google.protobuf.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.DoubleValueInternal() } - override var optionalStringWrapper: com.google.protobuf.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.StringValueInternal() } - override var optionalBytesWrapper: com.google.protobuf.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.BytesValueInternal() } - override var repeatedBoolWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt32Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt64Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint32Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint64Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFloatWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedDoubleWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStringWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBytesWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var optionalDuration: com.google.protobuf.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.DurationInternal() } - override var optionalTimestamp: com.google.protobuf.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.TimestampInternal() } - override var optionalFieldMask: com.google.protobuf.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.FieldMaskInternal() } - override var optionalStruct: com.google.protobuf.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.StructInternal() } - override var optionalAny: com.google.protobuf.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.AnyInternal() } - override var optionalValue: com.google.protobuf.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.ValueInternal() } - override var optionalNullValue: com.google.protobuf.NullValue by MsgFieldDelegate() { com.google.protobuf.NullValue.NULL_VALUE } - override var repeatedDuration: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedTimestamp: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFieldmask: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStruct: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedAny: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedValue: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedListValue: List by MsgFieldDelegate() { mutableListOf() } - override var fieldname1: Int by MsgFieldDelegate() { 0 } - override var fieldName2: Int by MsgFieldDelegate() { 0 } - override var FieldName3: Int by MsgFieldDelegate() { 0 } - override var field_Name4_: Int by MsgFieldDelegate() { 0 } - override var field0name5: Int by MsgFieldDelegate() { 0 } - override var field_0Name6: Int by MsgFieldDelegate() { 0 } - override var fieldName7: Int by MsgFieldDelegate() { 0 } - override var FieldName8: Int by MsgFieldDelegate() { 0 } - override var field_Name9: Int by MsgFieldDelegate() { 0 } - override var Field_Name10: Int by MsgFieldDelegate() { 0 } - override var FIELD_NAME11: Int by MsgFieldDelegate() { 0 } - override var FIELDName12: Int by MsgFieldDelegate() { 0 } - override var _FieldName13: Int by MsgFieldDelegate() { 0 } - override var __FieldName14: Int by MsgFieldDelegate() { 0 } - override var field_Name15: Int by MsgFieldDelegate() { 0 } - override var field__Name16: Int by MsgFieldDelegate() { 0 } - override var fieldName17__: Int by MsgFieldDelegate() { 0 } - override var FieldName18__: Int by MsgFieldDelegate() { 0 } - override var oneofField: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField? = null @kotlinx.rpc.internal.utils.InternalRpcApi + override val _size: Int by lazy { computeSize() } + + override var optionalInt32: Int by MsgFieldDelegate { 0 } + override var optionalInt64: Long by MsgFieldDelegate { 0L } + override var optionalUint32: UInt by MsgFieldDelegate { 0u } + override var optionalUint64: ULong by MsgFieldDelegate { 0uL } + override var optionalSint32: Int by MsgFieldDelegate { 0 } + override var optionalSint64: Long by MsgFieldDelegate { 0L } + override var optionalFixed32: UInt by MsgFieldDelegate { 0u } + override var optionalFixed64: ULong by MsgFieldDelegate { 0uL } + override var optionalSfixed32: Int by MsgFieldDelegate { 0 } + override var optionalSfixed64: Long by MsgFieldDelegate { 0L } + override var optionalFloat: Float by MsgFieldDelegate { 0.0f } + override var optionalDouble: Double by MsgFieldDelegate { 0.0 } + override var optionalBool: Boolean by MsgFieldDelegate { false } + override var optionalString: String by MsgFieldDelegate { "" } + override var optionalBytes: ByteArray by MsgFieldDelegate { byteArrayOf() } + override var optionalNestedMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + override var optionalForeignMessage: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } + override var optionalNestedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } + override var optionalForeignEnum: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } + override var optionalAliasedEnum: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } + override var optionalStringPiece: String by MsgFieldDelegate { "" } + override var optionalCord: String by MsgFieldDelegate { "" } + override var recursiveMessage: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } + override var repeatedInt32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSint32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSint64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFloat: List by MsgFieldDelegate { mutableListOf() } + override var repeatedDouble: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBool: List by MsgFieldDelegate { mutableListOf() } + override var repeatedString: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBytes: List by MsgFieldDelegate { mutableListOf() } + override var repeatedNestedMessage: List by MsgFieldDelegate { mutableListOf() } + override var repeatedForeignMessage: List by MsgFieldDelegate { mutableListOf() } + override var repeatedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var repeatedForeignEnum: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStringPiece: List by MsgFieldDelegate { mutableListOf() } + override var repeatedCord: List by MsgFieldDelegate { mutableListOf() } + override var packedInt32: List by MsgFieldDelegate { mutableListOf() } + override var packedInt64: List by MsgFieldDelegate { mutableListOf() } + override var packedUint32: List by MsgFieldDelegate { mutableListOf() } + override var packedUint64: List by MsgFieldDelegate { mutableListOf() } + override var packedSint32: List by MsgFieldDelegate { mutableListOf() } + override var packedSint64: List by MsgFieldDelegate { mutableListOf() } + override var packedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var packedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var packedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var packedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var packedFloat: List by MsgFieldDelegate { mutableListOf() } + override var packedDouble: List by MsgFieldDelegate { mutableListOf() } + override var packedBool: List by MsgFieldDelegate { mutableListOf() } + override var packedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var unpackedInt32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedInt64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedUint32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedUint64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSint32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSint64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFloat: List by MsgFieldDelegate { mutableListOf() } + override var unpackedDouble: List by MsgFieldDelegate { mutableListOf() } + override var unpackedBool: List by MsgFieldDelegate { mutableListOf() } + override var unpackedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var mapInt32Int32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt64Int64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapUint32Uint32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapUint64Uint64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSint32Sint32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSint64Sint64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapFixed32Fixed32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapFixed64Fixed64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSfixed32Sfixed32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSfixed64Sfixed64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt32Float: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt32Double: Map by MsgFieldDelegate { mutableMapOf() } + override var mapBoolBool: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringString: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringBytes: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringNestedMessage: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringForeignMessage: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringNestedEnum: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringForeignEnum: Map by MsgFieldDelegate { mutableMapOf() } + override var optionalBoolWrapper: com.google.protobuf.kotlin.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.kotlin.BoolValueInternal() } + override var optionalInt32Wrapper: com.google.protobuf.kotlin.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.kotlin.Int32ValueInternal() } + override var optionalInt64Wrapper: com.google.protobuf.kotlin.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.kotlin.Int64ValueInternal() } + override var optionalUint32Wrapper: com.google.protobuf.kotlin.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.kotlin.UInt32ValueInternal() } + override var optionalUint64Wrapper: com.google.protobuf.kotlin.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.kotlin.UInt64ValueInternal() } + override var optionalFloatWrapper: com.google.protobuf.kotlin.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.kotlin.FloatValueInternal() } + override var optionalDoubleWrapper: com.google.protobuf.kotlin.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.kotlin.DoubleValueInternal() } + override var optionalStringWrapper: com.google.protobuf.kotlin.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.kotlin.StringValueInternal() } + override var optionalBytesWrapper: com.google.protobuf.kotlin.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.kotlin.BytesValueInternal() } + override var repeatedBoolWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt32Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt64Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint32Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint64Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFloatWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedDoubleWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStringWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBytesWrapper: List by MsgFieldDelegate { mutableListOf() } + override var optionalDuration: com.google.protobuf.kotlin.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.kotlin.DurationInternal() } + override var optionalTimestamp: com.google.protobuf.kotlin.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.kotlin.TimestampInternal() } + override var optionalFieldMask: com.google.protobuf.kotlin.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.kotlin.FieldMaskInternal() } + override var optionalStruct: com.google.protobuf.kotlin.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.kotlin.StructInternal() } + override var optionalAny: com.google.protobuf.kotlin.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.kotlin.AnyInternal() } + override var optionalValue: com.google.protobuf.kotlin.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.kotlin.ValueInternal() } + override var optionalNullValue: com.google.protobuf.kotlin.NullValue by MsgFieldDelegate { com.google.protobuf.kotlin.NullValue.NULL_VALUE } + override var repeatedDuration: List by MsgFieldDelegate { mutableListOf() } + override var repeatedTimestamp: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFieldmask: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStruct: List by MsgFieldDelegate { mutableListOf() } + override var repeatedAny: List by MsgFieldDelegate { mutableListOf() } + override var repeatedValue: List by MsgFieldDelegate { mutableListOf() } + override var repeatedListValue: List by MsgFieldDelegate { mutableListOf() } + override var fieldname1: Int by MsgFieldDelegate { 0 } + override var fieldName2: Int by MsgFieldDelegate { 0 } + override var FieldName3: Int by MsgFieldDelegate { 0 } + override var field_Name4_: Int by MsgFieldDelegate { 0 } + override var field0name5: Int by MsgFieldDelegate { 0 } + override var field_0Name6: Int by MsgFieldDelegate { 0 } + override var fieldName7: Int by MsgFieldDelegate { 0 } + override var FieldName8: Int by MsgFieldDelegate { 0 } + override var field_Name9: Int by MsgFieldDelegate { 0 } + override var Field_Name10: Int by MsgFieldDelegate { 0 } + override var FIELD_NAME11: Int by MsgFieldDelegate { 0 } + override var FIELDName12: Int by MsgFieldDelegate { 0 } + override var _FieldName13: Int by MsgFieldDelegate { 0 } + override var __FieldName14: Int by MsgFieldDelegate { 0 } + override var field_Name15: Int by MsgFieldDelegate { 0 } + override var field__Name16: Int by MsgFieldDelegate { 0 } + override var fieldName17__: Int by MsgFieldDelegate { 0 } + override var FieldName18__: Int by MsgFieldDelegate { 0 } + override var oneofField: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField? = null + class NestedMessageInternal: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val corecursive = 0 + const val corecursive: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var a: Int by MsgFieldDelegate() { 0 } - override var corecursive: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var a: Int by MsgFieldDelegate { 0 } + override var corecursive: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -204,170 +209,229 @@ class TestAllTypesProto3Internal: com.google.protobuf_test_messages.editions.pro } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32Int32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt64Int64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapUint32Uint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: UInt by MsgFieldDelegate() { 0u } - var value: UInt by MsgFieldDelegate() { 0u } + + var key: UInt by MsgFieldDelegate { 0u } + var value: UInt by MsgFieldDelegate { 0u } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapUint64Uint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: ULong by MsgFieldDelegate() { 0uL } - var value: ULong by MsgFieldDelegate() { 0uL } + + var key: ULong by MsgFieldDelegate { 0uL } + var value: ULong by MsgFieldDelegate { 0uL } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSint32Sint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSint64Sint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapFixed32Fixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: UInt by MsgFieldDelegate() { 0u } - var value: UInt by MsgFieldDelegate() { 0u } + + var key: UInt by MsgFieldDelegate { 0u } + var value: UInt by MsgFieldDelegate { 0u } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapFixed64Fixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: ULong by MsgFieldDelegate() { 0uL } - var value: ULong by MsgFieldDelegate() { 0uL } + + var key: ULong by MsgFieldDelegate { 0uL } + var value: ULong by MsgFieldDelegate { 0uL } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSfixed32Sfixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSfixed64Sfixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32FloatEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Float by MsgFieldDelegate() { 0.0f } + + var key: Int by MsgFieldDelegate { 0 } + var value: Float by MsgFieldDelegate { 0.0f } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32DoubleEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Double by MsgFieldDelegate() { 0.0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Double by MsgFieldDelegate { 0.0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapBoolBoolEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Boolean by MsgFieldDelegate() { false } - var value: Boolean by MsgFieldDelegate() { false } + + var key: Boolean by MsgFieldDelegate { false } + var value: Boolean by MsgFieldDelegate { false } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringStringEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: String by MsgFieldDelegate() { "" } + + var key: String by MsgFieldDelegate { "" } + var value: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringBytesEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: ByteArray by MsgFieldDelegate() { byteArrayOf() } + + var key: String by MsgFieldDelegate { "" } + var value: ByteArray by MsgFieldDelegate { byteArrayOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringNestedMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val value = 0 + const val value: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringForeignMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val value = 0 + const val value: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.editions.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringNestedEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.NEG } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringForeignEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.editions.proto3.ForeignEnum by MsgFieldDelegate { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -390,14 +454,18 @@ class TestAllTypesProto3Internal: com.google.protobuf_test_messages.editions.pro } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class ForeignMessageInternal: com.google.protobuf_test_messages.editions.proto3.ForeignMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var c: Int by MsgFieldDelegate() { 0 } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var c: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.editions.proto3.ForeignMessage): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -420,13 +488,16 @@ class ForeignMessageInternal: com.google.protobuf_test_messages.editions.proto3. } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class NullHypothesisProto3Internal: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -449,13 +520,16 @@ class NullHypothesisProto3Internal: com.google.protobuf_test_messages.editions.p } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class EnumOnlyProto3Internal: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -478,6 +552,7 @@ class EnumOnlyProto3Internal: com.google.protobuf_test_messages.editions.proto3. } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } @@ -512,7 +587,7 @@ operator fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { optionalNestedMessage.asInternal().checkRequiredFields() @@ -676,7 +751,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (optionalInt32 != 0) { encoder.writeInt32(fieldNr = 1, value = optionalInt32) } @@ -846,11 +921,11 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } if (repeatedNestedEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum)) + encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum.map { it.number })) } if (repeatedForeignEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum)) + encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum.map { it.number })) } if (repeatedStringPiece.isNotEmpty()) { @@ -918,7 +993,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } if (packedNestedEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum)) + encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum.map { it.number })) } if (unpackedInt32.isNotEmpty()) { @@ -1001,7 +1076,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto if (unpackedNestedEnum.isNotEmpty()) { unpackedNestedEnum.forEach { - encoder.writeEnum(102, it) + encoder.writeEnum(102, it.number) } } @@ -1347,7 +1422,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto encoder.writeMessage(fieldNr = 306, value = optionalValue.asInternal()) { encodeWith(it) } } - if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + if (com.google.protobuf.kotlin.NullValue.NULL_VALUE != optionalNullValue) { encoder.writeEnum(fieldNr = 307, value = optionalNullValue.number) } @@ -1511,7 +1586,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -1694,11 +1769,11 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } tag.fieldNr == 51 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.repeatedNestedEnum = decoder.readPackedEnum() + msg.repeatedNestedEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(it) } } tag.fieldNr == 52 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.repeatedForeignEnum = decoder.readPackedEnum() + msg.repeatedForeignEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.fromNumber(it) } } tag.fieldNr == 54 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { @@ -1764,7 +1839,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } tag.fieldNr == 88 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.packedNestedEnum = decoder.readPackedEnum() + msg.packedNestedEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.fromNumber(it) } } tag.fieldNr == 89 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { @@ -1972,221 +2047,221 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto tag.fieldNr == 201 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[3]) { - msg.optionalBoolWrapper = com.google.protobuf.BoolValueInternal() + msg.optionalBoolWrapper = com.google.protobuf.kotlin.BoolValueInternal() } - decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.kotlin.BoolValueInternal::decodeWith) } tag.fieldNr == 202 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[4]) { - msg.optionalInt32Wrapper = com.google.protobuf.Int32ValueInternal() + msg.optionalInt32Wrapper = com.google.protobuf.kotlin.Int32ValueInternal() } - decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.kotlin.Int32ValueInternal::decodeWith) } tag.fieldNr == 203 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[5]) { - msg.optionalInt64Wrapper = com.google.protobuf.Int64ValueInternal() + msg.optionalInt64Wrapper = com.google.protobuf.kotlin.Int64ValueInternal() } - decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.kotlin.Int64ValueInternal::decodeWith) } tag.fieldNr == 204 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[6]) { - msg.optionalUint32Wrapper = com.google.protobuf.UInt32ValueInternal() + msg.optionalUint32Wrapper = com.google.protobuf.kotlin.UInt32ValueInternal() } - decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.kotlin.UInt32ValueInternal::decodeWith) } tag.fieldNr == 205 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[7]) { - msg.optionalUint64Wrapper = com.google.protobuf.UInt64ValueInternal() + msg.optionalUint64Wrapper = com.google.protobuf.kotlin.UInt64ValueInternal() } - decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.kotlin.UInt64ValueInternal::decodeWith) } tag.fieldNr == 206 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[8]) { - msg.optionalFloatWrapper = com.google.protobuf.FloatValueInternal() + msg.optionalFloatWrapper = com.google.protobuf.kotlin.FloatValueInternal() } - decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.kotlin.FloatValueInternal::decodeWith) } tag.fieldNr == 207 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[9]) { - msg.optionalDoubleWrapper = com.google.protobuf.DoubleValueInternal() + msg.optionalDoubleWrapper = com.google.protobuf.kotlin.DoubleValueInternal() } - decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.kotlin.DoubleValueInternal::decodeWith) } tag.fieldNr == 208 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[10]) { - msg.optionalStringWrapper = com.google.protobuf.StringValueInternal() + msg.optionalStringWrapper = com.google.protobuf.kotlin.StringValueInternal() } - decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.kotlin.StringValueInternal::decodeWith) } tag.fieldNr == 209 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[11]) { - msg.optionalBytesWrapper = com.google.protobuf.BytesValueInternal() + msg.optionalBytesWrapper = com.google.protobuf.kotlin.BytesValueInternal() } - decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.kotlin.BytesValueInternal::decodeWith) } tag.fieldNr == 211 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.BoolValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.BoolValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.BoolValueInternal::decodeWith) (msg.repeatedBoolWrapper as MutableList).add(elem) } tag.fieldNr == 212 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.Int32ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.Int32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.Int32ValueInternal::decodeWith) (msg.repeatedInt32Wrapper as MutableList).add(elem) } tag.fieldNr == 213 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.Int64ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.Int64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.Int64ValueInternal::decodeWith) (msg.repeatedInt64Wrapper as MutableList).add(elem) } tag.fieldNr == 214 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.UInt32ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.UInt32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.UInt32ValueInternal::decodeWith) (msg.repeatedUint32Wrapper as MutableList).add(elem) } tag.fieldNr == 215 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.UInt64ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.UInt64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.UInt64ValueInternal::decodeWith) (msg.repeatedUint64Wrapper as MutableList).add(elem) } tag.fieldNr == 216 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.FloatValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.FloatValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.FloatValueInternal::decodeWith) (msg.repeatedFloatWrapper as MutableList).add(elem) } tag.fieldNr == 217 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.DoubleValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.DoubleValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.DoubleValueInternal::decodeWith) (msg.repeatedDoubleWrapper as MutableList).add(elem) } tag.fieldNr == 218 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.StringValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.StringValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.StringValueInternal::decodeWith) (msg.repeatedStringWrapper as MutableList).add(elem) } tag.fieldNr == 219 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.BytesValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.BytesValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.BytesValueInternal::decodeWith) (msg.repeatedBytesWrapper as MutableList).add(elem) } tag.fieldNr == 301 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[12]) { - msg.optionalDuration = com.google.protobuf.DurationInternal() + msg.optionalDuration = com.google.protobuf.kotlin.DurationInternal() } - decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.kotlin.DurationInternal::decodeWith) } tag.fieldNr == 302 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[13]) { - msg.optionalTimestamp = com.google.protobuf.TimestampInternal() + msg.optionalTimestamp = com.google.protobuf.kotlin.TimestampInternal() } - decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.kotlin.TimestampInternal::decodeWith) } tag.fieldNr == 303 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[14]) { - msg.optionalFieldMask = com.google.protobuf.FieldMaskInternal() + msg.optionalFieldMask = com.google.protobuf.kotlin.FieldMaskInternal() } - decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.kotlin.FieldMaskInternal::decodeWith) } tag.fieldNr == 304 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[15]) { - msg.optionalStruct = com.google.protobuf.StructInternal() + msg.optionalStruct = com.google.protobuf.kotlin.StructInternal() } - decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.StructInternal::decodeWith) + decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.kotlin.StructInternal::decodeWith) } tag.fieldNr == 305 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[16]) { - msg.optionalAny = com.google.protobuf.AnyInternal() + msg.optionalAny = com.google.protobuf.kotlin.AnyInternal() } - decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.kotlin.AnyInternal::decodeWith) } tag.fieldNr == 306 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[17]) { - msg.optionalValue = com.google.protobuf.ValueInternal() + msg.optionalValue = com.google.protobuf.kotlin.ValueInternal() } - decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) } tag.fieldNr == 307 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { - msg.optionalNullValue = com.google.protobuf.NullValue.fromNumber(decoder.readEnum()) + msg.optionalNullValue = com.google.protobuf.kotlin.NullValue.fromNumber(decoder.readEnum()) } tag.fieldNr == 311 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.DurationInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + val elem = com.google.protobuf.kotlin.DurationInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.DurationInternal::decodeWith) (msg.repeatedDuration as MutableList).add(elem) } tag.fieldNr == 312 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.TimestampInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + val elem = com.google.protobuf.kotlin.TimestampInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.TimestampInternal::decodeWith) (msg.repeatedTimestamp as MutableList).add(elem) } tag.fieldNr == 313 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.FieldMaskInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + val elem = com.google.protobuf.kotlin.FieldMaskInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.FieldMaskInternal::decodeWith) (msg.repeatedFieldmask as MutableList).add(elem) } tag.fieldNr == 324 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.StructInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.StructInternal::decodeWith) + val elem = com.google.protobuf.kotlin.StructInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.StructInternal::decodeWith) (msg.repeatedStruct as MutableList).add(elem) } tag.fieldNr == 315 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.AnyInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + val elem = com.google.protobuf.kotlin.AnyInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.AnyInternal::decodeWith) (msg.repeatedAny as MutableList).add(elem) } tag.fieldNr == 316 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) (msg.repeatedValue as MutableList).add(elem) } tag.fieldNr == 317 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.ListValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.ListValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.ListValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.ListValueInternal::decodeWith) (msg.repeatedListValue as MutableList).add(elem) } @@ -2303,7 +2378,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } tag.fieldNr == 120 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { - msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.NullValue.fromNumber(decoder.readEnum())) + msg.oneofField = com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.kotlin.NullValue.fromNumber(decoder.readEnum())) } else -> { @@ -2477,11 +2552,11 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } if (repeatedNestedEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (repeatedForeignEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (repeatedStringPiece.isNotEmpty()) { @@ -2545,7 +2620,7 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } if (packedNestedEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (unpackedInt32.isNotEmpty()) { @@ -2890,7 +2965,7 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 __result += optionalValue.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(306, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } - if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + if (com.google.protobuf.kotlin.NullValue.NULL_VALUE != optionalNullValue) { __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(307, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNullValue.number)) } @@ -3042,24 +3117,24 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal { return this as? com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (c != 0) { encoder.writeInt32(fieldNr = 1, value = c) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3085,22 +3160,22 @@ private fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInte } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal { +fun com.google.protobuf_test_messages.editions.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal { return this as? com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { // no fields to encode } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3118,22 +3193,22 @@ private fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProt } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal { +fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal { return this as? com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { // no fields to encode } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3151,12 +3226,12 @@ private fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Inte } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal { +fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal { return this as? com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { corecursive.asInternal().checkRequiredFields() @@ -3164,7 +3239,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (a != 0) { encoder.writeInt32(fieldNr = 1, value = a) } @@ -3175,7 +3250,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3213,17 +3288,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal { return this as? com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.NestedMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3234,7 +3309,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3268,17 +3343,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeInt64(fieldNr = 1, value = key) } @@ -3289,7 +3364,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3323,17 +3398,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0u) { encoder.writeUInt32(fieldNr = 1, value = key) } @@ -3344,7 +3419,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3378,17 +3453,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0uL) { encoder.writeUInt64(fieldNr = 1, value = key) } @@ -3399,7 +3474,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3433,17 +3508,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeSInt32(fieldNr = 1, value = key) } @@ -3454,7 +3529,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3488,17 +3563,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeSInt64(fieldNr = 1, value = key) } @@ -3509,7 +3584,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3543,17 +3618,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0u) { encoder.writeFixed32(fieldNr = 1, value = key) } @@ -3564,7 +3639,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3598,17 +3673,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0uL) { encoder.writeFixed64(fieldNr = 1, value = key) } @@ -3619,7 +3694,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3653,17 +3728,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeSFixed32(fieldNr = 1, value = key) } @@ -3674,7 +3749,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3708,17 +3783,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeSFixed64(fieldNr = 1, value = key) } @@ -3729,7 +3804,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3763,17 +3838,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3784,7 +3859,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3818,17 +3893,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3839,7 +3914,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3873,17 +3948,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != false) { encoder.writeBool(fieldNr = 1, value = key) } @@ -3894,7 +3969,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3928,17 +4003,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -3949,7 +4024,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3983,17 +4058,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4004,7 +4079,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4038,12 +4113,12 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -4051,7 +4126,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4062,7 +4137,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4100,12 +4175,12 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -4113,7 +4188,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4124,7 +4199,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4162,17 +4237,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4183,7 +4258,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4217,17 +4292,17 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4238,7 +4313,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4272,12 +4347,12 @@ private fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3 } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.ForeignEnum { +fun com.google.protobuf_test_messages.editions.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.ForeignEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.editions.proto3.ForeignEnum.FOREIGN_FOO @@ -4298,7 +4373,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.ForeignEnum.Compa } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.NestedEnum.FOO @@ -4323,7 +4398,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum { +fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO @@ -4344,7 +4419,7 @@ internal fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool { +fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool { return when (number) { 0 -> { com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3.Bool.kFalse diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt index 4bc427c0e..34653a157 100644 --- a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt @@ -1,7 +1,7 @@ @file:OptIn(ExperimentalRpcApi::class, InternalRpcApi::class) package com.google.protobuf_test_messages.proto3 -import com.google.protobuf.* +import com.google.protobuf.kotlin.* import kotlin.jvm.JvmInline import kotlinx.rpc.internal.utils.* @@ -98,38 +98,38 @@ interface TestAllTypesProto3 { val mapStringForeignMessage: Map val mapStringNestedEnum: Map val mapStringForeignEnum: Map - val optionalBoolWrapper: com.google.protobuf.BoolValue - val optionalInt32Wrapper: com.google.protobuf.Int32Value - val optionalInt64Wrapper: com.google.protobuf.Int64Value - val optionalUint32Wrapper: com.google.protobuf.UInt32Value - val optionalUint64Wrapper: com.google.protobuf.UInt64Value - val optionalFloatWrapper: com.google.protobuf.FloatValue - val optionalDoubleWrapper: com.google.protobuf.DoubleValue - val optionalStringWrapper: com.google.protobuf.StringValue - val optionalBytesWrapper: com.google.protobuf.BytesValue - val repeatedBoolWrapper: List - val repeatedInt32Wrapper: List - val repeatedInt64Wrapper: List - val repeatedUint32Wrapper: List - val repeatedUint64Wrapper: List - val repeatedFloatWrapper: List - val repeatedDoubleWrapper: List - val repeatedStringWrapper: List - val repeatedBytesWrapper: List - val optionalDuration: com.google.protobuf.Duration - val optionalTimestamp: com.google.protobuf.Timestamp - val optionalFieldMask: com.google.protobuf.FieldMask - val optionalStruct: com.google.protobuf.Struct - val optionalAny: com.google.protobuf.Any - val optionalValue: com.google.protobuf.Value - val optionalNullValue: com.google.protobuf.NullValue - val repeatedDuration: List - val repeatedTimestamp: List - val repeatedFieldmask: List - val repeatedStruct: List - val repeatedAny: List - val repeatedValue: List - val repeatedListValue: List + val optionalBoolWrapper: com.google.protobuf.kotlin.BoolValue + val optionalInt32Wrapper: com.google.protobuf.kotlin.Int32Value + val optionalInt64Wrapper: com.google.protobuf.kotlin.Int64Value + val optionalUint32Wrapper: com.google.protobuf.kotlin.UInt32Value + val optionalUint64Wrapper: com.google.protobuf.kotlin.UInt64Value + val optionalFloatWrapper: com.google.protobuf.kotlin.FloatValue + val optionalDoubleWrapper: com.google.protobuf.kotlin.DoubleValue + val optionalStringWrapper: com.google.protobuf.kotlin.StringValue + val optionalBytesWrapper: com.google.protobuf.kotlin.BytesValue + val repeatedBoolWrapper: List + val repeatedInt32Wrapper: List + val repeatedInt64Wrapper: List + val repeatedUint32Wrapper: List + val repeatedUint64Wrapper: List + val repeatedFloatWrapper: List + val repeatedDoubleWrapper: List + val repeatedStringWrapper: List + val repeatedBytesWrapper: List + val optionalDuration: com.google.protobuf.kotlin.Duration + val optionalTimestamp: com.google.protobuf.kotlin.Timestamp + val optionalFieldMask: com.google.protobuf.kotlin.FieldMask + val optionalStruct: com.google.protobuf.kotlin.Struct + val optionalAny: com.google.protobuf.kotlin.Any + val optionalValue: com.google.protobuf.kotlin.Value + val optionalNullValue: com.google.protobuf.kotlin.NullValue + val repeatedDuration: List + val repeatedTimestamp: List + val repeatedFieldmask: List + val repeatedStruct: List + val repeatedAny: List + val repeatedValue: List + val repeatedListValue: List val fieldname1: Int val fieldName2: Int val FieldName3: Int @@ -183,7 +183,9 @@ interface TestAllTypesProto3 { ): OneofField @JvmInline - value class OneofNullValue(val value: com.google.protobuf.NullValue): OneofField + value class OneofNullValue( + val value: com.google.protobuf.kotlin.NullValue, + ): OneofField } @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.CODEC::class) @@ -221,8 +223,11 @@ interface TestAllTypesProto3 { companion object { val MOO: AliasedEnum get() = ALIAS_BAZ + val moo: AliasedEnum get() = ALIAS_BAZ + val bAz: AliasedEnum get() = ALIAS_BAZ + val entries: List by lazy { listOf(ALIAS_FOO, ALIAS_BAR, ALIAS_BAZ) } } } @@ -239,13 +244,11 @@ interface ForeignMessage { @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.CODEC::class) interface NullHypothesisProto3 { - companion object } @kotlinx.rpc.grpc.codec.WithCodec(com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.CODEC::class) interface EnumOnlyProto3 { - sealed class Bool(open val number: Int) { object kFalse: Bool(number = 0) diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt index 586d76e3f..acaf18379 100644 --- a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt +++ b/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt @@ -1,187 +1,192 @@ @file:OptIn(ExperimentalRpcApi::class, kotlinx.rpc.internal.utils.InternalRpcApi::class) package com.google.protobuf_test_messages.proto3 -import com.google.protobuf.* +import com.google.protobuf.kotlin.* import kotlinx.rpc.internal.utils.* import kotlinx.rpc.protobuf.input.stream.asInputStream import kotlinx.rpc.protobuf.internal.* -@kotlinx.rpc.internal.utils.InternalRpcApi class TestAllTypesProto3Internal: com.google.protobuf_test_messages.proto3.TestAllTypesProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 18) { private object PresenceIndices { - const val optionalNestedMessage = 0 - const val optionalForeignMessage = 1 - const val recursiveMessage = 2 - const val optionalBoolWrapper = 3 - const val optionalInt32Wrapper = 4 - const val optionalInt64Wrapper = 5 - const val optionalUint32Wrapper = 6 - const val optionalUint64Wrapper = 7 - const val optionalFloatWrapper = 8 - const val optionalDoubleWrapper = 9 - const val optionalStringWrapper = 10 - const val optionalBytesWrapper = 11 - const val optionalDuration = 12 - const val optionalTimestamp = 13 - const val optionalFieldMask = 14 - const val optionalStruct = 15 - const val optionalAny = 16 - const val optionalValue = 17 + const val optionalNestedMessage: Int = 0 + const val optionalForeignMessage: Int = 1 + const val recursiveMessage: Int = 2 + const val optionalBoolWrapper: Int = 3 + const val optionalInt32Wrapper: Int = 4 + const val optionalInt64Wrapper: Int = 5 + const val optionalUint32Wrapper: Int = 6 + const val optionalUint64Wrapper: Int = 7 + const val optionalFloatWrapper: Int = 8 + const val optionalDoubleWrapper: Int = 9 + const val optionalStringWrapper: Int = 10 + const val optionalBytesWrapper: Int = 11 + const val optionalDuration: Int = 12 + const val optionalTimestamp: Int = 13 + const val optionalFieldMask: Int = 14 + const val optionalStruct: Int = 15 + const val optionalAny: Int = 16 + const val optionalValue: Int = 17 } - override val _size: Int by lazy { computeSize() } - override var optionalInt32: Int by MsgFieldDelegate() { 0 } - override var optionalInt64: Long by MsgFieldDelegate() { 0L } - override var optionalUint32: UInt by MsgFieldDelegate() { 0u } - override var optionalUint64: ULong by MsgFieldDelegate() { 0uL } - override var optionalSint32: Int by MsgFieldDelegate() { 0 } - override var optionalSint64: Long by MsgFieldDelegate() { 0L } - override var optionalFixed32: UInt by MsgFieldDelegate() { 0u } - override var optionalFixed64: ULong by MsgFieldDelegate() { 0uL } - override var optionalSfixed32: Int by MsgFieldDelegate() { 0 } - override var optionalSfixed64: Long by MsgFieldDelegate() { 0L } - override var optionalFloat: Float by MsgFieldDelegate() { 0.0f } - override var optionalDouble: Double by MsgFieldDelegate() { 0.0 } - override var optionalBool: Boolean by MsgFieldDelegate() { false } - override var optionalString: String by MsgFieldDelegate() { "" } - override var optionalBytes: ByteArray by MsgFieldDelegate() { byteArrayOf() } - override var optionalNestedMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } - override var optionalForeignMessage: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } - override var optionalNestedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } - override var optionalForeignEnum: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } - override var optionalAliasedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } - override var optionalStringPiece: String by MsgFieldDelegate() { "" } - override var optionalCord: String by MsgFieldDelegate() { "" } - override var recursiveMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } - override var repeatedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBool: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedString: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBytes: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedNestedMessage: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedForeignMessage: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedForeignEnum: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStringPiece: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedCord: List by MsgFieldDelegate() { mutableListOf() } - override var packedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var packedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var packedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var packedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var packedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var packedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var packedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var packedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var packedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var packedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var packedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var packedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var packedBool: List by MsgFieldDelegate() { mutableListOf() } - override var packedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedInt32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedInt64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedUint32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedUint64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSint32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSint64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFixed32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFixed64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSfixed32: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedSfixed64: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedFloat: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedDouble: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedBool: List by MsgFieldDelegate() { mutableListOf() } - override var unpackedNestedEnum: List by MsgFieldDelegate() { mutableListOf() } - override var mapInt32Int32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt64Int64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapUint32Uint32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapUint64Uint64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSint32Sint32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSint64Sint64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapFixed32Fixed32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapFixed64Fixed64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSfixed32Sfixed32: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapSfixed64Sfixed64: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt32Float: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapInt32Double: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapBoolBool: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringString: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringBytes: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringNestedMessage: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringForeignMessage: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringNestedEnum: Map by MsgFieldDelegate() { mutableMapOf() } - override var mapStringForeignEnum: Map by MsgFieldDelegate() { mutableMapOf() } - override var optionalBoolWrapper: com.google.protobuf.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.BoolValueInternal() } - override var optionalInt32Wrapper: com.google.protobuf.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.Int32ValueInternal() } - override var optionalInt64Wrapper: com.google.protobuf.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.Int64ValueInternal() } - override var optionalUint32Wrapper: com.google.protobuf.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.UInt32ValueInternal() } - override var optionalUint64Wrapper: com.google.protobuf.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.UInt64ValueInternal() } - override var optionalFloatWrapper: com.google.protobuf.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.FloatValueInternal() } - override var optionalDoubleWrapper: com.google.protobuf.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.DoubleValueInternal() } - override var optionalStringWrapper: com.google.protobuf.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.StringValueInternal() } - override var optionalBytesWrapper: com.google.protobuf.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.BytesValueInternal() } - override var repeatedBoolWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt32Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedInt64Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint32Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedUint64Wrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFloatWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedDoubleWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStringWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedBytesWrapper: List by MsgFieldDelegate() { mutableListOf() } - override var optionalDuration: com.google.protobuf.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.DurationInternal() } - override var optionalTimestamp: com.google.protobuf.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.TimestampInternal() } - override var optionalFieldMask: com.google.protobuf.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.FieldMaskInternal() } - override var optionalStruct: com.google.protobuf.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.StructInternal() } - override var optionalAny: com.google.protobuf.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.AnyInternal() } - override var optionalValue: com.google.protobuf.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.ValueInternal() } - override var optionalNullValue: com.google.protobuf.NullValue by MsgFieldDelegate() { com.google.protobuf.NullValue.NULL_VALUE } - override var repeatedDuration: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedTimestamp: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedFieldmask: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedStruct: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedAny: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedValue: List by MsgFieldDelegate() { mutableListOf() } - override var repeatedListValue: List by MsgFieldDelegate() { mutableListOf() } - override var fieldname1: Int by MsgFieldDelegate() { 0 } - override var fieldName2: Int by MsgFieldDelegate() { 0 } - override var FieldName3: Int by MsgFieldDelegate() { 0 } - override var field_Name4_: Int by MsgFieldDelegate() { 0 } - override var field0name5: Int by MsgFieldDelegate() { 0 } - override var field_0Name6: Int by MsgFieldDelegate() { 0 } - override var fieldName7: Int by MsgFieldDelegate() { 0 } - override var FieldName8: Int by MsgFieldDelegate() { 0 } - override var field_Name9: Int by MsgFieldDelegate() { 0 } - override var Field_Name10: Int by MsgFieldDelegate() { 0 } - override var FIELD_NAME11: Int by MsgFieldDelegate() { 0 } - override var FIELDName12: Int by MsgFieldDelegate() { 0 } - override var _FieldName13: Int by MsgFieldDelegate() { 0 } - override var __FieldName14: Int by MsgFieldDelegate() { 0 } - override var field_Name15: Int by MsgFieldDelegate() { 0 } - override var field__Name16: Int by MsgFieldDelegate() { 0 } - override var fieldName17__: Int by MsgFieldDelegate() { 0 } - override var FieldName18__: Int by MsgFieldDelegate() { 0 } - override var oneofField: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField? = null @kotlinx.rpc.internal.utils.InternalRpcApi + override val _size: Int by lazy { computeSize() } + + override var optionalInt32: Int by MsgFieldDelegate { 0 } + override var optionalInt64: Long by MsgFieldDelegate { 0L } + override var optionalUint32: UInt by MsgFieldDelegate { 0u } + override var optionalUint64: ULong by MsgFieldDelegate { 0uL } + override var optionalSint32: Int by MsgFieldDelegate { 0 } + override var optionalSint64: Long by MsgFieldDelegate { 0L } + override var optionalFixed32: UInt by MsgFieldDelegate { 0u } + override var optionalFixed64: ULong by MsgFieldDelegate { 0uL } + override var optionalSfixed32: Int by MsgFieldDelegate { 0 } + override var optionalSfixed64: Long by MsgFieldDelegate { 0L } + override var optionalFloat: Float by MsgFieldDelegate { 0.0f } + override var optionalDouble: Double by MsgFieldDelegate { 0.0 } + override var optionalBool: Boolean by MsgFieldDelegate { false } + override var optionalString: String by MsgFieldDelegate { "" } + override var optionalBytes: ByteArray by MsgFieldDelegate { byteArrayOf() } + override var optionalNestedMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.optionalNestedMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + override var optionalForeignMessage: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.optionalForeignMessage) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } + override var optionalNestedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } + override var optionalForeignEnum: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } + override var optionalAliasedEnum: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO } + override var optionalStringPiece: String by MsgFieldDelegate { "" } + override var optionalCord: String by MsgFieldDelegate { "" } + override var recursiveMessage: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.recursiveMessage) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } + override var repeatedInt32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSint32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSint64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var repeatedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFloat: List by MsgFieldDelegate { mutableListOf() } + override var repeatedDouble: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBool: List by MsgFieldDelegate { mutableListOf() } + override var repeatedString: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBytes: List by MsgFieldDelegate { mutableListOf() } + override var repeatedNestedMessage: List by MsgFieldDelegate { mutableListOf() } + override var repeatedForeignMessage: List by MsgFieldDelegate { mutableListOf() } + override var repeatedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var repeatedForeignEnum: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStringPiece: List by MsgFieldDelegate { mutableListOf() } + override var repeatedCord: List by MsgFieldDelegate { mutableListOf() } + override var packedInt32: List by MsgFieldDelegate { mutableListOf() } + override var packedInt64: List by MsgFieldDelegate { mutableListOf() } + override var packedUint32: List by MsgFieldDelegate { mutableListOf() } + override var packedUint64: List by MsgFieldDelegate { mutableListOf() } + override var packedSint32: List by MsgFieldDelegate { mutableListOf() } + override var packedSint64: List by MsgFieldDelegate { mutableListOf() } + override var packedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var packedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var packedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var packedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var packedFloat: List by MsgFieldDelegate { mutableListOf() } + override var packedDouble: List by MsgFieldDelegate { mutableListOf() } + override var packedBool: List by MsgFieldDelegate { mutableListOf() } + override var packedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var unpackedInt32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedInt64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedUint32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedUint64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSint32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSint64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFixed32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFixed64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSfixed32: List by MsgFieldDelegate { mutableListOf() } + override var unpackedSfixed64: List by MsgFieldDelegate { mutableListOf() } + override var unpackedFloat: List by MsgFieldDelegate { mutableListOf() } + override var unpackedDouble: List by MsgFieldDelegate { mutableListOf() } + override var unpackedBool: List by MsgFieldDelegate { mutableListOf() } + override var unpackedNestedEnum: List by MsgFieldDelegate { mutableListOf() } + override var mapInt32Int32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt64Int64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapUint32Uint32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapUint64Uint64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSint32Sint32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSint64Sint64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapFixed32Fixed32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapFixed64Fixed64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSfixed32Sfixed32: Map by MsgFieldDelegate { mutableMapOf() } + override var mapSfixed64Sfixed64: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt32Float: Map by MsgFieldDelegate { mutableMapOf() } + override var mapInt32Double: Map by MsgFieldDelegate { mutableMapOf() } + override var mapBoolBool: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringString: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringBytes: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringNestedMessage: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringForeignMessage: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringNestedEnum: Map by MsgFieldDelegate { mutableMapOf() } + override var mapStringForeignEnum: Map by MsgFieldDelegate { mutableMapOf() } + override var optionalBoolWrapper: com.google.protobuf.kotlin.BoolValue by MsgFieldDelegate(PresenceIndices.optionalBoolWrapper) { com.google.protobuf.kotlin.BoolValueInternal() } + override var optionalInt32Wrapper: com.google.protobuf.kotlin.Int32Value by MsgFieldDelegate(PresenceIndices.optionalInt32Wrapper) { com.google.protobuf.kotlin.Int32ValueInternal() } + override var optionalInt64Wrapper: com.google.protobuf.kotlin.Int64Value by MsgFieldDelegate(PresenceIndices.optionalInt64Wrapper) { com.google.protobuf.kotlin.Int64ValueInternal() } + override var optionalUint32Wrapper: com.google.protobuf.kotlin.UInt32Value by MsgFieldDelegate(PresenceIndices.optionalUint32Wrapper) { com.google.protobuf.kotlin.UInt32ValueInternal() } + override var optionalUint64Wrapper: com.google.protobuf.kotlin.UInt64Value by MsgFieldDelegate(PresenceIndices.optionalUint64Wrapper) { com.google.protobuf.kotlin.UInt64ValueInternal() } + override var optionalFloatWrapper: com.google.protobuf.kotlin.FloatValue by MsgFieldDelegate(PresenceIndices.optionalFloatWrapper) { com.google.protobuf.kotlin.FloatValueInternal() } + override var optionalDoubleWrapper: com.google.protobuf.kotlin.DoubleValue by MsgFieldDelegate(PresenceIndices.optionalDoubleWrapper) { com.google.protobuf.kotlin.DoubleValueInternal() } + override var optionalStringWrapper: com.google.protobuf.kotlin.StringValue by MsgFieldDelegate(PresenceIndices.optionalStringWrapper) { com.google.protobuf.kotlin.StringValueInternal() } + override var optionalBytesWrapper: com.google.protobuf.kotlin.BytesValue by MsgFieldDelegate(PresenceIndices.optionalBytesWrapper) { com.google.protobuf.kotlin.BytesValueInternal() } + override var repeatedBoolWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt32Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedInt64Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint32Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedUint64Wrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFloatWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedDoubleWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStringWrapper: List by MsgFieldDelegate { mutableListOf() } + override var repeatedBytesWrapper: List by MsgFieldDelegate { mutableListOf() } + override var optionalDuration: com.google.protobuf.kotlin.Duration by MsgFieldDelegate(PresenceIndices.optionalDuration) { com.google.protobuf.kotlin.DurationInternal() } + override var optionalTimestamp: com.google.protobuf.kotlin.Timestamp by MsgFieldDelegate(PresenceIndices.optionalTimestamp) { com.google.protobuf.kotlin.TimestampInternal() } + override var optionalFieldMask: com.google.protobuf.kotlin.FieldMask by MsgFieldDelegate(PresenceIndices.optionalFieldMask) { com.google.protobuf.kotlin.FieldMaskInternal() } + override var optionalStruct: com.google.protobuf.kotlin.Struct by MsgFieldDelegate(PresenceIndices.optionalStruct) { com.google.protobuf.kotlin.StructInternal() } + override var optionalAny: com.google.protobuf.kotlin.Any by MsgFieldDelegate(PresenceIndices.optionalAny) { com.google.protobuf.kotlin.AnyInternal() } + override var optionalValue: com.google.protobuf.kotlin.Value by MsgFieldDelegate(PresenceIndices.optionalValue) { com.google.protobuf.kotlin.ValueInternal() } + override var optionalNullValue: com.google.protobuf.kotlin.NullValue by MsgFieldDelegate { com.google.protobuf.kotlin.NullValue.NULL_VALUE } + override var repeatedDuration: List by MsgFieldDelegate { mutableListOf() } + override var repeatedTimestamp: List by MsgFieldDelegate { mutableListOf() } + override var repeatedFieldmask: List by MsgFieldDelegate { mutableListOf() } + override var repeatedStruct: List by MsgFieldDelegate { mutableListOf() } + override var repeatedAny: List by MsgFieldDelegate { mutableListOf() } + override var repeatedValue: List by MsgFieldDelegate { mutableListOf() } + override var repeatedListValue: List by MsgFieldDelegate { mutableListOf() } + override var fieldname1: Int by MsgFieldDelegate { 0 } + override var fieldName2: Int by MsgFieldDelegate { 0 } + override var FieldName3: Int by MsgFieldDelegate { 0 } + override var field_Name4_: Int by MsgFieldDelegate { 0 } + override var field0name5: Int by MsgFieldDelegate { 0 } + override var field_0Name6: Int by MsgFieldDelegate { 0 } + override var fieldName7: Int by MsgFieldDelegate { 0 } + override var FieldName8: Int by MsgFieldDelegate { 0 } + override var field_Name9: Int by MsgFieldDelegate { 0 } + override var Field_Name10: Int by MsgFieldDelegate { 0 } + override var FIELD_NAME11: Int by MsgFieldDelegate { 0 } + override var FIELDName12: Int by MsgFieldDelegate { 0 } + override var _FieldName13: Int by MsgFieldDelegate { 0 } + override var __FieldName14: Int by MsgFieldDelegate { 0 } + override var field_Name15: Int by MsgFieldDelegate { 0 } + override var field__Name16: Int by MsgFieldDelegate { 0 } + override var fieldName17__: Int by MsgFieldDelegate { 0 } + override var FieldName18__: Int by MsgFieldDelegate { 0 } + override var oneofField: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField? = null + class NestedMessageInternal: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val corecursive = 0 + const val corecursive: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var a: Int by MsgFieldDelegate() { 0 } - override var corecursive: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var a: Int by MsgFieldDelegate { 0 } + override var corecursive: com.google.protobuf_test_messages.proto3.TestAllTypesProto3 by MsgFieldDelegate(PresenceIndices.corecursive) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -204,170 +209,229 @@ class TestAllTypesProto3Internal: com.google.protobuf_test_messages.proto3.TestA } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32Int32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt64Int64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapUint32Uint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: UInt by MsgFieldDelegate() { 0u } - var value: UInt by MsgFieldDelegate() { 0u } + + var key: UInt by MsgFieldDelegate { 0u } + var value: UInt by MsgFieldDelegate { 0u } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapUint64Uint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: ULong by MsgFieldDelegate() { 0uL } - var value: ULong by MsgFieldDelegate() { 0uL } + + var key: ULong by MsgFieldDelegate { 0uL } + var value: ULong by MsgFieldDelegate { 0uL } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSint32Sint32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSint64Sint64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapFixed32Fixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: UInt by MsgFieldDelegate() { 0u } - var value: UInt by MsgFieldDelegate() { 0u } + + var key: UInt by MsgFieldDelegate { 0u } + var value: UInt by MsgFieldDelegate { 0u } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapFixed64Fixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: ULong by MsgFieldDelegate() { 0uL } - var value: ULong by MsgFieldDelegate() { 0uL } + + var key: ULong by MsgFieldDelegate { 0uL } + var value: ULong by MsgFieldDelegate { 0uL } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSfixed32Sfixed32EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Int by MsgFieldDelegate() { 0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapSfixed64Sfixed64EntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Long by MsgFieldDelegate() { 0L } - var value: Long by MsgFieldDelegate() { 0L } + + var key: Long by MsgFieldDelegate { 0L } + var value: Long by MsgFieldDelegate { 0L } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32FloatEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Float by MsgFieldDelegate() { 0.0f } + + var key: Int by MsgFieldDelegate { 0 } + var value: Float by MsgFieldDelegate { 0.0f } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapInt32DoubleEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Int by MsgFieldDelegate() { 0 } - var value: Double by MsgFieldDelegate() { 0.0 } + + var key: Int by MsgFieldDelegate { 0 } + var value: Double by MsgFieldDelegate { 0.0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapBoolBoolEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: Boolean by MsgFieldDelegate() { false } - var value: Boolean by MsgFieldDelegate() { false } + + var key: Boolean by MsgFieldDelegate { false } + var value: Boolean by MsgFieldDelegate { false } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringStringEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: String by MsgFieldDelegate() { "" } + + var key: String by MsgFieldDelegate { "" } + var value: String by MsgFieldDelegate { "" } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringBytesEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: ByteArray by MsgFieldDelegate() { byteArrayOf() } + + var key: String by MsgFieldDelegate { "" } + var value: ByteArray by MsgFieldDelegate { byteArrayOf() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringNestedMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val value = 0 + const val value: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringForeignMessageEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 1) { private object PresenceIndices { - const val value = 0 + const val value: Int = 0 } + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.proto3.ForeignMessage by MsgFieldDelegate(PresenceIndices.value) { com.google.protobuf_test_messages.proto3.ForeignMessageInternal() } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringNestedEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum by MsgFieldDelegate { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.NEG } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - @kotlinx.rpc.internal.utils.InternalRpcApi class MapStringForeignEnumEntryInternal: kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - var key: String by MsgFieldDelegate() { "" } - var value: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate() { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } + + var key: String by MsgFieldDelegate { "" } + var value: com.google.protobuf_test_messages.proto3.ForeignEnum by MsgFieldDelegate { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO } + + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.proto3.TestAllTypesProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -390,14 +454,18 @@ class TestAllTypesProto3Internal: com.google.protobuf_test_messages.proto3.TestA } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class ForeignMessageInternal: com.google.protobuf_test_messages.proto3.ForeignMessage, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - override var c: Int by MsgFieldDelegate() { 0 } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + override var c: Int by MsgFieldDelegate { 0 } + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.proto3.ForeignMessage): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -420,13 +488,16 @@ class ForeignMessageInternal: com.google.protobuf_test_messages.proto3.ForeignMe } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class NullHypothesisProto3Internal: com.google.protobuf_test_messages.proto3.NullHypothesisProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.proto3.NullHypothesisProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -449,13 +520,16 @@ class NullHypothesisProto3Internal: com.google.protobuf_test_messages.proto3.Nul } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } -@kotlinx.rpc.internal.utils.InternalRpcApi class EnumOnlyProto3Internal: com.google.protobuf_test_messages.proto3.EnumOnlyProto3, kotlinx.rpc.protobuf.internal.InternalMessage(fieldsWithPresence = 0) { + @kotlinx.rpc.internal.utils.InternalRpcApi override val _size: Int by lazy { computeSize() } - object CODEC : kotlinx.rpc.grpc.codec.MessageCodec { + + @kotlinx.rpc.internal.utils.InternalRpcApi + object CODEC: kotlinx.rpc.grpc.codec.MessageCodec { override fun encode(value: com.google.protobuf_test_messages.proto3.EnumOnlyProto3): kotlinx.rpc.protobuf.input.stream.InputStream { val buffer = kotlinx.io.Buffer() val encoder = kotlinx.rpc.protobuf.internal.WireEncoder(buffer) @@ -478,6 +552,7 @@ class EnumOnlyProto3Internal: com.google.protobuf_test_messages.proto3.EnumOnlyP } } + @kotlinx.rpc.internal.utils.InternalRpcApi companion object } @@ -512,7 +587,7 @@ operator fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedM } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { optionalNestedMessage.asInternal().checkRequiredFields() @@ -676,7 +751,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (optionalInt32 != 0) { encoder.writeInt32(fieldNr = 1, value = optionalInt32) } @@ -846,11 +921,11 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } if (repeatedNestedEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum)) + encoder.writePackedEnum(fieldNr = 51, value = repeatedNestedEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum.map { it.number })) } if (repeatedForeignEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum)) + encoder.writePackedEnum(fieldNr = 52, value = repeatedForeignEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum.map { it.number })) } if (repeatedStringPiece.isNotEmpty()) { @@ -918,7 +993,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } if (packedNestedEnum.isNotEmpty()) { - encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum)) + encoder.writePackedEnum(fieldNr = 88, value = packedNestedEnum.map { it.number }, fieldSize = kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum.map { it.number })) } if (unpackedInt32.isNotEmpty()) { @@ -1001,7 +1076,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal if (unpackedNestedEnum.isNotEmpty()) { unpackedNestedEnum.forEach { - encoder.writeEnum(102, it) + encoder.writeEnum(102, it.number) } } @@ -1347,7 +1422,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal encoder.writeMessage(fieldNr = 306, value = optionalValue.asInternal()) { encodeWith(it) } } - if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + if (com.google.protobuf.kotlin.NullValue.NULL_VALUE != optionalNullValue) { encoder.writeEnum(fieldNr = 307, value = optionalNullValue.number) } @@ -1511,7 +1586,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -1694,11 +1769,11 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } tag.fieldNr == 51 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.repeatedNestedEnum = decoder.readPackedEnum() + msg.repeatedNestedEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(it) } } tag.fieldNr == 52 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.repeatedForeignEnum = decoder.readPackedEnum() + msg.repeatedForeignEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.proto3.ForeignEnum.fromNumber(it) } } tag.fieldNr == 54 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { @@ -1764,7 +1839,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } tag.fieldNr == 88 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - msg.packedNestedEnum = decoder.readPackedEnum() + msg.packedNestedEnum = decoder.readPackedEnum().map { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.fromNumber(it) } } tag.fieldNr == 89 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { @@ -1972,221 +2047,221 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal tag.fieldNr == 201 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[3]) { - msg.optionalBoolWrapper = com.google.protobuf.BoolValueInternal() + msg.optionalBoolWrapper = com.google.protobuf.kotlin.BoolValueInternal() } - decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + decoder.readMessage(msg.optionalBoolWrapper.asInternal(), com.google.protobuf.kotlin.BoolValueInternal::decodeWith) } tag.fieldNr == 202 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[4]) { - msg.optionalInt32Wrapper = com.google.protobuf.Int32ValueInternal() + msg.optionalInt32Wrapper = com.google.protobuf.kotlin.Int32ValueInternal() } - decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + decoder.readMessage(msg.optionalInt32Wrapper.asInternal(), com.google.protobuf.kotlin.Int32ValueInternal::decodeWith) } tag.fieldNr == 203 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[5]) { - msg.optionalInt64Wrapper = com.google.protobuf.Int64ValueInternal() + msg.optionalInt64Wrapper = com.google.protobuf.kotlin.Int64ValueInternal() } - decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + decoder.readMessage(msg.optionalInt64Wrapper.asInternal(), com.google.protobuf.kotlin.Int64ValueInternal::decodeWith) } tag.fieldNr == 204 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[6]) { - msg.optionalUint32Wrapper = com.google.protobuf.UInt32ValueInternal() + msg.optionalUint32Wrapper = com.google.protobuf.kotlin.UInt32ValueInternal() } - decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + decoder.readMessage(msg.optionalUint32Wrapper.asInternal(), com.google.protobuf.kotlin.UInt32ValueInternal::decodeWith) } tag.fieldNr == 205 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[7]) { - msg.optionalUint64Wrapper = com.google.protobuf.UInt64ValueInternal() + msg.optionalUint64Wrapper = com.google.protobuf.kotlin.UInt64ValueInternal() } - decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + decoder.readMessage(msg.optionalUint64Wrapper.asInternal(), com.google.protobuf.kotlin.UInt64ValueInternal::decodeWith) } tag.fieldNr == 206 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[8]) { - msg.optionalFloatWrapper = com.google.protobuf.FloatValueInternal() + msg.optionalFloatWrapper = com.google.protobuf.kotlin.FloatValueInternal() } - decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + decoder.readMessage(msg.optionalFloatWrapper.asInternal(), com.google.protobuf.kotlin.FloatValueInternal::decodeWith) } tag.fieldNr == 207 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[9]) { - msg.optionalDoubleWrapper = com.google.protobuf.DoubleValueInternal() + msg.optionalDoubleWrapper = com.google.protobuf.kotlin.DoubleValueInternal() } - decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + decoder.readMessage(msg.optionalDoubleWrapper.asInternal(), com.google.protobuf.kotlin.DoubleValueInternal::decodeWith) } tag.fieldNr == 208 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[10]) { - msg.optionalStringWrapper = com.google.protobuf.StringValueInternal() + msg.optionalStringWrapper = com.google.protobuf.kotlin.StringValueInternal() } - decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + decoder.readMessage(msg.optionalStringWrapper.asInternal(), com.google.protobuf.kotlin.StringValueInternal::decodeWith) } tag.fieldNr == 209 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[11]) { - msg.optionalBytesWrapper = com.google.protobuf.BytesValueInternal() + msg.optionalBytesWrapper = com.google.protobuf.kotlin.BytesValueInternal() } - decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + decoder.readMessage(msg.optionalBytesWrapper.asInternal(), com.google.protobuf.kotlin.BytesValueInternal::decodeWith) } tag.fieldNr == 211 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.BoolValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.BoolValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.BoolValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.BoolValueInternal::decodeWith) (msg.repeatedBoolWrapper as MutableList).add(elem) } tag.fieldNr == 212 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.Int32ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.Int32ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.Int32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.Int32ValueInternal::decodeWith) (msg.repeatedInt32Wrapper as MutableList).add(elem) } tag.fieldNr == 213 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.Int64ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.Int64ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.Int64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.Int64ValueInternal::decodeWith) (msg.repeatedInt64Wrapper as MutableList).add(elem) } tag.fieldNr == 214 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.UInt32ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt32ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.UInt32ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.UInt32ValueInternal::decodeWith) (msg.repeatedUint32Wrapper as MutableList).add(elem) } tag.fieldNr == 215 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.UInt64ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.UInt64ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.UInt64ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.UInt64ValueInternal::decodeWith) (msg.repeatedUint64Wrapper as MutableList).add(elem) } tag.fieldNr == 216 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.FloatValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.FloatValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.FloatValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.FloatValueInternal::decodeWith) (msg.repeatedFloatWrapper as MutableList).add(elem) } tag.fieldNr == 217 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.DoubleValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.DoubleValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.DoubleValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.DoubleValueInternal::decodeWith) (msg.repeatedDoubleWrapper as MutableList).add(elem) } tag.fieldNr == 218 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.StringValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.StringValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.StringValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.StringValueInternal::decodeWith) (msg.repeatedStringWrapper as MutableList).add(elem) } tag.fieldNr == 219 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.BytesValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.BytesValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.BytesValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.BytesValueInternal::decodeWith) (msg.repeatedBytesWrapper as MutableList).add(elem) } tag.fieldNr == 301 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[12]) { - msg.optionalDuration = com.google.protobuf.DurationInternal() + msg.optionalDuration = com.google.protobuf.kotlin.DurationInternal() } - decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + decoder.readMessage(msg.optionalDuration.asInternal(), com.google.protobuf.kotlin.DurationInternal::decodeWith) } tag.fieldNr == 302 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[13]) { - msg.optionalTimestamp = com.google.protobuf.TimestampInternal() + msg.optionalTimestamp = com.google.protobuf.kotlin.TimestampInternal() } - decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + decoder.readMessage(msg.optionalTimestamp.asInternal(), com.google.protobuf.kotlin.TimestampInternal::decodeWith) } tag.fieldNr == 303 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[14]) { - msg.optionalFieldMask = com.google.protobuf.FieldMaskInternal() + msg.optionalFieldMask = com.google.protobuf.kotlin.FieldMaskInternal() } - decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + decoder.readMessage(msg.optionalFieldMask.asInternal(), com.google.protobuf.kotlin.FieldMaskInternal::decodeWith) } tag.fieldNr == 304 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[15]) { - msg.optionalStruct = com.google.protobuf.StructInternal() + msg.optionalStruct = com.google.protobuf.kotlin.StructInternal() } - decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.StructInternal::decodeWith) + decoder.readMessage(msg.optionalStruct.asInternal(), com.google.protobuf.kotlin.StructInternal::decodeWith) } tag.fieldNr == 305 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[16]) { - msg.optionalAny = com.google.protobuf.AnyInternal() + msg.optionalAny = com.google.protobuf.kotlin.AnyInternal() } - decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + decoder.readMessage(msg.optionalAny.asInternal(), com.google.protobuf.kotlin.AnyInternal::decodeWith) } tag.fieldNr == 306 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { if (!msg.presenceMask[17]) { - msg.optionalValue = com.google.protobuf.ValueInternal() + msg.optionalValue = com.google.protobuf.kotlin.ValueInternal() } - decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + decoder.readMessage(msg.optionalValue.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) } tag.fieldNr == 307 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { - msg.optionalNullValue = com.google.protobuf.NullValue.fromNumber(decoder.readEnum()) + msg.optionalNullValue = com.google.protobuf.kotlin.NullValue.fromNumber(decoder.readEnum()) } tag.fieldNr == 311 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.DurationInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.DurationInternal::decodeWith) + val elem = com.google.protobuf.kotlin.DurationInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.DurationInternal::decodeWith) (msg.repeatedDuration as MutableList).add(elem) } tag.fieldNr == 312 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.TimestampInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.TimestampInternal::decodeWith) + val elem = com.google.protobuf.kotlin.TimestampInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.TimestampInternal::decodeWith) (msg.repeatedTimestamp as MutableList).add(elem) } tag.fieldNr == 313 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.FieldMaskInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.FieldMaskInternal::decodeWith) + val elem = com.google.protobuf.kotlin.FieldMaskInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.FieldMaskInternal::decodeWith) (msg.repeatedFieldmask as MutableList).add(elem) } tag.fieldNr == 324 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.StructInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.StructInternal::decodeWith) + val elem = com.google.protobuf.kotlin.StructInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.StructInternal::decodeWith) (msg.repeatedStruct as MutableList).add(elem) } tag.fieldNr == 315 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.AnyInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.AnyInternal::decodeWith) + val elem = com.google.protobuf.kotlin.AnyInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.AnyInternal::decodeWith) (msg.repeatedAny as MutableList).add(elem) } tag.fieldNr == 316 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.ValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.ValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.ValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.ValueInternal::decodeWith) (msg.repeatedValue as MutableList).add(elem) } tag.fieldNr == 317 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED -> { - val elem = com.google.protobuf.ListValueInternal() - decoder.readMessage(elem.asInternal(), com.google.protobuf.ListValueInternal::decodeWith) + val elem = com.google.protobuf.kotlin.ListValueInternal() + decoder.readMessage(elem.asInternal(), com.google.protobuf.kotlin.ListValueInternal::decodeWith) (msg.repeatedListValue as MutableList).add(elem) } @@ -2303,7 +2378,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } tag.fieldNr == 120 && tag.wireType == kotlinx.rpc.protobuf.internal.WireType.VARINT -> { - msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.NullValue.fromNumber(decoder.readEnum())) + msg.oneofField = com.google.protobuf_test_messages.proto3.TestAllTypesProto3.OneofField.OneofNullValue(com.google.protobuf.kotlin.NullValue.fromNumber(decoder.readEnum())) } else -> { @@ -2477,11 +2552,11 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } if (repeatedNestedEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedNestedEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(51, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (repeatedForeignEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(repeatedForeignEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(52, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (repeatedStringPiece.isNotEmpty()) { @@ -2545,7 +2620,7 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } if (packedNestedEnum.isNotEmpty()) { - __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } + __result += kotlinx.rpc.protobuf.internal.WireSize.packedEnum(packedNestedEnum.map { it.number }).let { kotlinx.rpc.protobuf.internal.WireSize.tag(88, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } if (unpackedInt32.isNotEmpty()) { @@ -2890,7 +2965,7 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. __result += optionalValue.asInternal()._size.let { kotlinx.rpc.protobuf.internal.WireSize.tag(306, kotlinx.rpc.protobuf.internal.WireType.LENGTH_DELIMITED) + kotlinx.rpc.protobuf.internal.WireSize.int32(it) + it } } - if (com.google.protobuf.NullValue.NULL_VALUE != optionalNullValue) { + if (com.google.protobuf.kotlin.NullValue.NULL_VALUE != optionalNullValue) { __result += (kotlinx.rpc.protobuf.internal.WireSize.tag(307, kotlinx.rpc.protobuf.internal.WireType.VARINT) + kotlinx.rpc.protobuf.internal.WireSize.enum(optionalNullValue.number)) } @@ -3042,24 +3117,24 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal { return this as? com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (c != 0) { encoder.writeInt32(fieldNr = 1, value = c) } } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.ForeignMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3085,22 +3160,22 @@ private fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.comp } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.proto3.ForeignMessageInternal { +fun com.google.protobuf_test_messages.proto3.ForeignMessage.asInternal(): com.google.protobuf_test_messages.proto3.ForeignMessageInternal { return this as? com.google.protobuf_test_messages.proto3.ForeignMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { // no fields to encode } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3118,22 +3193,22 @@ private fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Interna } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal { +fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3.asInternal(): com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal { return this as? com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { // no fields to encode } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3151,12 +3226,12 @@ private fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.comp } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal { +fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.asInternal(): com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal { return this as? com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { corecursive.asInternal().checkRequiredFields() @@ -3164,7 +3239,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (a != 0) { encoder.writeInt32(fieldNr = 1, value = a) } @@ -3175,7 +3250,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3213,17 +3288,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedMessage.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal { return this as? com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMessageInternal ?: error("Message ${this::class.simpleName} is a non-internal message type.") } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3234,7 +3309,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3268,17 +3343,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32Int32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeInt64(fieldNr = 1, value = key) } @@ -3289,7 +3364,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3323,17 +3398,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64Int64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0u) { encoder.writeUInt32(fieldNr = 1, value = key) } @@ -3344,7 +3419,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3378,17 +3453,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint32Uint32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0uL) { encoder.writeUInt64(fieldNr = 1, value = key) } @@ -3399,7 +3474,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3433,17 +3508,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint64Uint64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeSInt32(fieldNr = 1, value = key) } @@ -3454,7 +3529,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3488,17 +3563,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint32Sint32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeSInt64(fieldNr = 1, value = key) } @@ -3509,7 +3584,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3543,17 +3618,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint64Sint64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0u) { encoder.writeFixed32(fieldNr = 1, value = key) } @@ -3564,7 +3639,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3598,17 +3673,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed32Fixed32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0uL) { encoder.writeFixed64(fieldNr = 1, value = key) } @@ -3619,7 +3694,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3653,17 +3728,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed64Fixed64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeSFixed32(fieldNr = 1, value = key) } @@ -3674,7 +3749,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3708,17 +3783,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed32Sfixed32EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0L) { encoder.writeSFixed64(fieldNr = 1, value = key) } @@ -3729,7 +3804,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3763,17 +3838,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixed64Sfixed64EntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3784,7 +3859,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3818,17 +3893,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32FloatEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != 0) { encoder.writeInt32(fieldNr = 1, value = key) } @@ -3839,7 +3914,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3873,17 +3948,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32DoubleEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key != false) { encoder.writeBool(fieldNr = 1, value = key) } @@ -3894,7 +3969,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3928,17 +4003,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolBoolEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -3949,7 +4024,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -3983,17 +4058,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringStringEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4004,7 +4079,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4038,12 +4113,12 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringBytesEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -4051,7 +4126,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4062,7 +4137,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4100,12 +4175,12 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedMessageEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.checkRequiredFields() { // no required fields to check if (presenceMask[0]) { value.asInternal().checkRequiredFields() @@ -4113,7 +4188,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4124,7 +4199,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4162,17 +4237,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignMessageEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4183,7 +4258,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4217,17 +4292,17 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringNestedEnumEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.checkRequiredFields() { // no required fields to check } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.encodeWith(encoder: kotlinx.rpc.protobuf.internal.WireEncoder) { if (key.isNotEmpty()) { encoder.writeString(fieldNr = 1, value = key) } @@ -4238,7 +4313,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.Companion.decodeWith(msg: com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal, decoder: kotlinx.rpc.protobuf.internal.WireDecoder) { while (true) { val tag = decoder.readTag() ?: break // EOF, we read the whole message when { @@ -4272,12 +4347,12 @@ private fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal. } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal.asInternal(): com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStringForeignEnumEntryInternal { return this } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.ForeignEnum { +fun com.google.protobuf_test_messages.proto3.ForeignEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.ForeignEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.proto3.ForeignEnum.FOREIGN_FOO @@ -4298,7 +4373,7 @@ internal fun com.google.protobuf_test_messages.proto3.ForeignEnum.Companion.from } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedEnum.FOO @@ -4323,7 +4398,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.NestedE } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum { +fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum { return when (number) { 0 -> { com.google.protobuf_test_messages.proto3.TestAllTypesProto3.AliasedEnum.ALIAS_FOO @@ -4344,7 +4419,7 @@ internal fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3.Aliased } @kotlinx.rpc.internal.utils.InternalRpcApi -internal fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool { +fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.Companion.fromNumber(number: Int): com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool { return when (number) { 0 -> { com.google.protobuf_test_messages.proto3.EnumOnlyProto3.Bool.kFalse From a1305c2b681e815057de7485b927a972451326bc Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 14 Aug 2025 17:33:36 +0200 Subject: [PATCH 4/5] Moved generated --- .../com/google/protobuf/kotlin/{duration.kt => durationKotlin.kt} | 0 .../google/protobuf/kotlin/{timestamp.kt => timestampKotlin.kt} | 0 .../com/google/protobuf/conformance/Conformance.kt | 0 .../com/google/protobuf/conformance/_rpc_internal/Conformance.kt | 0 .../editions/proto3/TestMessagesProto3Editions.kt | 0 .../editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt | 0 .../google/protobuf_test_messages/proto3/TestMessagesProto3.kt | 0 .../proto3/_rpc_internal/TestMessagesProto3.kt | 0 .../proto/protobuf-conformance/conformance/conformance.proto | 0 .../google/protobuf/test_messages_edition2023.proto | 0 .../google/protobuf/test_messages_proto2.proto | 0 .../google/protobuf/test_messages_proto2_editions.proto | 0 .../google/protobuf/test_messages_proto3.proto | 0 .../google/protobuf/test_messages_proto3_editions.proto | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/{duration.kt => durationKotlin.kt} (100%) rename protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/{timestamp.kt => timestampKotlin.kt} (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt (100%) rename tests/protobuf-conformance/src/{test => main}/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/conformance/conformance.proto (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto (100%) rename tests/protobuf-conformance/src/{test => main}/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto (100%) diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/durationKotlin.kt similarity index 100% rename from protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/duration.kt rename to protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/durationKotlin.kt diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt b/protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestampKotlin.kt similarity index 100% rename from protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestamp.kt rename to protobuf/protobuf-core/src/commonMain/kotlin/com/google/protobuf/kotlin/timestampKotlin.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/Conformance.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf/conformance/_rpc_internal/Conformance.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/TestMessagesProto3Editions.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/editions/proto3/_rpc_internal/TestMessagesProto3Editions.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/TestMessagesProto3.kt diff --git a/tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt b/tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt similarity index 100% rename from tests/protobuf-conformance/src/test/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt rename to tests/protobuf-conformance/src/main/generated-code/kotlin-multiplatform/com/google/protobuf_test_messages/proto3/_rpc_internal/TestMessagesProto3.kt diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/conformance/conformance.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/conformance/conformance.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/conformance/conformance.proto diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_edition2023.proto diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto2.proto diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto2_editions.proto diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto3.proto diff --git a/tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto b/tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto similarity index 100% rename from tests/protobuf-conformance/src/test/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto rename to tests/protobuf-conformance/src/main/proto/protobuf-conformance/google/protobuf/test_messages_proto3_editions.proto From 2ab9953d374906a8eca0343a97d37f133f610b93 Mon Sep 17 00:00:00 2001 From: Alexander Sysoev Date: Thu, 14 Aug 2025 21:55:52 +0200 Subject: [PATCH 5/5] added running conformance tests --- .../util/tasks/protobufConformanceUpdate.kt | 39 +- protobuf/protobuf-core/build.gradle.kts | 2 + tests/protobuf-conformance/build.gradle.kts | 64 ++- .../rpc/protoc/gen/test/ConformanceClient.kt | 364 ++++++++++++++++++ .../gen/test/GenerateConformanceTests.kt | 42 ++ .../rpc/protoc/gen/test/runner/javaClient.kt | 27 ++ .../rpc/protoc/gen/test/runner/runner.kt | 74 ++++ .../rpc/protoc/gen/test/ConformanceTest.kt | 101 +++++ 8 files changed, 701 insertions(+), 12 deletions(-) create mode 100644 tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceClient.kt create mode 100644 tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/GenerateConformanceTests.kt create mode 100644 tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/javaClient.kt create mode 100644 tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/runner.kt create mode 100644 tests/protobuf-conformance/src/test/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceTest.kt diff --git a/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt b/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt index 8d009c68f..8679e22b3 100644 --- a/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt +++ b/gradle-conventions/src/main/kotlin/util/tasks/protobufConformanceUpdate.kt @@ -8,6 +8,7 @@ import org.gradle.api.DefaultTask import org.gradle.api.Project import org.gradle.api.provider.Property import org.gradle.api.tasks.Copy +import org.gradle.api.tasks.Input import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction @@ -24,6 +25,12 @@ const val UNZIP_PROTOBUF_CONFORMANCE_TASK = "unzipProtobufConformance" const val WRITE_CONFORMANCE_EXECUTABLE_PATH_TASK = "writeConformanceExecutablePath" abstract class ConformanceExecutablePathWriter : DefaultTask() { + @get:Input + abstract val outputDir: Property + + @get:Input + abstract val kotlinTestDir: Property + @get:InputFile abstract val executable: Property @@ -47,7 +54,11 @@ abstract class ConformanceExecutablePathWriter : DefaultTask() { // file generated by ConformanceExecutablePathWriter task const val CONFORMANCE_EXECUTABLE_PATH: String = "${executable.get().absolutePath}" - + + const val CONFORMANCE_OUTPUT_DIR: String = "${outputDir.get().absolutePath}" + + const val KOTLIN_TEST_DIR: String = "${kotlinTestDir.get().absolutePath}" + """.trimIndent() ) } @@ -111,7 +122,7 @@ fun Project.setupProtobufConformanceResources() { val destDir = project.layout.projectDirectory .dir("src") - .dir("test") + .dir("main") .dir("proto") into(destDir) @@ -131,6 +142,20 @@ fun Project.setupProtobufConformanceResources() { val writeConformanceExecutablePath = tasks.register(WRITE_CONFORMANCE_EXECUTABLE_PATH_TASK) { + outputDir.set( + project.layout.buildDirectory.get() + .dir("protobuf-conformance") + .asFile + ) + + kotlinTestDir.set( + project.layout.projectDirectory + .dir("src") + .dir("test") + .dir("kotlin") + .asFile + ) + executable.set( configurations.getByName(CONFORMANCE_TEST_RUNNER_CONFIGURATION).map { zipTree(it).matching { include("bin/**") }.files.first() @@ -138,16 +163,20 @@ fun Project.setupProtobufConformanceResources() { ) destination.set( - project.layout.buildDirectory.file("generated/protobuf-conformance/executable-path.kt").get().asFile + project.layout.buildDirectory.get() + .dir("generated") + .dir("protobuf-conformance") + .file("executable-paths.kt") + .asFile ) } - tasks.matching { it.name == "processTestProtoFiles" }.all { + tasks.matching { it.name == "processMainProtoFiles" || it.name == "processTestImportProtoFiles" }.all { dependsOn(unzipProtobufConformance) } the().apply { - sourceSets.getByName("test") { + sourceSets.getByName("main") { kotlin.srcDir(writeConformanceExecutablePath.map { it.destination.get().parentFile }) } } diff --git a/protobuf/protobuf-core/build.gradle.kts b/protobuf/protobuf-core/build.gradle.kts index abb946b07..52157cbc7 100644 --- a/protobuf/protobuf-core/build.gradle.kts +++ b/protobuf/protobuf-core/build.gradle.kts @@ -16,8 +16,10 @@ plugins { } kotlin { + // time API compilerOptions { apiVersion = KotlinVersion.KOTLIN_2_1 + languageVersion = KotlinVersion.KOTLIN_2_1 } sourceSets { diff --git a/tests/protobuf-conformance/build.gradle.kts b/tests/protobuf-conformance/build.gradle.kts index 97382204e..dfaf53c85 100644 --- a/tests/protobuf-conformance/build.gradle.kts +++ b/tests/protobuf-conformance/build.gradle.kts @@ -7,7 +7,7 @@ import kotlinx.rpc.buf.tasks.BufGenerateTask import kotlinx.rpc.internal.InternalRpcApi import kotlinx.rpc.internal.configureLocalProtocGenDevelopmentDependency -import kotlinx.rpc.protoc.ProcessProtoFiles +import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode import util.tasks.setupProtobufConformanceResources plugins { @@ -15,28 +15,37 @@ plugins { alias(libs.plugins.kotlinx.rpc) } +kotlin { + explicitApi = ExplicitApiMode.Disabled +} + dependencies { - testImplementation(projects.grpc.grpcCodec) - testImplementation(projects.protobuf.protobufCore) + implementation(libs.coroutines.core) + implementation(libs.kotlin.reflect) + implementation(projects.grpc.grpcCodec) + implementation(projects.protobuf.protobufCore) + + testImplementation(libs.kotlin.test.junit5) + testImplementation(libs.coroutines.test) } setupProtobufConformanceResources() -configureLocalProtocGenDevelopmentDependency() +configureLocalProtocGenDevelopmentDependency("Main") val generatedCodeDir = project.layout.projectDirectory .dir("src") - .dir("test") + .dir("main") .dir("generated-code") .asFile tasks.withType().configureEach { - if (name.endsWith("Test")) { + if (name.endsWith("Main")) { outputDirectory = generatedCodeDir } } protoSourceSets { - test { + main { proto { exclude("**/test_messages_proto2.proto") exclude("**/test_messages_proto2_editions.proto") @@ -44,3 +53,44 @@ protoSourceSets { } } } + +val mockClientJar = tasks.register("mockClientJar") { + archiveBaseName.set("mockClient") + archiveVersion.set("") + + manifest { + attributes["Main-Class"] = "kotlinx.rpc.protoc.gen.test.ConformanceClientKt" + } + + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + from( + configurations.runtimeClasspath.map { prop -> + prop.map { if (it.isDirectory()) it else zipTree(it) } + } + ) + + with(tasks.jar.get()) +} + + +val generateConformanceTests = tasks.register("generateConformanceTests") { + classpath = sourceSets.main.get().runtimeClasspath + + dependsOn(mockClientJar) + dependsOn(tasks.named("bufGenerateMain")) + + args = listOf( + mockClientJar.get().archiveFile.get().asFile.absolutePath + ) + + mainClass.set("kotlinx.rpc.protoc.gen.test.GenerateConformanceTestsKt") +} + + +tasks.test { + environment("MOCK_CLIENT_JAR", mockClientJar.get().archiveFile.get().asFile.absolutePath) + + useJUnitPlatform() + + dependsOn(generateConformanceTests) +} diff --git a/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceClient.kt b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceClient.kt new file mode 100644 index 000000000..8d4b67116 --- /dev/null +++ b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceClient.kt @@ -0,0 +1,364 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.protoc.gen.test + +import com.google.protobuf.conformance.ConformanceRequest +import com.google.protobuf.conformance.ConformanceRequestInternal +import com.google.protobuf.conformance.ConformanceResponse +import com.google.protobuf.conformance.ConformanceResponseInternal +import com.google.protobuf.conformance.FailureSet +import com.google.protobuf.conformance.FailureSetInternal +import com.google.protobuf.conformance.TestCategory +import com.google.protobuf.conformance.WireFormat.* +import com.google.protobuf.conformance.invoke +import kotlinx.rpc.grpc.codec.MessageCodec +import kotlinx.rpc.grpc.codec.WithCodec +import kotlinx.rpc.protobuf.internal.InternalMessage +import kotlinx.rpc.protobuf.internal.ProtobufException +import kotlin.reflect.KClass + +// Adapted from +// https://github.com/protocolbuffers/protobuf/blob/main/conformance/ConformanceJava.java +// and +// https://github.com/bufbuild/protobuf-conformance/blob/main/impl/baseline/runner.ts +internal class ConformanceClient { + // todo text and json formats +// private var typeRegistry: TypeRegistry? = null + + private fun readFromStdin(buf: ByteArray, len: Int): Boolean { + var len = len + var ofs = 0 + while (len > 0) { + val read = System.`in`.read(buf, ofs, len) + if (read == -1) { + return false // EOF + } + ofs += read + len -= read + } + + return true + } + + private fun writeToStdout(buf: ByteArray) { + System.out.write(buf) + } + + // Returns -1 on EOF (the actual values will always be positive). + private fun readLittleEndianIntFromStdin(): Int { + val buf = ByteArray(4) + if (!readFromStdin(buf, 4)) { + return -1 + } + return ((buf[0].toInt() and 0xff) + or ((buf[1].toInt() and 0xff) shl 8) + or ((buf[2].toInt() and 0xff) shl 16) + or ((buf[3].toInt() and 0xff) shl 24)) + } + + private fun writeLittleEndianIntToStdout(int: Int) { + val buf = ByteArray(4) + buf[0] = int.toByte() + buf[1] = (int shr 8).toByte() + buf[2] = (int shr 16).toByte() + buf[3] = (int shr 24).toByte() + writeToStdout(buf) + } + + private fun testMessageKClassOf(messageType: String): KClass<*> { + return when (messageType) { + "protobuf_test_messages.proto3.TestAllTypesProto3" -> com.google.protobuf_test_messages.proto3.TestAllTypesProto3::class +// "protobuf_test_messages.proto2.TestAllTypesProto2" -> return TestAllTypesProto2::class.java +// "protobuf_test_messages.editions.TestAllTypesEdition2023" -> return TestAllTypesEdition2023::class.java + "protobuf_test_messages.editions.proto3.TestAllTypesProto3" -> com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3::class +// "protobuf_test_messages.editions.proto2.TestAllTypesProto2" -> return TestMessagesProto2Editions.TestAllTypesProto2::class.java + else -> error( + "Protobuf request has unexpected payload type: $messageType" + ) + } + } + + private fun doTest(request: ConformanceRequest): ConformanceResponse { + val testMessage: InternalMessage + val codec: MessageCodec + val messageType: String = request.messageType + + // todo support extensions +// val extensions: ExtensionRegistry? = ExtensionRegistry.newInstance() +// createTestFile(messageType) +// .getMethod("registerAllExtensions", ExtensionRegistry::class.java) +// .invoke(null, extensions) + + when (request.payload) { + is ConformanceRequest.Payload.ProtobufPayload -> { + try { + @Suppress("UNCHECKED_CAST") + codec = testMessageKClassOf(messageType) + .annotations + .filterIsInstance() + .singleOrNull() + ?.codec + ?.objectInstance as? MessageCodec + ?: error("Codec must be an object for $messageType") + + val binary = (request.payload as ConformanceRequest.Payload.ProtobufPayload).value + + testMessage = codec.decode(binary.inputStream() /*extensions*/) as InternalMessage + } catch (e: ProtobufException) { + return ConformanceResponse { + result = ConformanceResponse.Result.ParseError( + e.message ?: "ProtobufException with unknown message of type ${e.javaClass.name}" + ) + } + } + } + + is ConformanceRequest.Payload.JsonPayload -> { + error("JSON payloads are not supported by the conformance client.") +// try { +// var parser: JsonFormat.Parser = JsonFormat.parser().usingTypeRegistry(typeRegistry) +// if (request.getTestCategory() +// === Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST +// ) { +// parser = parser.ignoringUnknownFields() +// } +// val builder: AbstractMessage.Builder<*> = +// createTestMessage(messageType).getMethod("newBuilder") +// .invoke(null) as AbstractMessage.Builder<*> +// parser.merge(request.getJsonPayload(), builder) +// testMessage = builder.build() as AbstractMessage +// } catch (e: ProtobufException) { +// return ConformanceResponse { +// result = ConformanceResponse.Result.ParseError( +// e.message ?: "ProtobufException with unknown message of type ${e.javaClass.name}" +// ) +// } +// } catch (e: Exception) { +// throw RuntimeException(e) +// } + } + + is ConformanceRequest.Payload.TextPayload -> { + error("TEXT_FORMAT payloads are not supported by the conformance client.") +// try { +// val builder: AbstractMessage.Builder<*> = +// createTestMessage(messageType).getMethod("newBuilder") +// .invoke(null) as AbstractMessage.Builder<*> +// TextFormat.merge(request.getTextPayload(), extensions, builder) +// testMessage = builder.build() as AbstractMessage +// } catch (e: Exception) { // todo specific exceptions +// return ConformanceResponse { +// result = ConformanceResponse.Result.ParseError( +// e.message ?: "Exception with unknown message of type ${e.javaClass.name}" +// ) +// } +// } catch (e: Exception) { +// throw RuntimeException(e) +// } + } + + else -> { + error("Request didn't have payload.") + } + } + + return when (request.requestedOutputFormat) { + UNSPECIFIED -> error("Unspecified output format.") + + PROTOBUF -> { + val messageString: ByteArray = codec.encode(testMessage).readBytes() + + ConformanceResponse { + result = ConformanceResponse.Result.ProtobufPayload(messageString) + } + } + + JSON -> { + error("JSON output format is not supported by the conformance client.") +// try { +// ConformanceResponse { +// result = ConformanceResponse.Result.JsonPayload( +// JsonFormat.printer().usingTypeRegistry(typeRegistry).print(testMessage) +// ) +// } +// } catch (e: ProtobufException) { +// ConformanceResponse { +// result = ConformanceResponse.Result.SerializeError( +// e.message ?: "ProtobufException with unknown message of type ${e.javaClass.name}" +// ) +// } +// } catch (e: IllegalArgumentException) { +// ConformanceResponse { +// result = ConformanceResponse.Result.SerializeError( +// e.message ?: "IllegalArgumentException with unknown message of type ${e.javaClass.name}" +// ) +// } +// } + } + + TEXT_FORMAT -> ConformanceResponse { + error("TEXT_FORMAT output format is not supported by the conformance client.") +// result = ConformanceResponse.Result.TextPayload( +// TextFormat.printer().printToString(testMessage) +// ) + } + + else -> { + error("Unexpected request output format: ${request.requestedOutputFormat}.") + } + } + } + + private fun doTest(test: (ConformanceRequest) -> ConformanceResponse): Boolean { + val bytes = readLittleEndianIntFromStdin() + + if (bytes == -1) { + return false // EOF + } + + val serializedInput = ByteArray(bytes) + + if (!readFromStdin(serializedInput, bytes)) { + throw RuntimeException("Unexpected EOF from test program.") + } + + val request: ConformanceRequest = ConformanceRequestInternal.CODEC + .decode(serializedInput.inputStream()) + + // The conformance runner will request a list of failures as the first request. + // This will be known by message_type == "conformance.FailureSet", a conformance + // test should return a serialized FailureSet in protobuf_payload. + val response = if (request.messageType == "conformance.FailureSet") { + ConformanceResponse { + result = ConformanceResponse.Result.ProtobufPayload( + FailureSetInternal.CODEC.encode( + FailureSet {} + ).readBytes() + ) + } + } else { + test(request) + } + + val serializedOutput = ConformanceResponseInternal.CODEC + .encode(response).readBytes() + + writeLittleEndianIntToStdout(serializedOutput.size) + writeToStdout(serializedOutput) + + return true + } + + fun runMockTest(): Boolean { + return doTest { + if (`is ProtobufInput_UnknownOrdering_ProtobufOutput`(it)) { + return@doTest ConformanceResponse { + result = ConformanceResponse.Result.ProtobufPayload(ByteArray(0)) + } + } + + ConformanceResponse { + result = ConformanceResponse.Result.RuntimeError("Mock test") + } + } + } + + @Suppress("FunctionName") + private fun `is ProtobufInput_UnknownOrdering_ProtobufOutput`( + request: ConformanceRequest, + ): Boolean { + if (request.testCategory != TestCategory.BINARY_TEST) { + return false + } + + if (request.requestedOutputFormat != PROTOBUF) { + return false + } + + if ( + request.messageType != "protobuf_test_messages.proto3.TestAllTypesProto3" && + request.messageType != "protobuf_test_messages.proto2.TestAllTypesProto2" && + request.messageType != "protobuf_test_messages.editions.proto2.TestAllTypesProto2" && + request.messageType != "protobuf_test_messages.editions.proto3.TestAllTypesProto3" + ) { + return false + } + + if (request.payload !is ConformanceRequest.Payload.ProtobufPayload) { + return false + } + + val payload = (request.payload as ConformanceRequest.Payload.ProtobufPayload).value + + if (payload.size != ProtobufInput_UnknownOrdering_ProtobufOutput_Payload.size) { + return false + } + + if (!payload.contentEquals(ProtobufInput_UnknownOrdering_ProtobufOutput_Payload)) { + return false + } + + return true + } + + @Suppress("PrivatePropertyName") + private val ProtobufInput_UnknownOrdering_ProtobufOutput_Payload = byteArrayOf( + -46, 41, 3, 97, 98, 99, -48, 41, 123, -46, 41, 3, 100, 101, 102, -48, 41, -56, 3 + ) + + fun runConformanceTest(): Boolean { + // typeRegistry = +// TypeRegistry.newBuilder() +// .add(TestMessagesProto3.TestAllTypesProto3.getDescriptor()) +// .add( +// com.google.protobuf_test_messages.editions.proto3.TestMessagesProto3Editions +// .TestAllTypesProto3.getDescriptor() +// ) +// .build() + + return doTest { request -> + val responseResult = runCatching { + doTest(request) + } + + responseResult.fold( + onSuccess = { it }, + onFailure = { + val message = it.message ?: "Unknown error" + + if (`is ProtobufInput_UnknownOrdering_ProtobufOutput`(request)) { + ConformanceResponse { + result = ConformanceResponse.Result.ProtobufPayload(message.encodeToByteArray()) + } + } else { + ConformanceResponse { + result = ConformanceResponse.Result.RuntimeError(message) + } + } + } + ) + } + } +} + +fun main(args: Array) { + val client = ConformanceClient() + + if (args.size != 1) { + error("Expected one argument: run mode (mock|conformance).") + } + + if (args[0] == "mock") { + do { + // test + } while (client.runMockTest()) + } else if (args[0] == "conformance") { + do { + // test + } while (client.runConformanceTest()) + } else { + error("Invalid run mode: ${args[0]}") + } +} diff --git a/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/GenerateConformanceTests.kt b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/GenerateConformanceTests.kt new file mode 100644 index 000000000..6a222b060 --- /dev/null +++ b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/GenerateConformanceTests.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.protoc.gen.test + +import CONFORMANCE_OUTPUT_DIR +import kotlinx.rpc.protoc.gen.test.runner.createConformanceTestFiles +import kotlinx.rpc.protoc.gen.test.runner.execConformanceTestRunner +import kotlinx.rpc.protoc.gen.test.runner.getJavaClient +import kotlin.io.path.Path +import kotlin.io.path.absolutePathString + +fun main(args: Array) { + val jarPath = args[0] + + val executable = getJavaClient(jarPath, "mock") + + val outputDir = Path(CONFORMANCE_OUTPUT_DIR).resolve("mock") + + val (failingTestsFile, textFormatFailingTestsFile) = createConformanceTestFiles(outputDir) + + execConformanceTestRunner( + outputDir = outputDir, + failingTestsFile = failingTestsFile, + textFormatFailingTestsFile = textFormatFailingTestsFile, + executable = executable.absolutePathString(), + ).onFailure { + throw it + }.onSuccess { + if (it.exitCode != 1 && it.exitCode != 0) { + println(""" + |stdout: + | ${it.stdout.joinToString("${System.lineSeparator()}| ")} + |stderr: + | ${it.stderr.joinToString("${System.lineSeparator()}| ")} + """.trimMargin()) + + error("Mock tests failed with non 1 exit code: ${it.exitCode}") + } + } +} diff --git a/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/javaClient.kt b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/javaClient.kt new file mode 100644 index 000000000..dd9b3a322 --- /dev/null +++ b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/javaClient.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.protoc.gen.test.runner + +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.attribute.PosixFilePermission +import kotlin.io.path.writeText + +fun getJavaClient(jarPath: String, mode: String): Path { + val executable = Files.createTempFile("clientRunner", ".sh") + + Files.setPosixFilePermissions(executable, PosixFilePermission.entries.toSet()) + + executable.writeText( + """ + #!/bin/bash + + java -jar $jarPath $mode + + """.trimIndent() + ) + + return executable +} diff --git a/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/runner.kt b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/runner.kt new file mode 100644 index 000000000..58efe5b4a --- /dev/null +++ b/tests/protobuf-conformance/src/main/kotlin/kotlinx/rpc/protoc/gen/test/runner/runner.kt @@ -0,0 +1,74 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.protoc.gen.test.runner + +import CONFORMANCE_EXECUTABLE_PATH +import java.nio.file.Files +import java.nio.file.Path +import kotlin.io.path.createFile +import kotlin.io.path.createParentDirectories +import kotlin.io.path.deleteIfExists +import kotlin.io.path.readLines + +class RunResult( + val exitCode: Int, + val stdout: List, + val stderr: List, +) + +fun execConformanceTestRunner( + outputDir: Path, + failingTestsFile: Path?, + textFormatFailingTestsFile: Path?, + executable: String, +): Result { + val stdoutStream = Files.createTempFile("stdout", ".log") + val errorStream = Files.createTempFile("error", ".log") + + return runCatching { + val process = ProcessBuilder( + CONFORMANCE_EXECUTABLE_PATH, + "--maximum_edition", "MAX", + "--enforce_recommended", + "--failure_list", failingTestsFile.toString(), + "--text_format_failure_list", textFormatFailingTestsFile.toString(), + "--output_dir", + outputDir.toString(), + executable, + ).redirectError(errorStream.toFile()) + .redirectOutput(stdoutStream.toFile()) + + val exitCode = process.start().waitFor() + + RunResult( + exitCode = exitCode, + stdout = stdoutStream.readLines(), + stderr = errorStream.readLines(), + ) + } +} + +fun createConformanceTestFiles( + outputDir: Path, + createBlank: Boolean = true, +): Pair { + val failingTestsFile = outputDir.resolve("failing_tests.txt").apply { + createParentDirectories() + if (createBlank) { + deleteIfExists() + createFile() + } + } + + val textFormatFailingTestsFile = outputDir.resolve("text_format_failing_tests.txt").apply { + createParentDirectories() + if (createBlank) { + deleteIfExists() + createFile() + } + } + + return failingTestsFile to textFormatFailingTestsFile +} diff --git a/tests/protobuf-conformance/src/test/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceTest.kt b/tests/protobuf-conformance/src/test/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceTest.kt new file mode 100644 index 000000000..060b640e6 --- /dev/null +++ b/tests/protobuf-conformance/src/test/kotlin/kotlinx/rpc/protoc/gen/test/ConformanceTest.kt @@ -0,0 +1,101 @@ +/* + * Copyright 2023-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license. + */ + +package kotlinx.rpc.protoc.gen.test + +import CONFORMANCE_OUTPUT_DIR +import kotlinx.rpc.protoc.gen.test.runner.createConformanceTestFiles +import kotlinx.rpc.protoc.gen.test.runner.execConformanceTestRunner +import kotlinx.rpc.protoc.gen.test.runner.getJavaClient +import org.junit.jupiter.api.DynamicTest +import org.junit.jupiter.api.TestFactory +import org.junit.jupiter.api.TestInstance +import org.junit.jupiter.api.fail +import java.util.stream.Stream +import kotlin.io.path.Path +import kotlin.io.path.absolutePathString +import kotlin.io.path.readLines + +@TestInstance(TestInstance.Lifecycle.PER_METHOD) +class ConformanceTest { + @TestFactory + fun conformance(): Stream { + val jarPath = System.getenv("MOCK_CLIENT_JAR") + ?: error("Expected environment variable 'MOCK_CLIENT_JAR' to be set") + + val executable = getJavaClient(jarPath, "conformance") + + val outputDir = Path(CONFORMANCE_OUTPUT_DIR).resolve("conformance") + + val (failingTestsFile, textFormatFailingTestsFile) = createConformanceTestFiles(outputDir) + + val result = execConformanceTestRunner( + outputDir = outputDir, + failingTestsFile = failingTestsFile, + textFormatFailingTestsFile = textFormatFailingTestsFile, + executable = executable.absolutePathString(), + ) + + result.fold( + onSuccess = { run -> + if (run.exitCode != 1 && run.exitCode != 0) { + fail( + """ + |Conformance tests failed with non 1 exit code: ${run.exitCode} + | + |stdout: + | ${run.stdout.joinToString("${System.lineSeparator()}| ")} + |stderr: + | ${run.stderr.joinToString("${System.lineSeparator()}| ")} + """.trimMargin() + ) + } + }, + onFailure = { + fail(it) + } + ) + + val mockDir = Path(CONFORMANCE_OUTPUT_DIR).resolve("mock") + val (baselineFile, _) = createConformanceTestFiles(mockDir, createBlank = false) + + val baseline = baselineFile + .readLines() + .map { it.substringBefore('#').trim() } + .filter { it.isNotEmpty() } + .toSet() + + val fails = failingTestsFile.readLines().associate { + it.substringBefore('#').trim() to it.substringAfter('#').trim() + } + + val passed = baseline - fails.keys + + println( + """ + + === Conformance Test Results === + Total baseline tests: ${baseline.size} + [+] Passed tests: ${passed.size} + [-] Failed tests: ${fails.size} + """.trimIndent() + ) + + return (fails.entries.map { (test, message) -> + DynamicTest.dynamicTest(test.testDisplayName()) { + fail(message) + } + } + passed.map { test -> + DynamicTest.dynamicTest(test.testDisplayName()) { + println("PASSED") + } + }).stream() + } + + private fun String.testDisplayName(): String { + return replace(".", " ") + .replace("[", "(") + .replace("]", ")") + } +}