Observed behavior
The following code produces a compiler warning (with openjdk 25)
try (Connection connection = Nats.connect(options)) {
// Do stuff with the connection here
}
warning message:
auto-closeable resource io.nats.client.Connection has a member method close() that could throw InterruptedException
The documentation for close() strongly advises not to throw InterruptedException from the close() method.
Expected behavior
No compiler warning should be emitted; the close() method should avoid throwing InterruptedException
Server and client version
jnats version 2.21.1
Host environment
n/a, this is a warning at compile time that code may have unexpected runtime effects if an InterruptedException is thrown and swallowed by autocloseable.
Steps to reproduce
See "Observed behaviour"
Observed behavior
The following code produces a compiler warning (with openjdk 25)
warning message:
The documentation for
close()strongly advises not to throw InterruptedException from theclose()method.Expected behavior
No compiler warning should be emitted; the
close()method should avoid throwingInterruptedExceptionServer and client version
jnats version 2.21.1
Host environment
n/a, this is a warning at compile time that code may have unexpected runtime effects if an InterruptedException is thrown and swallowed by autocloseable.
Steps to reproduce
See "Observed behaviour"