且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

protobuf的2.5.0错误?

更新时间:2023-02-17 13:52:06

我会想你没升级/重新编译的东西。在protobuf的2.4.1版本诠释的罐子。

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

GeneratedMessage 类, getUnknownFields 是最后的方法2.4.1但2.5.0它变成了:

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.

由于消息

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

这告诉你,你正在运行code 生成与协议2.5.0缓冲带的协议fuffers-2.4.1(或更早)的容器

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