Update dependencies in proto/pom.xml. (#1949)
Also use GeneratedMessageV3 rather than GeneratedMessage, consistent with recent versions of protoc.
This commit is contained in:
parent
c8f26dc907
commit
4bb67483f9
|
@ -55,35 +55,35 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.8.8</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.protobuf</groupId>
|
<groupId>com.google.protobuf</groupId>
|
||||||
<artifactId>protobuf-java</artifactId>
|
<artifactId>protobuf-java</artifactId>
|
||||||
<version>2.6.1</version>
|
<version>4.0.0-rc-2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>18.0</version>
|
<version>30.1.1-jre</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.13.1</version>
|
<version>4.13.2</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.truth</groupId>
|
<groupId>com.google.truth</groupId>
|
||||||
<artifactId>truth</artifactId>
|
<artifactId>truth</artifactId>
|
||||||
<version>0.27</version>
|
<version>1.1.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
package com.google.gson.protobuf.functional;
|
package com.google.gson.protobuf.functional;
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assert_;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
|
||||||
import com.google.common.base.CaseFormat;
|
import com.google.common.base.CaseFormat;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
@ -30,8 +30,7 @@ import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations;
|
||||||
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage;
|
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage;
|
||||||
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage.Data;
|
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage.Data;
|
||||||
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage.Type;
|
import com.google.gson.protobuf.generated.Bag.ProtoWithAnnotations.InnerMessage.Type;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,15 +51,15 @@ public class ProtosWithAnnotationsTest extends TestCase {
|
||||||
.addSerializedNameExtension(Annotations.serializedName)
|
.addSerializedNameExtension(Annotations.serializedName)
|
||||||
.addSerializedEnumValueExtension(Annotations.serializedValue);
|
.addSerializedEnumValueExtension(Annotations.serializedValue);
|
||||||
gson = new GsonBuilder()
|
gson = new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(GeneratedMessage.class, protoTypeAdapter.build())
|
.registerTypeHierarchyAdapter(GeneratedMessageV3.class, protoTypeAdapter.build())
|
||||||
.create();
|
.create();
|
||||||
gsonWithEnumNumbers = new GsonBuilder()
|
gsonWithEnumNumbers = new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(GeneratedMessage.class, protoTypeAdapter
|
.registerTypeHierarchyAdapter(GeneratedMessageV3.class, protoTypeAdapter
|
||||||
.setEnumSerialization(EnumSerialization.NUMBER)
|
.setEnumSerialization(EnumSerialization.NUMBER)
|
||||||
.build())
|
.build())
|
||||||
.create();
|
.create();
|
||||||
gsonWithLowerHyphen = new GsonBuilder()
|
gsonWithLowerHyphen = new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(GeneratedMessage.class, protoTypeAdapter
|
.registerTypeHierarchyAdapter(GeneratedMessageV3.class, protoTypeAdapter
|
||||||
.setFieldNameSerializationFormat(CaseFormat.LOWER_UNDERSCORE, CaseFormat.LOWER_HYPHEN)
|
.setFieldNameSerializationFormat(CaseFormat.LOWER_UNDERSCORE, CaseFormat.LOWER_HYPHEN)
|
||||||
.build())
|
.build())
|
||||||
.create();
|
.create();
|
||||||
|
@ -157,7 +156,7 @@ public class ProtosWithAnnotationsTest extends TestCase {
|
||||||
+ "}");
|
+ "}");
|
||||||
try {
|
try {
|
||||||
gson.fromJson(json, InnerMessage.class);
|
gson.fromJson(json, InnerMessage.class);
|
||||||
assert_().fail("Should have thrown");
|
assertWithMessage("Should have thrown").fail();
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,7 @@ import com.google.gson.protobuf.ProtoTypeAdapter.EnumSerialization;
|
||||||
import com.google.gson.protobuf.generated.Bag.ProtoWithDifferentCaseFormat;
|
import com.google.gson.protobuf.generated.Bag.ProtoWithDifferentCaseFormat;
|
||||||
import com.google.gson.protobuf.generated.Bag.ProtoWithRepeatedFields;
|
import com.google.gson.protobuf.generated.Bag.ProtoWithRepeatedFields;
|
||||||
import com.google.gson.protobuf.generated.Bag.SimpleProto;
|
import com.google.gson.protobuf.generated.Bag.SimpleProto;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +41,7 @@ public class ProtosWithComplexAndRepeatedFieldsTest extends TestCase {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
gson =
|
gson =
|
||||||
new GsonBuilder()
|
new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(GeneratedMessage.class,
|
.registerTypeHierarchyAdapter(GeneratedMessageV3.class,
|
||||||
ProtoTypeAdapter.newBuilder()
|
ProtoTypeAdapter.newBuilder()
|
||||||
.setEnumSerialization(EnumSerialization.NUMBER)
|
.setEnumSerialization(EnumSerialization.NUMBER)
|
||||||
.build())
|
.build())
|
||||||
|
@ -50,7 +49,7 @@ public class ProtosWithComplexAndRepeatedFieldsTest extends TestCase {
|
||||||
upperCamelGson =
|
upperCamelGson =
|
||||||
new GsonBuilder()
|
new GsonBuilder()
|
||||||
.registerTypeHierarchyAdapter(
|
.registerTypeHierarchyAdapter(
|
||||||
GeneratedMessage.class, ProtoTypeAdapter.newBuilder()
|
GeneratedMessageV3.class, ProtoTypeAdapter.newBuilder()
|
||||||
.setFieldNameSerializationFormat(
|
.setFieldNameSerializationFormat(
|
||||||
CaseFormat.LOWER_UNDERSCORE, CaseFormat.UPPER_CAMEL)
|
CaseFormat.LOWER_UNDERSCORE, CaseFormat.UPPER_CAMEL)
|
||||||
.build())
|
.build())
|
||||||
|
|
|
@ -21,8 +21,7 @@ import com.google.gson.protobuf.ProtoTypeAdapter;
|
||||||
import com.google.gson.protobuf.ProtoTypeAdapter.EnumSerialization;
|
import com.google.gson.protobuf.ProtoTypeAdapter.EnumSerialization;
|
||||||
import com.google.gson.protobuf.generated.Bag.SimpleProto;
|
import com.google.gson.protobuf.generated.Bag.SimpleProto;
|
||||||
import com.google.protobuf.Descriptors.Descriptor;
|
import com.google.protobuf.Descriptors.Descriptor;
|
||||||
import com.google.protobuf.GeneratedMessage;
|
import com.google.protobuf.GeneratedMessageV3;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public class ProtosWithPrimitiveTypesTest extends TestCase {
|
public class ProtosWithPrimitiveTypesTest extends TestCase {
|
||||||
|
@ -32,7 +31,7 @@ public class ProtosWithPrimitiveTypesTest extends TestCase {
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
gson = new GsonBuilder().registerTypeHierarchyAdapter(
|
gson = new GsonBuilder().registerTypeHierarchyAdapter(
|
||||||
GeneratedMessage.class, ProtoTypeAdapter.newBuilder()
|
GeneratedMessageV3.class, ProtoTypeAdapter.newBuilder()
|
||||||
.setEnumSerialization(EnumSerialization.NUMBER)
|
.setEnumSerialization(EnumSerialization.NUMBER)
|
||||||
.build())
|
.build())
|
||||||
.create();
|
.create();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user