cel-java icon indicating copy to clipboard operation
cel-java copied to clipboard

Incompatible with protobuf v4

Open jchadwick-buf opened this issue 7 months ago • 2 comments

I know there was some discussion about this but now that #533 is closed without resolution it's unclear what the future holds.

The status has changed slightly since before. Protobuf v27.2 introduced some backwards compatibility with the older gencode, apparently allowing gRPC to function with Protobuf v27.2. However, this backwards compatibility doesn't extend to GeneratedMessageV3$Builder, thus the gencode used in cel-java runs into problems when using Protobuf v27.2. This is because the new shims give source compatibility with old gencode, but old gencode that is compiled against the old runtime will reference classes that still don't exist. It seems like a future version of protobuf may resolve this and offer a cleaner path forward, but it hasn't happened yet. See the discussion over here: https://github.com/protocolbuffers/protobuf/issues/17247

Meanwhile, though, on May 23rd, Protobuf v27 actually gave people a reason to upgrade: Protobuf v27 is the first version of Protobuf that enables Protobuf Editions by default. While Editions is mostly backwards compatible, using Protobuf Editions in protobuf schemas requires new gencode, and new gencode requires the new runtime.

This whole situation is a bit of a mess. With Protobuf v27.3 having been cut a few hours ago with no sign of any improvements to gencode compatibility, we are at a bit of a standstill. I wonder if the gencode compatibility improvements are perhaps good enough that cel-java can update? It will be a breaking change, but at least there shouldn't be a hold up with grpc-java.

Can't imagine this is an exciting issue to have to deal with but it's one that I don't think can be ignored so forgive me for having to raise it.

For people searching, this error can manifest in two ways:

  • From source code depending on old bytecode gencode with old runtime. This will give a compile-time error: error: cannot access Builder: class file for com.google.protobuf.GeneratedMessageV3$Builder not found
  • From bytecode depending on old bytecode gencode with old runtime. This will give a class not found error at runtime instead.

(When compiling old gencode from source with Protobuf v27.2, this issue should not occur.)

jchadwick-buf avatar Jul 31 '24 21:07 jchadwick-buf