5.27.0 not binary compatible with 5.26.0 · rabbitmq/rabbitmq-java-client · Discussion #1810 (original) (raw)
Describe the bug
Changes to ConnectionFactory made in 5.27.0 are not binary compatible with 5.26.0. They are source-compatible, however.
For example, the useNio() method in 5.26.0 was:
But in 5.27.0, it changed to:
public ConnectionFactory useNio() {
Changing the return type of a method is not binary compatible.
When a user uses 5.27.0 is at runtime, with code that was compiled against 5.26.0, the following error will occur:
java.lang.NoSuchMethodError: 'void com.rabbitmq.client.ConnectionFactory.useNio()'
A more concrete example is when an app upgrades from Spring Boot 3.5.8 to 4.0.0, the version of amqp-client is bumped from 5.25.0 to 5.27.0. If that application also uses a library calling useNio() that was compiled against 5.0.0 -> 5.26.0, then the runtime error will occur.
Reproduction steps
- Compile code calling useNio() with 5.26.0
- Run code with 5.27.0
- Observe error
Expected behavior
Expect no error to occur.
Expect minor versions of the rabbitmq-java-client to remain binary compatible
Additional context
Ideally, revert the method signature, to keep binary compatibility with 5.0 -> 5.26
Otherwise, call out the breaking change in the release notes for 5.27.0