Protobuf 2.5.0 bug?

前端 未结 2 1534
不知归路
不知归路 2020-12-21 15:58

I\'ve migrated from google protobuf v. 2.4.1 to v. 2.5.0 (no other change).

I had a perfectly working client-server [android<>gae dev server] communication using

相关标签:
2条回答
  • 2020-12-21 16:24

    A similar thing happened to me when I was compiling an application after upgrading to 2.5. Eventually I realized that the old 2.4 jar was still in the same folder as the new 2.5 jar, and that the build system xml file was still referring to the old one. It was just a matter of being a little more careful - nothing mysterious was going on.

    0 讨论(0)
  • 2020-12-21 16:42

    I would guess you did not upgrade / recompile something. In protobuf 2.4.1 version int the jars.

    in the GeneratedMessage class, getUnknownFields was a final method in 2.4.1 but in 2.5.0 it becomes:

      //@Override (Java 1.6 override semantics, but we must support 1.5)
      public UnknownFieldSet getUnknownFields() {
        throw new UnsupportedOperationException(
            "This is supposed to be overridden by subclasses.");
      }
    

    and is overridden in the generated class. You may need to recompile all your classes that use generated protocol buffer classes.

    Given the messages

    java.lang.VerifyError: class com.mta.pb.ACM$MyRequest overrides final method getUnknownFields.()Lcom/google/protobuf/UnknownFieldSet;
    

    This tells you you are running code generated with Protocol-Buffers 2.5.0 with a protocol-fuffers-2.4.1 (or earlier) jar.

    0 讨论(0)
提交回复
热议问题