Re: [Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Erik Merkle
A small caveat to my suggestion about default methods. Apparently default methods on interfaces is a Java 8 thing. So it is not a viable option if running with an older version. Erik Merkle Software Engineer | Boundless On Mon, Jun 4,

Re: [Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Ben Caradoc-Davies
Erik, we require Java 8 for all supported branches. Interface default methods are on the table. Kind regards, Ben. On 05/06/18 12:54, Erik Merkle wrote: A small caveat to my suggestion about default methods. Apparently default methods on interfaces is a Java 8 thing. So it is not a viable op

Re: [Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Ben Caradoc-Davies
Eric, that is an interesting idea but I suspect it would introduce silent resource leaks. Unless we have a default implementation that calls the deprecated dispose() method? In any case, just like constructors and virtual destructors in C++, there in an intimate relationship between a close()

Re: [Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Erik Merkle
I don't believe I have a vote here, but I wanted to add that you could provide a default implementation on any GeoServer Interfaces to which you want to add AutoCloseable. That would get around the compile issue, and I believe the backward compatibility compile issue is exactly why Java added the d

Re: [Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Chris Snider
something to consider. Chris Snider Senior Software Engineer -Original Message- From: Ben Caradoc-Davies [mailto:b...@transient.nz] Sent: Monday, June 04, 2018 5:25 PM To: GeoTools Devel ; Geoserver-devel Subject: [Geoserver-devel] API changes to add AutoCloseable for try-with-re

[Geoserver-devel] API changes to add AutoCloseable for try-with-resources

2018-06-04 Thread Ben Caradoc-Davies
Many interfaces in GeoTools and GeoServer use the Dispose pattern, often with a dispose() method, but do not implement AutoCloseable, preventing their use in a try-with-resources statement. Examples range from ImageReader to DataStore/DataAccess. Some interfaces like FeatureReader already imple