Skip to content

Commit

Permalink
Merge pull request #93 from mohamabid/master
Browse files Browse the repository at this point in the history
Upgrade to google-protobuf 3.6.1 to support proto3 messages
  • Loading branch information
magro committed Nov 25, 2018
2 parents 2baa088 + 0dcc975 commit e8cea98
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 275 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>2.6.1</version>
<version>3.6.1</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.AbstractMessage;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

import static com.esotericsoftware.kryo.Kryo.NULL;

public class ProtobufSerializer<T extends GeneratedMessage> extends Serializer<T> {
public class ProtobufSerializer<T extends AbstractMessage> extends Serializer<T> {

private Method parseFromMethod = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class ProtobufSerializerTest {
@BeforeTest
public void setUp() throws Exception {
_kryo = new Kryo();
_kryo.register(SampleProtoA.class, new ProtobufSerializer());
_kryo.register(SampleProtoB.class, new ProtobufSerializer());
_kryo.register(SampleProtoA.class, new ProtobufSerializer<SampleProtoA>());
_kryo.register(SampleProtoB.class, new ProtobufSerializer<SampleProtoB>());
}

@Test
Expand Down
Loading

0 comments on commit e8cea98

Please sign in to comment.