Hi again,
I think that I encountered another bug in ProtoStream.
I have an object with a field of type byte[]. If I only annotate the field with @ProtoField like this:
private byte[] image; @ProtoField(number = 20) public byte[] getImage() { return image; } public void setImage(byte[] image) { this.image = image; }
In the proto file generated, this field will be declared:
repeated int32 image = 20;
This works but the serialization format is much bigger than the original value.
What I expected is:
optional bytes image = 20;
So I tried to give the type hint:
@ProtoField(number = 20, type = Type.BYTES) public byte[] getImage() { return image; }
I've got this error:
Exception in thread "main" org.infinispan.protostream.annotations.ProtoSchemaBuilderException: Incompatible types : byte vs BYTES
at org.infinispan.protostream.annotations.impl.ProtoMessageTypeMetadata.getProtobufType(ProtoMessageTypeMetadata.java:511)
I then tried to add javaType:
@ProtoField(number = 20, type = Type.BYTES, javaType = byte[].class) public byte[] getImage() { return image; }
The proto generated:
repeated bytes image = 20;
This should not be "repeated", and there's also another error when generating the marshaller:
protostream.javassist.CannotCompileException: [source error] syntax error near " [B v = $2.readBytes();"
Could you fix this bug or could I make a pull request to fix it ?
Thanks,