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 61f9897aa..f900fabf0 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 @@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.AnyInternal.Companion.decodeWith(msg: com. } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 66760e11f..f1cc4a6b9 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 @@ -243,8 +243,12 @@ public fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com. } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -365,8 +369,12 @@ public fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: c } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -440,8 +448,12 @@ public fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: co } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 a21fd44ae..11effb913 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 @@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.DurationInternal.Companion.decodeWith(msg: } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 710388e37..9bb601255 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 @@ -59,8 +59,12 @@ public fun com.google.protobuf.kotlin.EmptyInternal.Companion.decodeWith(msg: co val tag = decoder.readTag() ?: break // EOF, we read the whole message when { else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 da3284fca..b7e8411cb 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 @@ -70,8 +70,12 @@ public fun com.google.protobuf.kotlin.FieldMaskInternal.Companion.decodeWith(msg } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 4c79763a7..6b4c60a32 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 @@ -67,8 +67,12 @@ public fun com.google.protobuf.kotlin.SourceContextInternal.Companion.decodeWith } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 4f69c5022..a0cf20b59 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 @@ -176,8 +176,12 @@ public fun com.google.protobuf.kotlin.StructInternal.Companion.decodeWith(msg: c } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -288,8 +292,12 @@ public fun com.google.protobuf.kotlin.ValueInternal.Companion.decodeWith(msg: co } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -362,8 +370,12 @@ public fun com.google.protobuf.kotlin.ListValueInternal.Companion.decodeWith(msg } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -420,8 +432,12 @@ public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.Compani } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 c3b2f51ea..1a78799e5 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 @@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.TimestampInternal.Companion.decodeWith(msg } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 39e19e2d2..d688524dc 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 @@ -336,8 +336,12 @@ public fun com.google.protobuf.kotlin.TypeInternal.Companion.decodeWith(msg: com } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -482,8 +486,12 @@ public fun com.google.protobuf.kotlin.FieldInternal.Companion.decodeWith(msg: co } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -624,8 +632,12 @@ public fun com.google.protobuf.kotlin.EnumInternal.Companion.decodeWith(msg: com } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -710,8 +722,12 @@ public fun com.google.protobuf.kotlin.EnumValueInternal.Companion.decodeWith(msg } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -776,8 +792,12 @@ public fun com.google.protobuf.kotlin.OptionInternal.Companion.decodeWith(msg: c } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 19f862504..f50f6c53f 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 @@ -387,8 +387,12 @@ public fun com.google.protobuf.kotlin.DoubleValueInternal.Companion.decodeWith(m } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -430,8 +434,12 @@ public fun com.google.protobuf.kotlin.FloatValueInternal.Companion.decodeWith(ms } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -473,8 +481,12 @@ public fun com.google.protobuf.kotlin.Int64ValueInternal.Companion.decodeWith(ms } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -516,8 +528,12 @@ public fun com.google.protobuf.kotlin.UInt64ValueInternal.Companion.decodeWith(m } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -559,8 +575,12 @@ public fun com.google.protobuf.kotlin.Int32ValueInternal.Companion.decodeWith(ms } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -602,8 +622,12 @@ public fun com.google.protobuf.kotlin.UInt32ValueInternal.Companion.decodeWith(m } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -645,8 +669,12 @@ public fun com.google.protobuf.kotlin.BoolValueInternal.Companion.decodeWith(msg } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -688,8 +716,12 @@ public fun com.google.protobuf.kotlin.StringValueInternal.Companion.decodeWith(m } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -731,8 +763,12 @@ public fun com.google.protobuf.kotlin.BytesValueInternal.Companion.decodeWith(ms } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 79a3324d9..630c4dd82 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 @@ -91,16 +91,31 @@ public interface WireDecoder : AutoCloseable { popLimit(limit) } - public fun skipValue(writeType: WireType) { - when (writeType) { + public fun skipValue(tag: KTag) { + when (tag.wireType) { WireType.VARINT -> readInt64() WireType.FIXED32 -> readFixed32() WireType.FIXED64 -> readFixed64() WireType.LENGTH_DELIMITED -> readBytes() - WireType.START_GROUP -> throw ProtobufDecodingException("Unexpected START_GROUP wire type (KRPC-193)") + WireType.START_GROUP -> skipGroup(tag.fieldNr) WireType.END_GROUP -> {} // nothing to do } } + + private fun skipGroup(startField: Int) { + // read until END_GROUP with the same field number + while (true) { + val t = readTag() ?: throw ProtobufDecodingException.truncatedMessage() + if (t.wireType == WireType.END_GROUP) { + if (t.fieldNr != startField) { + throw ProtobufDecodingException("Mismatched END_GROUP: got ${t.fieldNr}, want $startField") + } + return + } + // recursively skip nested values (groups can nest) + skipValue(t) + } + } } /** diff --git a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.kt b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.kt index 856550539..d000fea08 100644 --- a/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.kt +++ b/protobuf/protobuf-core/src/commonMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.kt @@ -60,6 +60,12 @@ public interface WireEncoder { encode: T.(WireEncoder) -> Unit, ) + public fun writeGroupMessage( + fieldNr: Int, + value: T, + encode: T.(WireEncoder) -> Unit, + ) + } /** diff --git a/protobuf/protobuf-core/src/commonTest/kotlin/kotlinx/rpc/protobuf/test/ProtosTest.kt b/protobuf/protobuf-core/src/commonTest/kotlin/kotlinx/rpc/protobuf/test/ProtosTest.kt index 65338c867..0bb591c0b 100644 --- a/protobuf/protobuf-core/src/commonTest/kotlin/kotlinx/rpc/protobuf/test/ProtosTest.kt +++ b/protobuf/protobuf-core/src/commonTest/kotlin/kotlinx/rpc/protobuf/test/ProtosTest.kt @@ -18,16 +18,29 @@ import kotlinx.rpc.protobuf.input.stream.asInputStream import kotlinx.rpc.protobuf.input.stream.asSource import kotlinx.rpc.protobuf.internal.ProtobufDecodingException import kotlinx.rpc.protobuf.internal.WireEncoder -import test.nested.* +import test.groups.WithGroups +import test.groups.WithGroupsInternal +import test.groups.invoke +import test.nested.NestedOuter +import test.nested.NestedOuterInternal +import test.nested.NotInside +import test.nested.NotInsideInternal import test.nested.invoke import test.recursive.Recursive import test.recursive.RecursiveInternal import test.recursive.RecursiveReq import test.recursive.invoke -import test.submsg.* +import test.submsg.Other +import test.submsg.OtherInternal +import test.submsg.ReferenceInternal +import test.submsg.encodeWith import test.submsg.invoke -import kotlin.collections.iterator -import kotlin.test.* +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertIs +import kotlin.test.assertNull +import kotlin.test.assertTrue class ProtosTest { @@ -411,4 +424,33 @@ class ProtosTest { } } + @Test + fun testGroup() { + val msg = WithGroups { + firstgroup = WithGroups.FirstGroup { + value = 23u + } + secondgroup = listOf( + WithGroups.SecondGroup { + value = "First Item" + }, WithGroups.SecondGroup { + value = "Second Item" + } + ) + oneOfWithGroup = WithGroups.OneOfWithGroup.Testgroup(WithGroups.TestGroup { + value = 42u + }) + } + + val decoded = encodeDecode(msg, WithGroupsInternal.CODEC) + assertEquals(msg.firstgroup.value, decoded.firstgroup.value) + for ((i, group) in msg.secondgroup.withIndex()) { + assertEquals(group.value, decoded.secondgroup[i].value) + } + assertTrue(decoded.oneOfWithGroup is WithGroups.OneOfWithGroup.Testgroup) + assertEquals( + (msg.oneOfWithGroup as WithGroups.OneOfWithGroup.Testgroup).value.value, + (decoded.oneOfWithGroup as WithGroups.OneOfWithGroup.Testgroup).value.value + ) + } } diff --git a/protobuf/protobuf-core/src/commonTest/proto/groups.proto b/protobuf/protobuf-core/src/commonTest/proto/groups.proto new file mode 100644 index 000000000..d092f40cc --- /dev/null +++ b/protobuf/protobuf-core/src/commonTest/proto/groups.proto @@ -0,0 +1,18 @@ +package test.groups; + +message WithGroups { + required group FirstGroup = 1 { + required fixed32 value = 2; + } + + repeated group SecondGroup = 2 { + required string value = 2; + } + + oneof oneOfWithGroup { + int32 anInt32 = 4; + group TestGroup = 3 { + required fixed32 value = 2; + } + } +} \ No newline at end of file diff --git a/protobuf/protobuf-core/src/jvmMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.jvm.kt b/protobuf/protobuf-core/src/jvmMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.jvm.kt index 6054d5668..1bc1e78a9 100644 --- a/protobuf/protobuf-core/src/jvmMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.jvm.kt +++ b/protobuf/protobuf-core/src/jvmMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.jvm.kt @@ -182,6 +182,16 @@ private class WireEncoderJvm(sink: Sink) : WireEncoder { value.encode(this) } + override fun writeGroupMessage( + fieldNr: Int, + value: T, + encode: T.(WireEncoder) -> Unit, + ) { + codedOutputStream.writeTag(fieldNr, WireType.START_GROUP.ordinal) + value.encode(this) + codedOutputStream.writeTag(fieldNr, WireType.END_GROUP.ordinal) + } + private inline fun writePackedInternal( fieldNr: Int, value: List, diff --git a/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.native.kt b/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.native.kt index b8171c74d..2cec9cfff 100644 --- a/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.native.kt +++ b/protobuf/protobuf-core/src/nativeMain/kotlin/kotlinx/rpc/protobuf/internal/WireEncoder.native.kt @@ -4,9 +4,53 @@ package kotlinx.rpc.protobuf.internal -import kotlinx.cinterop.* +import kotlinx.cinterop.ByteVar +import kotlinx.cinterop.CPointer +import kotlinx.cinterop.CValuesRef +import kotlinx.cinterop.ExperimentalForeignApi +import kotlinx.cinterop.StableRef +import kotlinx.cinterop.addressOf +import kotlinx.cinterop.asStableRef +import kotlinx.cinterop.cstr +import kotlinx.cinterop.memScoped +import kotlinx.cinterop.reinterpret +import kotlinx.cinterop.staticCFunction +import kotlinx.cinterop.usePinned import kotlinx.io.Sink -import libprotowire.* +import libprotowire.pw_encoder_delete +import libprotowire.pw_encoder_flush +import libprotowire.pw_encoder_new +import libprotowire.pw_encoder_t +import libprotowire.pw_encoder_write_bool +import libprotowire.pw_encoder_write_bool_no_tag +import libprotowire.pw_encoder_write_bytes +import libprotowire.pw_encoder_write_double +import libprotowire.pw_encoder_write_double_no_tag +import libprotowire.pw_encoder_write_enum +import libprotowire.pw_encoder_write_fixed32 +import libprotowire.pw_encoder_write_fixed32_no_tag +import libprotowire.pw_encoder_write_fixed64 +import libprotowire.pw_encoder_write_fixed64_no_tag +import libprotowire.pw_encoder_write_float +import libprotowire.pw_encoder_write_float_no_tag +import libprotowire.pw_encoder_write_int32 +import libprotowire.pw_encoder_write_int32_no_tag +import libprotowire.pw_encoder_write_int64 +import libprotowire.pw_encoder_write_int64_no_tag +import libprotowire.pw_encoder_write_sfixed32 +import libprotowire.pw_encoder_write_sfixed32_no_tag +import libprotowire.pw_encoder_write_sfixed64 +import libprotowire.pw_encoder_write_sfixed64_no_tag +import libprotowire.pw_encoder_write_sint32 +import libprotowire.pw_encoder_write_sint32_no_tag +import libprotowire.pw_encoder_write_sint64 +import libprotowire.pw_encoder_write_sint64_no_tag +import libprotowire.pw_encoder_write_string +import libprotowire.pw_encoder_write_tag +import libprotowire.pw_encoder_write_uint32 +import libprotowire.pw_encoder_write_uint32_no_tag +import libprotowire.pw_encoder_write_uint64 +import libprotowire.pw_encoder_write_uint64_no_tag import kotlin.experimental.ExperimentalNativeApi import kotlin.native.ref.createCleaner @@ -177,6 +221,12 @@ internal class WireEncoderNative(private val sink: Sink) : WireEncoder { pw_encoder_write_uint32_no_tag(raw, value._size.toUInt()) value.encode(this) } + + override fun writeGroupMessage(fieldNr: Int, value: T, encode: T.(WireEncoder) -> Unit) { + pw_encoder_write_tag(raw, fieldNr, WireType.START_GROUP.ordinal) + value.encode(this) + pw_encoder_write_tag(raw, fieldNr, WireType.END_GROUP.ordinal) + } } public actual fun WireEncoder(sink: Sink): WireEncoder = WireEncoderNative(sink) 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 0cd5a1980..a40b3d191 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 @@ -7,7 +7,16 @@ package kotlinx.rpc.protoc.gen.core import com.google.protobuf.DescriptorProtos import com.google.protobuf.Descriptors import com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest -import kotlinx.rpc.protoc.gen.core.model.* +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 +import kotlinx.rpc.protoc.gen.core.model.FqName +import kotlinx.rpc.protoc.gen.core.model.MessageDeclaration +import kotlinx.rpc.protoc.gen.core.model.MethodDeclaration +import kotlinx.rpc.protoc.gen.core.model.Model +import kotlinx.rpc.protoc.gen.core.model.OneOfDeclaration +import kotlinx.rpc.protoc.gen.core.model.ServiceDeclaration private val nameCache = mutableMapOf() private val modelCache = mutableMapOf() @@ -251,7 +260,7 @@ private fun Descriptors.FieldDescriptor.modelType(): FieldType { Descriptors.FieldDescriptor.Type.SINT64 -> FieldType.IntegralType.SINT64 Descriptors.FieldDescriptor.Type.ENUM -> FieldType.Enum(enumType.toModel()) Descriptors.FieldDescriptor.Type.MESSAGE -> FieldType.Message(lazy { messageType!!.toModel() }) - Descriptors.FieldDescriptor.Type.GROUP -> error("GROUP type is unsupported") + Descriptors.FieldDescriptor.Type.GROUP -> FieldType.Message(lazy { messageType!!.toModel() }) } if (isMapField) { diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/FieldType.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/FieldType.kt index 2992e373c..541a959d2 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/FieldType.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/FieldType.kt @@ -40,7 +40,7 @@ sealed interface FieldType { data class Message(val dec: Lazy) : FieldType { override val defaultValue: String? = null - override val wireType: WireType = WireType.LENGTH_DELIMITED + override val wireType: WireType by lazy { if (dec.value.isGroup) WireType.START_GROUP else WireType.LENGTH_DELIMITED } } data class OneOf(val dec: OneOfDeclaration) : FieldType { @@ -52,7 +52,7 @@ sealed interface FieldType { simpleName: String, override val defaultValue: String, override val wireType: WireType, - override val isPackable: Boolean = true + override val isPackable: Boolean = true, ) : FieldType { STRING("String", "\"\"", WireType.LENGTH_DELIMITED, false), BYTES("ByteArray", "byteArrayOf()", WireType.LENGTH_DELIMITED, false), @@ -77,7 +77,7 @@ sealed interface FieldType { fun FieldType.scalarDefaultSuffix(): String = when (this) { FieldType.IntegralType.BOOL -> "" FieldType.IntegralType.FLOAT -> "f" - FieldType.IntegralType.DOUBLE -> "" + FieldType.IntegralType.DOUBLE -> "" FieldType.IntegralType.INT32 -> "" FieldType.IntegralType.INT64 -> "L" FieldType.IntegralType.UINT32 -> "u" diff --git a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/model.kt b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/model.kt index 9077791ce..56c688f0f 100644 --- a/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/model.kt +++ b/protoc-gen/common/src/main/kotlin/kotlinx/rpc/protoc/gen/core/model/model.kt @@ -33,6 +33,13 @@ data class MessageDeclaration( ) { val isMapEntry = dec.options.mapEntry val isUserFacing = !isMapEntry + + val isGroup by lazy { + val parent = dec.containingType ?: return@lazy false // top-level types can’t be groups + parent.fields.any { f -> + f.type == Descriptors.FieldDescriptor.Type.GROUP && f.messageType == dec + } + } } data class EnumDeclaration( @@ -68,7 +75,7 @@ data class EnumDeclaration( data class OneOfDeclaration( val name: FqName, val variants: List, - val dec: Descriptors.OneofDescriptor + val dec: Descriptors.OneofDescriptor, ) data class FieldDeclaration( @@ -78,9 +85,9 @@ data class FieldDeclaration( val dec: Descriptors.FieldDescriptor, // defines the index in the presenceMask of the Message. // this cannot be the number, as only fields with hasPresence == true are part of the presenceMask - val presenceIdx: Int? = null + val presenceIdx: Int? = null, ) { - val packedFixedSize = type.wireType == WireType.FIXED64 || type.wireType == WireType.FIXED32 + val packedFixedSize by lazy { type.wireType == WireType.FIXED64 || type.wireType == WireType.FIXED32 } val isPartOfOneof: Boolean = dec.realContainingOneof != null 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 96c3a9fbc..85920d03b 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 @@ -72,10 +72,15 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generatePublicMessage(declaration: MessageDeclaration) { if (!declaration.isUserFacing) return + val annotations = mutableListOf() + if (!declaration.isGroup) { + annotations.add("@$WITH_CODEC_ANNO(${declaration.internalClassFullName()}.CODEC::class)") + } + clazz( name = declaration.name.simpleName, declarationType = CodeGenerator.DeclarationType.Interface, - annotations = listOf("@$WITH_CODEC_ANNO(${declaration.internalClassFullName()}.CODEC::class)") + annotations = annotations ) { declaration.actualFields.forEachIndexed { i, field -> property( @@ -239,6 +244,8 @@ class ModelToProtobufKotlinCommonGenerator( private fun CodeGenerator.generateCodecObject(declaration: MessageDeclaration) { if (!declaration.isUserFacing) return + // the CODEC object is not necessary for groups, as they are inlined messages + if (declaration.isGroup) return val msgFqName = declaration.name.safeFullName() val inputStreamFqName = "kotlinx.rpc.protobuf.input.stream.InputStream" @@ -291,25 +298,49 @@ class ModelToProtobufKotlinCommonGenerator( } } - private fun CodeGenerator.generateMessageDecoder(declaration: MessageDeclaration) = function( - name = "decodeWith", - args = "msg: ${declaration.internalClassFullName()}, decoder: $PB_PKG.WireDecoder", - annotations = listOf("@$INTERNAL_RPC_API_ANNO"), - contextReceiver = "${declaration.internalClassFullName()}.Companion", - returnType = "Unit", - ) { - whileBlock("true") { - code("val tag = decoder.readTag() ?: break // EOF, we read the whole message") - whenBlock { - declaration.actualFields.forEach { field -> readMatchCase(field) } - whenCase("else") { - code("// we are currently just skipping unknown fields (KRPC-191)") - code("decoder.skipValue(tag.wireType)") + private fun CodeGenerator.generateMessageDecoder(declaration: MessageDeclaration) { + var args = "msg: ${declaration.internalClassFullName()}, decoder: $PB_PKG.WireDecoder"; + if (declaration.isGroup) { + args += ", startGroup: $PB_PKG.KTag" + } + + function( + name = "decodeWith", + args = args, + annotations = listOf("@$INTERNAL_RPC_API_ANNO"), + contextReceiver = "${declaration.internalClassFullName()}.Companion", + returnType = "Unit", + ) { + whileBlock("true") { + if (declaration.isGroup) { + code("val tag = decoder.readTag() ?: throw ProtobufDecodingException(\"Missing END_GROUP tag for field: \${startGroup.fieldNr}.\")") + ifBranch(condition = "tag.wireType == $PB_PKG.WireType.END_GROUP", ifBlock = { + ifBranch(condition = "tag.fieldNr != startGroup.fieldNr", ifBlock = { + code("throw ProtobufDecodingException(\"Wrong END_GROUP tag. Expected \${startGroup.fieldNr}, got \${tag.fieldNr}.\")") + }) + code("return") + }) + } else { + code("val tag = decoder.readTag() ?: break // EOF, we read the whole message") + } + + whenBlock { + declaration.actualFields.forEach { field -> readMatchCase(field) } + whenCase("else") { + if (!declaration.isGroup) { + // fail if we come across an END_GROUP in a normal message + ifBranch(condition = "tag.wireType == $PB_PKG.WireType.END_GROUP", ifBlock = { + code("throw $PB_PKG.ProtobufDecodingException(\"Unexpected END_GROUP tag.\")") + }) + } + code("// we are currently just skipping unknown fields (KRPC-191)") + code("decoder.skipValue(tag)") + } } } - } - // TODO: Make lists and maps immutable (KRPC-190) + // TODO: Make lists and maps immutable (KRPC-190) + } } private fun CodeGenerator.readMatchCase( @@ -374,7 +405,9 @@ class ModelToProtobufKotlinCommonGenerator( } is FieldType.Message -> { - whenCase("tag.fieldNr == ${field.number} && tag.wireType == $PB_PKG.WireType.LENGTH_DELIMITED") { + val msg = fieldType.dec.value + + whenCase("tag.fieldNr == ${field.number} && tag.wireType == $PB_PKG.WireType.${fieldType.wireType.name}") { if (field.presenceIdx != null) { // check if the current sub message object was already set, if not, set a new one // to set the field's presence tracker to true @@ -448,8 +481,13 @@ class ModelToProtobufKotlinCommonGenerator( } is FieldType.Message -> { - val internalClassName = fieldType.dec.value.internalClassFullName() - code("decoder.readMessage($lvalue.asInternal(), $internalClassName::decodeWith)") + val msg = fieldType.dec.value + val fullClassName = msg.internalClassFullName() + if (msg.isGroup) { + code("$fullClassName.decodeWith($lvalue.asInternal(), decoder, tag)") + } else { + code("decoder.readMessage($lvalue.asInternal(), $fullClassName::decodeWith)") + } } is FieldType.Map -> { @@ -527,7 +565,8 @@ class ModelToProtobufKotlinCommonGenerator( valueVar } - encFunc = type.value.decodeEncodeFuncName() + val innerType = type.value + encFunc = innerType.decodeEncodeFuncName() when { isPacked && packedWithFixedSize -> code("encoder.writePacked${encFunc!!}(fieldNr = $number, value = $packedValueVar)") @@ -539,8 +578,8 @@ class ModelToProtobufKotlinCommonGenerator( })" ) - type.value is FieldType.Message -> scope("$valueVar.forEach") { - code("encoder.writeMessage(fieldNr = ${number}, value = it.asInternal()) { encodeWith(it) }") + innerType is FieldType.Message -> scope("$valueVar.forEach") { + generateEncodeFieldValue("it", innerType, number, isPacked = false, packedWithFixedSize = false) } else -> { @@ -578,7 +617,10 @@ class ModelToProtobufKotlinCommonGenerator( } } - is FieldType.Message -> code("encoder.writeMessage(fieldNr = ${number}, value = $valueVar.asInternal()) { encodeWith(it) }") + is FieldType.Message -> { + val writeMethod = if (type.dec.value.isGroup) "writeGroupMessage" else "writeMessage" + code("encoder.$writeMethod(fieldNr = ${number}, value = $valueVar.asInternal()) { encodeWith(it) }") + } } } @@ -729,14 +771,21 @@ class ModelToProtobufKotlinCommonGenerator( val valueSize by lazy { field.type.valueSizeCall(variable, field.number, field.dec.isPacked) } val tagSize = tagSizeCall(field.number, field.type.wireType) - when (field.type) { + when (val fieldType = 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") } - is FieldType.Message, + is FieldType.Message -> if (fieldType.dec.value.isGroup) { + val groupTagSize = tagSizeCall(field.number, WireType.START_GROUP) + // the group message size is the size of the message plus the start and end group tags + code("__result += $valueSize.let { (2 * $groupTagSize) + it }") + } else { + code("__result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") + } + FieldType.IntegralType.STRING, FieldType.IntegralType.BYTES, -> code("__result += $valueSize.let { $tagSize + ${int32SizeCall("it")} + it }") diff --git a/.setup_protoscope.sh b/setup_protocscope.sh old mode 100644 new mode 100755 similarity index 100% rename from .setup_protoscope.sh rename to setup_protocscope.sh diff --git a/tests/protobuf-conformance/src/main/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 index 16a272564..0756143b7 100644 --- a/tests/protobuf-conformance/src/main/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 @@ -254,8 +254,12 @@ fun com.google.protobuf.conformance.TestStatusInternal.Companion.decodeWith(msg: } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -312,8 +316,12 @@ fun com.google.protobuf.conformance.FailureSetInternal.Companion.decodeWith(msg: } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -430,8 +438,12 @@ fun com.google.protobuf.conformance.ConformanceRequestInternal.Companion.decodeW } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -577,8 +589,12 @@ fun com.google.protobuf.conformance.ConformanceResponseInternal.Companion.decode } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -656,8 +672,12 @@ fun com.google.protobuf.conformance.JspbEncodingConfigInternal.Companion.decodeW } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } diff --git a/tests/protobuf-conformance/src/main/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 index 2ccd5e011..fb1f82144 100644 --- a/tests/protobuf-conformance/src/main/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 @@ -2583,8 +2583,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3344,8 +3348,12 @@ fun com.google.protobuf_test_messages.editions.proto3.ForeignMessageInternal.Com } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3381,8 +3389,12 @@ fun com.google.protobuf_test_messages.editions.proto3.NullHypothesisProto3Intern val tag = decoder.readTag() ?: break // EOF, we read the whole message when { else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3414,8 +3426,12 @@ fun com.google.protobuf_test_messages.editions.proto3.EnumOnlyProto3Internal.Com val tag = decoder.readTag() ?: break // EOF, we read the whole message when { else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3468,8 +3484,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3523,8 +3543,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3578,8 +3602,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3633,8 +3661,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3688,8 +3720,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3743,8 +3779,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3798,8 +3838,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3853,8 +3897,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3908,8 +3956,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3963,8 +4015,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4018,8 +4074,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4073,8 +4133,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4128,8 +4192,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4183,8 +4251,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4238,8 +4310,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4293,8 +4369,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4355,8 +4435,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4417,8 +4501,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4472,8 +4560,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4527,8 +4619,12 @@ fun com.google.protobuf_test_messages.editions.proto3.TestAllTypesProto3Internal } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } diff --git a/tests/protobuf-conformance/src/main/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 index df9366597..3def5c591 100644 --- a/tests/protobuf-conformance/src/main/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 @@ -2583,8 +2583,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.Companio } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3344,8 +3348,12 @@ fun com.google.protobuf_test_messages.proto3.ForeignMessageInternal.Companion.de } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3381,8 +3389,12 @@ fun com.google.protobuf_test_messages.proto3.NullHypothesisProto3Internal.Compan val tag = decoder.readTag() ?: break // EOF, we read the whole message when { else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3414,8 +3426,12 @@ fun com.google.protobuf_test_messages.proto3.EnumOnlyProto3Internal.Companion.de val tag = decoder.readTag() ?: break // EOF, we read the whole message when { else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3468,8 +3484,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.NestedMe } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3523,8 +3543,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3578,8 +3602,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt64 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3633,8 +3661,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint3 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3688,8 +3720,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapUint6 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3743,8 +3779,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint3 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3798,8 +3838,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSint6 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3853,8 +3897,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3908,8 +3956,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapFixed } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -3963,8 +4015,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixe } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4018,8 +4074,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapSfixe } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4073,8 +4133,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4128,8 +4192,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapInt32 } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4183,8 +4251,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapBoolB } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4238,8 +4310,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4293,8 +4369,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4355,8 +4435,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4417,8 +4501,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4472,8 +4560,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } @@ -4527,8 +4619,12 @@ fun com.google.protobuf_test_messages.proto3.TestAllTypesProto3Internal.MapStrin } else -> { + if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) { + throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.") + } + // we are currently just skipping unknown fields (KRPC-191) - decoder.skipValue(tag.wireType) + decoder.skipValue(tag) } } } 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 index e2e21c640..14dce3c77 100644 --- 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 @@ -84,11 +84,11 @@ class ConformanceTest { return (fails.entries.map { (test, message) -> DynamicTest.dynamicTest(test.testDisplayName()) { - fail(message) + fail("FAILED: '${test}' with: $message") } } + passed.map { test -> DynamicTest.dynamicTest(test.testDisplayName()) { - println("PASSED") + println("PASSED: '${test}'") } }).stream() }