Protobuf 2.5.0 bug?

前端 未结 2 1555
不知归路
不知归路 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: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.

提交回复
热议问题