Skip to content

Commit

Permalink
Update to proto 4.26.1. (#2662)
Browse files Browse the repository at this point in the history
Use `GeneratedMessage` rather than `GeneratedMessageV3` in proto tests.
[Proto v26.0] made a number of incompatible API changes, including
changing the base class for generated proto message code.
  • Loading branch information
eamonnmcmanus committed Apr 1, 2024
1 parent 71865b4 commit d32aca1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion proto/pom.xml
Expand Up @@ -32,7 +32,7 @@
<!-- This is duplicated here because that is recommended by `artifact:check-buildplan` -->
<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>

<protobufVersion>3.25.3</protobufVersion>
<protobufVersion>4.26.1</protobufVersion>
</properties>

<licenses>
Expand Down
Expand Up @@ -28,7 +28,7 @@
import com.google.gson.protobuf.generated.Bag.OuterMessage;
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations;
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -51,18 +51,18 @@ public void setUp() throws Exception {
.addSerializedEnumValueExtension(Annotations.serializedValue);
gson =
new GsonBuilder()
.registerTypeHierarchyAdapter(GeneratedMessageV3.class, protoTypeAdapter.build())
.registerTypeHierarchyAdapter(GeneratedMessage.class, protoTypeAdapter.build())
.create();
gsonWithEnumNumbers =
new GsonBuilder()
.registerTypeHierarchyAdapter(
GeneratedMessageV3.class,
GeneratedMessage.class,
protoTypeAdapter.setEnumSerialization(EnumSerialization.NUMBER).build())
.create();
gsonWithLowerHyphen =
new GsonBuilder()
.registerTypeHierarchyAdapter(
GeneratedMessageV3.class,
GeneratedMessage.class,
protoTypeAdapter
.setFieldNameSerializationFormat(
CaseFormat.LOWER_UNDERSCORE, CaseFormat.LOWER_HYPHEN)
Expand Down
Expand Up @@ -27,7 +27,7 @@
import com.google.gson.protobuf.generated.Bag.ProtoWithDifferentCaseFormat;
import com.google.gson.protobuf.generated.Bag.ProtoWithRepeatedFields;
import com.google.gson.protobuf.generated.Bag.SimpleProto;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -45,15 +45,15 @@ public void setUp() throws Exception {
gson =
new GsonBuilder()
.registerTypeHierarchyAdapter(
GeneratedMessageV3.class,
GeneratedMessage.class,
ProtoTypeAdapter.newBuilder()
.setEnumSerialization(EnumSerialization.NUMBER)
.build())
.create();
upperCamelGson =
new GsonBuilder()
.registerTypeHierarchyAdapter(
GeneratedMessageV3.class,
GeneratedMessage.class,
ProtoTypeAdapter.newBuilder()
.setFieldNameSerializationFormat(
CaseFormat.LOWER_UNDERSCORE, CaseFormat.UPPER_CAMEL)
Expand Down
Expand Up @@ -24,7 +24,7 @@
import com.google.gson.protobuf.ProtoTypeAdapter;
import com.google.gson.protobuf.ProtoTypeAdapter.EnumSerialization;
import com.google.gson.protobuf.generated.Bag.SimpleProto;
import com.google.protobuf.GeneratedMessageV3;
import com.google.protobuf.GeneratedMessage;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -36,7 +36,7 @@ public void setUp() throws Exception {
gson =
new GsonBuilder()
.registerTypeHierarchyAdapter(
GeneratedMessageV3.class,
GeneratedMessage.class,
ProtoTypeAdapter.newBuilder()
.setEnumSerialization(EnumSerialization.NUMBER)
.build())
Expand Down

0 comments on commit d32aca1

Please sign in to comment.