Or with generics:
public interface ThrowingDisposable<T extends Exception> extends
AutoCloseable {
/**
* @see java.lang.AutoCloseable#close()
*/
@Deprecated
@Override
default void close() throws T {
dispose();
}
void dispose() throws T;
}
public interface Disposable extends ThrowingDisposable<Exception> {
/**
* @see java.lang.AutoCloseable#close()
*/
@Deprecated
@Override
default void close() {
dispose();
}
@Override
void dispose();
}
Or just keep it simple and have dispose throw Exception like
java.lang.AutoCloseable#close() and let implementers narrow the return
type to no exception if they like. Impact will be minimal as client code
will likely use an implementer not a bare Disposable:
public interface Disposable extends AutoCloseable{
/**
* @throws Exception
* @see java.lang.AutoCloseable#close()
*/
@Deprecated
@Override
default void close() throws Exception{
dispose();
}
void dispose() throws Exception;
}
Preference?
Kind regards,
--
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <https://transient.nz/>
New Zealand
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel