Any mixing of 2.x and 3.x is not supported; you might get lucky and have it
work, but I wouldn't recommend doing that because no one has attempted to
make that work safely. As long as all your code is at 3.0 or higher, you
can freely mix 3.x versions as long as you follow the rule that the runtime
library version is at least as high as the protoc version of the newest
generated code (i.e. no generated code newer than the runtime library).

On Mon, Oct 7, 2019 at 3:36 AM André Pinto <andredasilvapi...@gmail.com>
wrote:

> I have the same question.
>
> protobuf-java 3.7.1 seems to be compatible with Protobuf generated with
> protoc 2.5.0.
>
> Is there any official statement about the compatibility of the
> protobuf-java library against different protobuf versions?
>
> On Tuesday, June 5, 2018 at 1:44:02 AM UTC+1, madhav goyal wrote:
>>
>> Hey Feng, Can you please tell what's the incompatibility between
>> protoc_linux.2.5 and protobuf-java_3.x? I upgraded protobuf-java to 3.5 and
>> tried to use it with protoc_linux.2.5 and I was able to compile, read/write
>> with no issues.
>>
>> $protoc_linux --version
>> libprotoc 2.5.0
>>
>> <dependency>
>>                 <groupId>com.google.protobuf</groupId>
>>                 <artifactId>protobuf-java</artifactId>
>>                 <version>3.5.0</version>
>> </dependency>
>>
>> On Thursday, 20 April 2017 18:10:25 UTC-7, Feng Xiao wrote:
>>>
>>>
>>>
>>> On Thu, Apr 20, 2017 at 6:01 PM, Scott Sue <scot...@celer-tech.com>
>>> wrote:
>>>
>>>> Hi Feng,
>>>>
>>>> Apologies, what I was meaning was that with the introduction of
>>>> protobuf 3.2.0 now, is 3.2.0 binary compatible with protobuf 2.5.0?  Or
>>>> does you original message reply still hold true?
>>>>
>>> No, 3.2.0 runtime is not binary compatible with 2.5.0 generated code. It
>>> is only binary compatible with older 3.x version generated code, such as
>>> 3.0, or 3.1.
>>>
>>>
>>>>
>>>>
>>>> Regards,
>>>> Scott
>>>>
>>>> SCOTT SUE
>>>> CHIEF TECHNOLOGY OFFICER
>>>>
>>>> Support Line : +44(0) 2031 371 603
>>>> Mobile : +852 9611 3969
>>>>
>>>> 9/F, 33 Lockhart Road, Wanchai, Hong Kong
>>>> www.celer-tech.com
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 21 Apr 2017, at 2:08 AM, Feng Xiao <xiao...@google.com> wrote:
>>>>
>>>>
>>>>
>>>> On Thu, Apr 20, 2017 at 3:55 AM, Scott Sue <scot...@celer-tech.com>
>>>> wrote:
>>>>
>>>>> Hi Feng,
>>>>>
>>>>> Is this still the case considering that 3.2.0 is out that allows the
>>>>> version number to be used by protoc?
>>>>>
>>>> Not sure what you are asking, but 3.0.0 generated code should work with
>>>> 3.2.0 runtime and 3.2.0 protoc will work with any old version plugins.
>>>>
>>>>
>>>>>
>>>>> General
>>>>> * Added protoc version number to protoc plugin protocol. It can be
>>>>> used by
>>>>> protoc plugin to detect which version of protoc is used with the
>>>>> plugin and
>>>>> mitigate known problems in certain version of protoc.
>>>>> Regards,
>>>>> Scott
>>>>>
>>>>>
>>>>> On Saturday, August 13, 2016 at 8:00:23 AM UTC+8, Feng Xiao wrote:
>>>>>>
>>>>>> On Thu, Aug 11, 2016 at 12:21 PM, Jeff Olson <jeff.d...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I've read through the release documents
>>>>>>> <https://github.com/google/protobuf/releases/tag/v3.0.0> for
>>>>>>> Protocol Buffers v3.0.0 but I can't find any statements regrading binary
>>>>>>> compatibility with version 2.6.1 (or earlier). There are a couple of 
>>>>>>> things
>>>>>>> I'd like to know:
>>>>>>>
>>>>>>>
>>>>>>>    1. If I dump a 3.0.0 version of the
>>>>>>>    com.google.protobuf/protobuf-java.jar in a project the depends on 
>>>>>>> java
>>>>>>>    classes generated by protoc v2.6.1 (or v2.5.0) will everything still 
>>>>>>> work?
>>>>>>>    That is, is the java runtime backwards compatible?
>>>>>>>
>>>>>>> Unfortunately no. The 3.0.0 version protobuf-java.jar will not work
>>>>>> with java classes generated by protoc v2.6.1 (or v2.5.0). For those who 
>>>>>> can
>>>>>> not upgrade to 3.0 directly, we are considering releasing a 2.7 version
>>>>>> which provides the following compatibility guarantees:
>>>>>> 1. 2.7 protobuf-java.jar will be compatible with java classes
>>>>>> generated by protoc 2.6.1 and protoc 2.5.0.
>>>>>> 2. 3.0 protobuf-java.jar will be compatible with java classes
>>>>>> generated by protoc 2.7
>>>>>>
>>>>>> I.e., it allows you to upgrade to 3.0 in two steps: upgrade to 2.7,
>>>>>> and after all your dependencies are upgraded to either 2.7 or 3.0, you 
>>>>>> can
>>>>>> upgrade to 3.0 as well. It's not an ideal solution, but we hope it can 
>>>>>> help
>>>>>> ease the migration pain for some users. I'm testing this 2.7 version in a
>>>>>> github branch right now:
>>>>>> https://github.com/google/protobuf/tree/2.7.0. If you are
>>>>>> interested, feel free to test it and any feedback is welcome.
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>    1. Is the binary wire format the same for purely proto2
>>>>>>>    messages? If I serialize messages generated from proto2 sources 
>>>>>>> using the
>>>>>>>    3.0.0 java runtime will clients using protobuf v2.6.1 be able to 
>>>>>>> decode the
>>>>>>>    messages correctly?
>>>>>>>
>>>>>>> Yes. The wire format stays the same as long as you are using the
>>>>>> proto2 syntax version.
>>>>>>
>>>>>> Thanks,
>>>>>>> Jeff
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Protocol Buffers" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to protobuf+u...@googlegroups.com.
>>>>>>> To post to this group, send email to prot...@googlegroups.com.
>>>>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>>>
>>>>> *This message, including any attachments, may include private,
>>>>> privileged and confidential information and is intended only for the
>>>>> personal and confidential use of the intended recipient(s). If the reader
>>>>> of this message is not an intended recipient, you are hereby notified that
>>>>> any review, use, dissemination, distribution, printing or copying of this
>>>>> message or its contents is strictly prohibited and may be unlawful. If you
>>>>> are not an intended recipient or have received this communication in 
>>>>> error,
>>>>> please immediately notify the sender by telephone and/or a reply email and
>>>>> permanently delete the original message, including any attachments, 
>>>>> without
>>>>> making a copy.*
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Protocol Buffers" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to protobuf+u...@googlegroups.com.
>>>>> To post to this group, send email to prot...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/group/protobuf.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> *This message, including any attachments, may include private,
>>>> privileged and confidential information and is intended only for the
>>>> personal and confidential use of the intended recipient(s). If the reader
>>>> of this message is not an intended recipient, you are hereby notified that
>>>> any review, use, dissemination, distribution, printing or copying of this
>>>> message or its contents is strictly prohibited and may be unlawful. If you
>>>> are not an intended recipient or have received this communication in error,
>>>> please immediately notify the sender by telephone and/or a reply email and
>>>> permanently delete the original message, including any attachments, without
>>>> making a copy.*
>>>>
>>>
>>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/protobuf/d7971524-638e-4a45-967a-fd9a1b233615%40googlegroups.com
> <https://groups.google.com/d/msgid/protobuf/d7971524-638e-4a45-967a-fd9a1b233615%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/CADqAXr42unbu6LUGHSbv8VzpPSGRgyD29Thv-tRzoHZ2c4uWyA%40mail.gmail.com.

Reply via email to