You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
else->throwIllegalArgumentException("Class ${this.serialName} should be abstract or sealed or interface to be used as @ProtoOneOf property.")
120
-
}.filter { desc ->
121
-
desc.getElementAnnotations(0).any { anno -> anno isProtoNumber }
120
+
}.onEach { desc ->
121
+
if (desc.getElementAnnotations(0).none { anno -> anno isProtoNumber }) {
122
+
throwIllegalArgumentException("${desc.serialName} implementing oneOf type ${this.serialName} should have @ProtoNumber annotation in its single property.")
"kotlinx.serialization.protobuf.ProtobufOneOfTest.FailIntType implementing oneOf type kotlinx.serialization.protobuf.ProtobufOneOfTest.IFailType should have @ProtoNumber annotation in its single property."
407
+
) {
412
408
ProtoBuf.decodeFromHexString<FailWithClass>(
413
409
/**
414
410
* 5:VARINT 42
@@ -511,7 +507,9 @@ class ProtobufOneOfTest {
511
507
assertEquals("1a03666f6f182a", it)
512
508
}
513
509
514
-
assertFailsWith<IllegalArgumentException> {
510
+
assertFailsWithMessage<IllegalArgumentException>(
511
+
"Duplicated proto number 3 in kotlinx.serialization.protobuf.ProtobufOneOfTest.DuplicatingIdData for elements: d, bad."
512
+
) {
515
513
/**
516
514
* 3:LEN {"foo"}
517
515
* 3:VARINT 42
@@ -576,7 +574,6 @@ class ProtobufOneOfTest {
576
574
funtestTypedInt() {
577
575
val fixed =TypedIntOuter(Fixed32Int(32))
578
576
ProtoBuf.encodeToHexString(fixed).also {
579
-
println(it)
580
577
/**
581
578
* 2:I32 32i32
582
579
*/
@@ -590,7 +587,6 @@ class ProtobufOneOfTest {
590
587
}
591
588
val fixedLong =TypedIntOuter(Fixed32Long(30576774159))
592
589
ProtoBuf.encodeToHexString(fixedLong).also {
593
-
println(it)
594
590
/**
595
591
* 3:VARINT 30576774159
596
592
*/
@@ -604,7 +600,6 @@ class ProtobufOneOfTest {
604
600
}
605
601
val signed =TypedIntOuter(SignedInt(32))
606
602
ProtoBuf.encodeToHexString(signed).also {
607
-
println(it)
608
603
/**
609
604
* 4:VARINT 32
610
605
*/
@@ -618,7 +613,6 @@ class ProtobufOneOfTest {
618
613
}
619
614
val signedLong =TypedIntOuter(SignedLong(30576774159))
620
615
ProtoBuf.encodeToHexString(signedLong).also {
621
-
println(it)
622
616
/**
623
617
* 5:VARINT 61153548318
624
618
*/
@@ -632,7 +626,6 @@ class ProtobufOneOfTest {
632
626
}
633
627
val default =TypedIntOuter(DefaultInt(32))
634
628
ProtoBuf.encodeToHexString(default).also {
635
-
println(it)
636
629
/**
637
630
* 6:VARINT 32
638
631
*/
@@ -646,7 +639,6 @@ class ProtobufOneOfTest {
646
639
}
647
640
val defaultLong =TypedIntOuter(DefaultLong(30576774159))
0 commit comments