From b5a7cf7cf4b7e39f6b02205e45afe2104a7faf81 Mon Sep 17 00:00:00 2001 From: Sandy Zhang Date: Wed, 18 Sep 2024 15:25:25 -0400 Subject: [PATCH] Remove RecursiveGroup test case which doesn't exist in 25.x pre-Editions --- .../java/com/google/protobuf/LiteTest.java | 20 ------------------- src/google/protobuf/unittest_lite.proto | 4 ---- 2 files changed, 24 deletions(-) diff --git a/java/lite/src/test/java/com/google/protobuf/LiteTest.java b/java/lite/src/test/java/com/google/protobuf/LiteTest.java index 1fc9c5607160..51652397f6d0 100644 --- a/java/lite/src/test/java/com/google/protobuf/LiteTest.java +++ b/java/lite/src/test/java/com/google/protobuf/LiteTest.java @@ -17,7 +17,6 @@ import com.google.protobuf.UnittestImportPublicLite.PublicImportMessageLite; import com.google.protobuf.UnittestLite.ForeignEnumLite; import com.google.protobuf.UnittestLite.ForeignMessageLite; -import com.google.protobuf.UnittestLite.RecursiveGroup; import com.google.protobuf.UnittestLite.RecursiveMessage; import com.google.protobuf.UnittestLite.TestAllExtensionsLite; import com.google.protobuf.UnittestLite.TestAllTypesLite; @@ -2614,17 +2613,6 @@ public void testParseFromBytes_recursiveMessages() throws Exception { assertThat(thrown).hasMessageThat().contains("Protocol message had too many levels of nesting"); } - @Test - public void testParseFromBytes_recursiveKnownGroups() throws Exception { - byte[] data99 = makeRecursiveGroup(99).toByteArray(); - byte[] data100 = makeRecursiveGroup(100).toByteArray(); - - RecursiveGroup unused = RecursiveGroup.parseFrom(data99); - Throwable thrown = - assertThrows(InvalidProtocolBufferException.class, () -> RecursiveGroup.parseFrom(data100)); - assertThat(thrown).hasMessageThat().contains("Protocol message had too many levels of nesting"); - } - @Test @SuppressWarnings("ProtoParseFromByteString") public void testMaliciousSGroupTagsWithMapField_fromByteArray() throws Exception { @@ -3043,12 +3031,4 @@ private static RecursiveMessage makeRecursiveMessage(int num) { return RecursiveMessage.newBuilder().setRecurse(makeRecursiveMessage(num - 1)).build(); } } - - private static RecursiveGroup makeRecursiveGroup(int num) { - if (num == 0) { - return RecursiveGroup.getDefaultInstance(); - } else { - return RecursiveGroup.newBuilder().setRecurse(makeRecursiveGroup(num - 1)).build(); - } - } } diff --git a/src/google/protobuf/unittest_lite.proto b/src/google/protobuf/unittest_lite.proto index c7fe54eb2dff..0ea2cfcd35a1 100644 --- a/src/google/protobuf/unittest_lite.proto +++ b/src/google/protobuf/unittest_lite.proto @@ -506,7 +506,3 @@ message RecursiveMessage { optional RecursiveMessage recurse = 1; optional bytes payload = 2; } - -message RecursiveGroup { - optional RecursiveGroup recurse = 1 [features.message_encoding = DELIMITED]; -}