Skip to content

Commit 000b2fa

Browse files
authored
protobuf: Add support for deprecated groups (#472)
* protobuf: Add Groups encode/decode Signed-off-by: Johannes Zottele <[email protected]> * protobuf: Add group lists Signed-off-by: Johannes Zottele <[email protected]> * protobuf: Fix unexpected END_GROUP Signed-off-by: Johannes Zottele <[email protected]> * protobuf: Add oneof groups test Signed-off-by: Johannes Zottele <[email protected]> * protobuf: Fix name in ConformanceTest.kt Signed-off-by: Johannes Zottele <[email protected]> * pb: Revert autolint changes Signed-off-by: Johannes Zottele <[email protected]> * pb: Remove copyright headers Signed-off-by: Johannes Zottele <[email protected]> --------- Signed-off-by: Johannes Zottele <[email protected]>
1 parent d7e8271 commit 000b2fa

File tree

25 files changed

+651
-125
lines changed

25 files changed

+651
-125
lines changed

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Any.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.AnyInternal.Companion.decodeWith(msg: com.
7676
}
7777

7878
else -> {
79+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
80+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
81+
}
82+
7983
// we are currently just skipping unknown fields (KRPC-191)
80-
decoder.skipValue(tag.wireType)
84+
decoder.skipValue(tag)
8185
}
8286
}
8387
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Api.kt

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,12 @@ public fun com.google.protobuf.kotlin.ApiInternal.Companion.decodeWith(msg: com.
243243
}
244244

245245
else -> {
246+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
247+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
248+
}
249+
246250
// we are currently just skipping unknown fields (KRPC-191)
247-
decoder.skipValue(tag.wireType)
251+
decoder.skipValue(tag)
248252
}
249253
}
250254
}
@@ -365,8 +369,12 @@ public fun com.google.protobuf.kotlin.MethodInternal.Companion.decodeWith(msg: c
365369
}
366370

367371
else -> {
372+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
373+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
374+
}
375+
368376
// we are currently just skipping unknown fields (KRPC-191)
369-
decoder.skipValue(tag.wireType)
377+
decoder.skipValue(tag)
370378
}
371379
}
372380
}
@@ -440,8 +448,12 @@ public fun com.google.protobuf.kotlin.MixinInternal.Companion.decodeWith(msg: co
440448
}
441449

442450
else -> {
451+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
452+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
453+
}
454+
443455
// we are currently just skipping unknown fields (KRPC-191)
444-
decoder.skipValue(tag.wireType)
456+
decoder.skipValue(tag)
445457
}
446458
}
447459
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Duration.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.DurationInternal.Companion.decodeWith(msg:
7676
}
7777

7878
else -> {
79+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
80+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
81+
}
82+
7983
// we are currently just skipping unknown fields (KRPC-191)
80-
decoder.skipValue(tag.wireType)
84+
decoder.skipValue(tag)
8185
}
8286
}
8387
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Empty.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ public fun com.google.protobuf.kotlin.EmptyInternal.Companion.decodeWith(msg: co
5959
val tag = decoder.readTag() ?: break // EOF, we read the whole message
6060
when {
6161
else -> {
62+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
63+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
64+
}
65+
6266
// we are currently just skipping unknown fields (KRPC-191)
63-
decoder.skipValue(tag.wireType)
67+
decoder.skipValue(tag)
6468
}
6569
}
6670
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/FieldMask.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,12 @@ public fun com.google.protobuf.kotlin.FieldMaskInternal.Companion.decodeWith(msg
7070
}
7171

7272
else -> {
73+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
74+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
75+
}
76+
7377
// we are currently just skipping unknown fields (KRPC-191)
74-
decoder.skipValue(tag.wireType)
78+
decoder.skipValue(tag)
7579
}
7680
}
7781
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/SourceContext.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ public fun com.google.protobuf.kotlin.SourceContextInternal.Companion.decodeWith
6767
}
6868

6969
else -> {
70+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
71+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
72+
}
73+
7074
// we are currently just skipping unknown fields (KRPC-191)
71-
decoder.skipValue(tag.wireType)
75+
decoder.skipValue(tag)
7276
}
7377
}
7478
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Struct.kt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ public fun com.google.protobuf.kotlin.StructInternal.Companion.decodeWith(msg: c
176176
}
177177

178178
else -> {
179+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
180+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
181+
}
182+
179183
// we are currently just skipping unknown fields (KRPC-191)
180-
decoder.skipValue(tag.wireType)
184+
decoder.skipValue(tag)
181185
}
182186
}
183187
}
@@ -288,8 +292,12 @@ public fun com.google.protobuf.kotlin.ValueInternal.Companion.decodeWith(msg: co
288292
}
289293

290294
else -> {
295+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
296+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
297+
}
298+
291299
// we are currently just skipping unknown fields (KRPC-191)
292-
decoder.skipValue(tag.wireType)
300+
decoder.skipValue(tag)
293301
}
294302
}
295303
}
@@ -362,8 +370,12 @@ public fun com.google.protobuf.kotlin.ListValueInternal.Companion.decodeWith(msg
362370
}
363371

364372
else -> {
373+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
374+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
375+
}
376+
365377
// we are currently just skipping unknown fields (KRPC-191)
366-
decoder.skipValue(tag.wireType)
378+
decoder.skipValue(tag)
367379
}
368380
}
369381
}
@@ -420,8 +432,12 @@ public fun com.google.protobuf.kotlin.StructInternal.FieldsEntryInternal.Compani
420432
}
421433

422434
else -> {
435+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
436+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
437+
}
438+
423439
// we are currently just skipping unknown fields (KRPC-191)
424-
decoder.skipValue(tag.wireType)
440+
decoder.skipValue(tag)
425441
}
426442
}
427443
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Timestamp.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,12 @@ public fun com.google.protobuf.kotlin.TimestampInternal.Companion.decodeWith(msg
7676
}
7777

7878
else -> {
79+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
80+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
81+
}
82+
7983
// we are currently just skipping unknown fields (KRPC-191)
80-
decoder.skipValue(tag.wireType)
84+
decoder.skipValue(tag)
8185
}
8286
}
8387
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Type.kt

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,12 @@ public fun com.google.protobuf.kotlin.TypeInternal.Companion.decodeWith(msg: com
336336
}
337337

338338
else -> {
339+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
340+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
341+
}
342+
339343
// we are currently just skipping unknown fields (KRPC-191)
340-
decoder.skipValue(tag.wireType)
344+
decoder.skipValue(tag)
341345
}
342346
}
343347
}
@@ -482,8 +486,12 @@ public fun com.google.protobuf.kotlin.FieldInternal.Companion.decodeWith(msg: co
482486
}
483487

484488
else -> {
489+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
490+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
491+
}
492+
485493
// we are currently just skipping unknown fields (KRPC-191)
486-
decoder.skipValue(tag.wireType)
494+
decoder.skipValue(tag)
487495
}
488496
}
489497
}
@@ -624,8 +632,12 @@ public fun com.google.protobuf.kotlin.EnumInternal.Companion.decodeWith(msg: com
624632
}
625633

626634
else -> {
635+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
636+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
637+
}
638+
627639
// we are currently just skipping unknown fields (KRPC-191)
628-
decoder.skipValue(tag.wireType)
640+
decoder.skipValue(tag)
629641
}
630642
}
631643
}
@@ -710,8 +722,12 @@ public fun com.google.protobuf.kotlin.EnumValueInternal.Companion.decodeWith(msg
710722
}
711723

712724
else -> {
725+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
726+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
727+
}
728+
713729
// we are currently just skipping unknown fields (KRPC-191)
714-
decoder.skipValue(tag.wireType)
730+
decoder.skipValue(tag)
715731
}
716732
}
717733
}
@@ -776,8 +792,12 @@ public fun com.google.protobuf.kotlin.OptionInternal.Companion.decodeWith(msg: c
776792
}
777793

778794
else -> {
795+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
796+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
797+
}
798+
779799
// we are currently just skipping unknown fields (KRPC-191)
780-
decoder.skipValue(tag.wireType)
800+
decoder.skipValue(tag)
781801
}
782802
}
783803
}

protobuf/protobuf-core/src/commonMain/generated-code/kotlin-multiplatform/com/google/protobuf/kotlin/_rpc_internal/Wrappers.kt

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,12 @@ public fun com.google.protobuf.kotlin.DoubleValueInternal.Companion.decodeWith(m
387387
}
388388

389389
else -> {
390+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
391+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
392+
}
393+
390394
// we are currently just skipping unknown fields (KRPC-191)
391-
decoder.skipValue(tag.wireType)
395+
decoder.skipValue(tag)
392396
}
393397
}
394398
}
@@ -430,8 +434,12 @@ public fun com.google.protobuf.kotlin.FloatValueInternal.Companion.decodeWith(ms
430434
}
431435

432436
else -> {
437+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
438+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
439+
}
440+
433441
// we are currently just skipping unknown fields (KRPC-191)
434-
decoder.skipValue(tag.wireType)
442+
decoder.skipValue(tag)
435443
}
436444
}
437445
}
@@ -473,8 +481,12 @@ public fun com.google.protobuf.kotlin.Int64ValueInternal.Companion.decodeWith(ms
473481
}
474482

475483
else -> {
484+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
485+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
486+
}
487+
476488
// we are currently just skipping unknown fields (KRPC-191)
477-
decoder.skipValue(tag.wireType)
489+
decoder.skipValue(tag)
478490
}
479491
}
480492
}
@@ -516,8 +528,12 @@ public fun com.google.protobuf.kotlin.UInt64ValueInternal.Companion.decodeWith(m
516528
}
517529

518530
else -> {
531+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
532+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
533+
}
534+
519535
// we are currently just skipping unknown fields (KRPC-191)
520-
decoder.skipValue(tag.wireType)
536+
decoder.skipValue(tag)
521537
}
522538
}
523539
}
@@ -559,8 +575,12 @@ public fun com.google.protobuf.kotlin.Int32ValueInternal.Companion.decodeWith(ms
559575
}
560576

561577
else -> {
578+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
579+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
580+
}
581+
562582
// we are currently just skipping unknown fields (KRPC-191)
563-
decoder.skipValue(tag.wireType)
583+
decoder.skipValue(tag)
564584
}
565585
}
566586
}
@@ -602,8 +622,12 @@ public fun com.google.protobuf.kotlin.UInt32ValueInternal.Companion.decodeWith(m
602622
}
603623

604624
else -> {
625+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
626+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
627+
}
628+
605629
// we are currently just skipping unknown fields (KRPC-191)
606-
decoder.skipValue(tag.wireType)
630+
decoder.skipValue(tag)
607631
}
608632
}
609633
}
@@ -645,8 +669,12 @@ public fun com.google.protobuf.kotlin.BoolValueInternal.Companion.decodeWith(msg
645669
}
646670

647671
else -> {
672+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
673+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
674+
}
675+
648676
// we are currently just skipping unknown fields (KRPC-191)
649-
decoder.skipValue(tag.wireType)
677+
decoder.skipValue(tag)
650678
}
651679
}
652680
}
@@ -688,8 +716,12 @@ public fun com.google.protobuf.kotlin.StringValueInternal.Companion.decodeWith(m
688716
}
689717

690718
else -> {
719+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
720+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
721+
}
722+
691723
// we are currently just skipping unknown fields (KRPC-191)
692-
decoder.skipValue(tag.wireType)
724+
decoder.skipValue(tag)
693725
}
694726
}
695727
}
@@ -731,8 +763,12 @@ public fun com.google.protobuf.kotlin.BytesValueInternal.Companion.decodeWith(ms
731763
}
732764

733765
else -> {
766+
if (tag.wireType == kotlinx.rpc.protobuf.internal.WireType.END_GROUP) {
767+
throw kotlinx.rpc.protobuf.internal.ProtobufDecodingException("Unexpected END_GROUP tag.")
768+
}
769+
734770
// we are currently just skipping unknown fields (KRPC-191)
735-
decoder.skipValue(tag.wireType)
771+
decoder.skipValue(tag)
736772
}
737773
}
738774
}

0 commit comments

Comments
 (0)