Comment #15 on issue 210 by ken...@google.com: Java code should detect incompatible runtime library version
http://code.google.com/p/protobuf/issues/detail?id=210

Urgh, this is problematic. When people declare a dependency on protocol buffers, I want them to be able to use the version number which we advertise publicly, not some other version number which exists solely to trick Maven into doing what we want.

It's unfortunate that Maven tries to impose a version numbering convention based on low-level technical details. This doesn't work. In practice, version numbers are chosen based on much higher-level product traits. The only reasonable strategy for determining compatibility between versions is for the product itself to somehow express compatibility relationships. For example, the product could define a regex which defines the prefix of the version number that determines binary compatibility, or it could simply provide a compatibility table that enumerates all known versions and which versions they are compatible with.

In any case, I think that it would be too confusing for the Maven version numbers to differ from the advertised version numbers. Therefore I think what we need to do is detect version skew at runtime. We can have every generated class start with a block like:

  static {
    // If this fails to compile or run, the runtime library
    // version does not match the protoc version.
    com.google.protobuf.Internal.checkVersionIs_2_3();
  }

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to