You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Network interface simply declares itself as extends AutoCloseable. It therefore inherits the throws clause from AutoCloseable, which is throws Exception. That is, it is implicitly declared as throwing a checked exception, which is inconvenient (but sometimes necessary). But as the actual implementation in Network.NetworkImpldoes not throw any checked exceptions (Network.NetworkImpl.close() has no throws clause), this is an unnecessary inconvenience. Leaving the method as implicitly throws Exception is also against the advice of the AutoCloseable.close() specification:
While this interface method is declared to throw Exception, implementers are strongly encouraged to declare concrete implementations of the close method to throw more specific exceptions, or to throw no exception at all if the close operation cannot fail.
(A minor annoyance)
The text was updated successfully, but these errors were encountered:
I'm not sure I can contribute yet; I'm looking into using Testcontainers at my workplace. If the demonstration is OK, I'll then talk to my boss about making OSS contributions. Sorry I can't do more now. :-(
mumukiller
pushed a commit
to mumukiller/testcontainers-java
that referenced
this issue
Apr 11, 2019
The
Network
interface simply declares itself asextends AutoCloseable
. It therefore inherits thethrows
clause fromAutoCloseable
, which isthrows Exception
. That is, it is implicitly declared as throwing a checked exception, which is inconvenient (but sometimes necessary). But as the actual implementation inNetwork.NetworkImpl
does not throw any checked exceptions (Network.NetworkImpl.close()
has nothrows
clause), this is an unnecessary inconvenience. Leaving the method as implicitlythrows Exception
is also against the advice of theAutoCloseable.close()
specification:(A minor annoyance)
The text was updated successfully, but these errors were encountered: