Hi Ben,

+1 for the NON generics option, my felling is that usually generics bring more harm than good in the long run :(


On 06/06/2018 03:44 AM, Ben Caradoc-Davies wrote:
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,


--
Regards,
Nuno Oliveira
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==

Nuno Miguel Carvalho Oliveira
@nmcoliveira
Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:      +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati
personali (Reg. UE 2016/679 - Regolamento generale sulla
protezione dei dati “GDPR”), si precisa che ogni
circostanza inerente alla presente email (il suo contenuto,
gli eventuali allegati, etc.) è un dato la cui conoscenza
è riservata al/i solo/i destinatario/i indicati dallo
scrivente. Se il messaggio Le è giunto per errore, è
tenuta/o a cancellarlo, ogni altra operazione è illecita.
Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to
which it is addressed and may contain information that
is privileged, confidential or otherwise protected from
disclosure. We remind that - as provided by European
Regulation 2016/679 “GDPR” - copying, dissemination or
use of this e-mail or the information herein by anyone
other than the intended recipient is prohibited. If you
have received this email by mistake, please notify
us immediately by telephone or e-mail.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to