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

2018-07-23 Thread Ben Caradoc-Davies
I am still investigating this change. I think I have found a use-case 
where deprecation of dispose() and third-party migration to close() 
might introduce a resource leak. I will report back when I have finished 
my investigation.


Kind regards,
Ben.

On 07/06/18 14:29, Ben Caradoc-Davies wrote:

Jody,

the problem is that doing it this way will break any third-party code 
that already implements an interface with dispose(). Their 
implementation will override dispose() and fail to implement close().


What we could do is provide default implementations for *both* close() 
and @Deprecated dispose() that call each other. All implementations with 
dispose() will work fine, and will work just the same when dispose() is 
renamed to close().


I think we need a deprecation cycle:

Stage one (GeoTools 20): introduce @Deprecated interface Disposable 
(extends AutoCloseable) with @Deprecated default dispose() that calls 
close() and default close() that calls dispose(). All implementations 
have dispose() marked @Deprecated. All implementations can now have 
their dispose() renamed to close() as convenient, with @Deprecated 
removed. The default dispose() will provide backwards compatibility.


Stage two (GeoTools 21): remove Disposable entirely, replacing it with 
AutoClosable. Any remaining dispose() methods renamed to close(). 
Third-party code that ignored the deprecation warnings is now broken.


Is one release cycle enough deprecation before removal?

Kind regards,
Ben.

On 07/06/18 10:41, Jody Garnett wrote:

You could swap this around, rename the dispose implementations to close,
and provide a deprecated default implementation of dispose that calls
close.
This way you can manage eventually remove dispose() from the API.




--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Ben Caradoc-Davies
And I hope Josh Bloch also hates checked exceptions, which are the only 
reason AutoCloseable was required and Closeable could not be used for 
try-with-resources (because the exception specification was too narrow).


On 07/06/18 14:48, Ben Caradoc-Davies wrote:

I hate checked exceptions so much.


--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Ben Caradoc-Davies
The one thing I am still thinking about is the impact of checked 
exceptions. Our interfaces that include dispose() without throws should 
probably end up with close() without throws after stage two and keep 
dispose() without throws during stage one to maintain backwards 
compatibility (so client code using the interface does not get a compile 
failure with an unhandled exception during the transition). We might 
need two interfaces because we have dispose() without throws and 
dispose() with throws.


I hate checked exceptions so much.

On 07/06/18 14:29, Ben Caradoc-Davies wrote:

Jody,

the problem is that doing it this way will break any third-party code 
that already implements an interface with dispose(). Their 
implementation will override dispose() and fail to implement close().


What we could do is provide default implementations for *both* close() 
and @Deprecated dispose() that call each other. All implementations with 
dispose() will work fine, and will work just the same when dispose() is 
renamed to close().


I think we need a deprecation cycle:

Stage one (GeoTools 20): introduce @Deprecated interface Disposable 
(extends AutoCloseable) with @Deprecated default dispose() that calls 
close() and default close() that calls dispose(). All implementations 
have dispose() marked @Deprecated. All implementations can now have 
their dispose() renamed to close() as convenient, with @Deprecated 
removed. The default dispose() will provide backwards compatibility.


Stage two (GeoTools 21): remove Disposable entirely, replacing it with 
AutoClosable. Any remaining dispose() methods renamed to close(). 
Third-party code that ignored the deprecation warnings is now broken.


Is one release cycle enough deprecation before removal?

Kind regards,
Ben.

On 07/06/18 10:41, Jody Garnett wrote:

You could swap this around, rename the dispose implementations to close,
and provide a deprecated default implementation of dispose that calls
close.
This way you can manage eventually remove dispose() from the API.




--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Ben Caradoc-Davies

Jody,

the problem is that doing it this way will break any third-party code 
that already implements an interface with dispose(). Their 
implementation will override dispose() and fail to implement close().


What we could do is provide default implementations for *both* close() 
and @Deprecated dispose() that call each other. All implementations with 
dispose() will work fine, and will work just the same when dispose() is 
renamed to close().


I think we need a deprecation cycle:

Stage one (GeoTools 20): introduce @Deprecated interface Disposable 
(extends AutoCloseable) with @Deprecated default dispose() that calls 
close() and default close() that calls dispose(). All implementations 
have dispose() marked @Deprecated. All implementations can now have 
their dispose() renamed to close() as convenient, with @Deprecated 
removed. The default dispose() will provide backwards compatibility.


Stage two (GeoTools 21): remove Disposable entirely, replacing it with 
AutoClosable. Any remaining dispose() methods renamed to close(). 
Third-party code that ignored the deprecation warnings is now broken.


Is one release cycle enough deprecation before removal?

Kind regards,
Ben.

On 07/06/18 10:41, Jody Garnett wrote:

You could swap this around, rename the dispose implementations to close,
and provide a deprecated default implementation of dispose that calls
close.
This way you can manage eventually remove dispose() from the API.


--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Jody Garnett
Yes we should, we should always be driving our library towards "mainstream"
java conventions when we can.

We have had a couple goes of making sure closable things are closable
(feature readers, etc...). Thanks for taking this next step.
--
Jody Garnett


On Wed, 6 Jun 2018 at 19:32, Ben Caradoc-Davies  wrote:

> Good thinking. This will require more work, but will most likely be best
> in the long term. We should probably deprecate the proposed Disposable
> class as well for good measure.
>
> Should we change all uses in GeoTools from dispose() to close()? This
> makes sense but will be a widespread change with impact on pull requests
> and future backports.
>
> Kind regards,
> Ben.
>
> On 07/06/18 10:41, Jody Garnett wrote:
> > You could swap this around, rename the dispose implementations to close,
> > and provide a deprecated default implementation of dispose that calls
> > close.
> > This way you can manage eventually remove dispose() from the API.
>
> --
> Ben Caradoc-Davies 
> Director
> Transient Software Limited 
> 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


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

2018-06-06 Thread Ben Caradoc-Davies
Good thinking. This will require more work, but will most likely be best 
in the long term. We should probably deprecate the proposed Disposable 
class as well for good measure.


Should we change all uses in GeoTools from dispose() to close()? This 
makes sense but will be a widespread change with impact on pull requests 
and future backports.


Kind regards,
Ben.

On 07/06/18 10:41, Jody Garnett wrote:

You could swap this around, rename the dispose implementations to close,
and provide a deprecated default implementation of dispose that calls
close.
This way you can manage eventually remove dispose() from the API.


--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Ben Caradoc-Davies
Thanks for the regex. I would also like to update all classes with 
dispose, not just interfaces.


On 07/06/18 08:08, Nuno Oliveira wrote:

Hi Ben,

I also used the support of the find command:

find . | grep -E "\.java$" | xargs -i grep -l -E 
"((public)|(^))\s*interface" {} | xargs -i grep -l -E "void\s+dispose" {}


+1 for the proposal.

On 06/06/2018 02:11 AM, Ben Caradoc-Davies wrote:

Thanks, Nuno. How did you make the list? I have been using things like:
find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort

Instead of editing your list, I would like to make a change proposal 
on the wiki.


Kind regards,
Ben. 


--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-06 Thread Nuno Oliveira

Ah! Good one Jody, +1

On 06/06/2018 11:41 PM, Jody Garnett wrote:
You could swap this around, rename the dispose implementations to close, and 
provide a deprecated default implementation of dispose that calls close.


This way you can manage eventually remove dispose() from the API.
On Wed, Jun 6, 2018 at 3:09 PM Nuno Oliveira > wrote:


Hi Ben,

I also used the support of the find command:

find . | grep -E "\.java$" | xargs -i grep -l -E
"((public)|(^))\s*interface" {}
| xargs -i grep -l -E "void\s+dispose" {}

+1 for the proposal.

On 06/06/2018 02:11 AM, Ben Caradoc-Davies wrote:
> Thanks, Nuno. How did you make the list? I have been using things like:
> find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort
>
> Instead of editing your list, I would like to make a change proposal on
the wiki.
>
> Kind regards,
> Ben.
>
> On 05/06/18 22:17, Nuno Oliveira wrote:
>> You can count on me, I can dedicate some spare during WE to this.
>>
>> I guess before deciding on an attack plan, it would be good to have a
list of
>> the concerned interfaces, I have started to put a list together here:
>>
>>

https://docs.google.com/spreadsheets/d/1u3488JvSs34IMZ1TLjJ5FYQBAFHhQ4QHqfHfULH_k1s/edit?usp=sharing

>>
>>
>> Feel free to ask me edition permissions ...
>>
>> On 06/05/2018 09:17 AM, Andrea Aime wrote:
>>> On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton mailto:ijtur...@gmail.com>
>>> >> wrote:
>>>
>>>
>>>     - Who is interested in participating in this work?
>>>
>>>
>>>     I'd be up to do some of it.
>>>
>>>
>>> Same here. As spare time contribution, if we are a group, we do the
>>> deprecation, and attack one interface at a time.
>>> As a code sprint if we want to do all toghether (though, in a week
long code
>>> sprint, we might want to look into more
>>> "urgent yet too big" stuff, like running the whole project stack on Java
>>> 10-11).
>>>
>>> Cheers
>>> Andrea
>>>
>>> == GeoServer Professional Services from the experts! Visit
>>> http://goo.gl/it488V for more information. == Ing. Andrea


Aime @geowolf
>>> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
>>> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
>>> 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
>>>
>>>
>>> ___
>>> GeoTools-Devel mailing list
>>> GeoTools-Devel@lists.sourceforge.net

>>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>>
>>
>>
>>

--
>> 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
>>
>

-- 
Regards,

Nuno Oliveira
==
GeoServer Professional Services from the 

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

2018-06-06 Thread Jody Garnett
You could swap this around, rename the dispose implementations to close,
and provide a deprecated default implementation of dispose that calls
close.

This way you can manage eventually remove dispose() from the API.
On Wed, Jun 6, 2018 at 3:09 PM Nuno Oliveira 
wrote:

> Hi Ben,
>
> I also used the support of the find command:
>
> find . | grep -E "\.java$" | xargs -i grep -l -E
> "((public)|(^))\s*interface" {}
> | xargs -i grep -l -E "void\s+dispose" {}
>
> +1 for the proposal.
>
> On 06/06/2018 02:11 AM, Ben Caradoc-Davies wrote:
> > Thanks, Nuno. How did you make the list? I have been using things like:
> > find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort
> >
> > Instead of editing your list, I would like to make a change proposal on
> the wiki.
> >
> > Kind regards,
> > Ben.
> >
> > On 05/06/18 22:17, Nuno Oliveira wrote:
> >> You can count on me, I can dedicate some spare during WE to this.
> >>
> >> I guess before deciding on an attack plan, it would be good to have a
> list of
> >> the concerned interfaces, I have started to put a list together here:
> >>
> >>
> https://docs.google.com/spreadsheets/d/1u3488JvSs34IMZ1TLjJ5FYQBAFHhQ4QHqfHfULH_k1s/edit?usp=sharing
> >>
> >>
> >> Feel free to ask me edition permissions ...
> >>
> >> On 06/05/2018 09:17 AM, Andrea Aime wrote:
> >>> On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton  >>> > wrote:
> >>>
> >>>
> >>> - Who is interested in participating in this work?
> >>>
> >>>
> >>> I'd be up to do some of it.
> >>>
> >>>
> >>> Same here. As spare time contribution, if we are a group, we do the
> >>> deprecation, and attack one interface at a time.
> >>> As a code sprint if we want to do all toghether (though, in a week
> long code
> >>> sprint, we might want to look into more
> >>> "urgent yet too big" stuff, like running the whole project stack on
> Java
> >>> 10-11).
> >>>
> >>> Cheers
> >>> Andrea
> >>>
> >>> == GeoServer Professional Services from the experts! Visit
> >>> http://goo.gl/it488V for more information. == Ing. Andrea
> 
> Aime @geowolf
> >>> Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054
> Massarosa
> >>> (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
> >>> 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
> >>>
> >>>
> >>> ___
> >>> GeoTools-Devel mailing list
> >>> GeoTools-Devel@lists.sourceforge.net
> >>> https://lists.sourceforge.net/lists/listinfo/geotools-devel
> >>
> >>
> >>
> >>
> --
> >> 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
> >>
> >
>
> --
> 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 

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

2018-06-06 Thread Nuno Oliveira

Hi Ben,

I also used the support of the find command:

find . | grep -E "\.java$" | xargs -i grep -l -E "((public)|(^))\s*interface" {} 
| xargs -i grep -l -E "void\s+dispose" {}


+1 for the proposal.

On 06/06/2018 02:11 AM, Ben Caradoc-Davies wrote:

Thanks, Nuno. How did you make the list? I have been using things like:
find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort

Instead of editing your list, I would like to make a change proposal on the 
wiki.

Kind regards,
Ben.

On 05/06/18 22:17, Nuno Oliveira wrote:

You can count on me, I can dedicate some spare during WE to this.

I guess before deciding on an attack plan, it would be good to have a list of 
the concerned interfaces, I have started to put a list together here:


https://docs.google.com/spreadsheets/d/1u3488JvSs34IMZ1TLjJ5FYQBAFHhQ4QHqfHfULH_k1s/edit?usp=sharing 



Feel free to ask me edition permissions ...

On 06/05/2018 09:17 AM, Andrea Aime wrote:
On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton > wrote:



    - Who is interested in participating in this work?


    I'd be up to do some of it.


Same here. As spare time contribution, if we are a group, we do the 
deprecation, and attack one interface at a time.
As a code sprint if we want to do all toghether (though, in a week long code 
sprint, we might want to look into more
"urgent yet too big" stuff, like running the whole project stack on Java 
10-11).


Cheers
Andrea

== GeoServer Professional Services from the experts! Visit 
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf 
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa 
(LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 
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


___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel




--
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





--
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 

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

2018-06-05 Thread Ben Caradoc-Davies

Thanks, Nuno. How did you make the list? I have been using things like:
find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort

Instead of editing your list, I would like to make a change proposal on 
the wiki.


Kind regards,
Ben.

On 05/06/18 22:17, Nuno Oliveira wrote:

You can count on me, I can dedicate some spare during WE to this.

I guess before deciding on an attack plan, it would be good to have a 
list of the concerned interfaces, I have started to put a list together 
here:


https://docs.google.com/spreadsheets/d/1u3488JvSs34IMZ1TLjJ5FYQBAFHhQ4QHqfHfULH_k1s/edit?usp=sharing 



Feel free to ask me edition permissions ...

On 06/05/2018 09:17 AM, Andrea Aime wrote:
On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton > wrote:



    - Who is interested in participating in this work?


    I'd be up to do some of it.


Same here. As spare time contribution, if we are a group, we do the 
deprecation, and attack one interface at a time.
As a code sprint if we want to do all toghether (though, in a week 
long code sprint, we might want to look into more
"urgent yet too big" stuff, like running the whole project stack on 
Java 10-11).


Cheers
Andrea

== GeoServer Professional Services from the experts! Visit 
http://goo.gl/it488V for more information. == Ing. Andrea Aime 
@geowolf Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 
55054 Massarosa (LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: 
+39 339 8844549 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


___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel




--
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



--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-05 Thread Ben Caradoc-Davies

On 05/06/18 20:05, Ian Turton wrote:

On Tue, 5 Jun 2018 at 00:25, Ben Caradoc-Davies  wrote:

- Should we add AutoCloseable to interfaces, and if so which ones? We
could make a list.

This is an obvious first step, is there an easy way to do it? grep for
dispose?


I found many interfaces and classes with:
find . -name "*.java" -exec grep -H 'void dispose()' {} \;

With context:
find . -name "*.java" -exec grep -H -B2 'void dispose()' {} \;

Names only:
find . -name "*.java" -exec grep -l 'void dispose()' {} \; | sort

Nuno also made a list.


- Should we rename dispose() to close() in implementers and add a
deprecated dispose() that wraps close(), or just add a close() that
wraps dispose()?

I'd favour deprecating a dispose() that wraps close() - makes it clearer
what we intend.


This was my first thought, but now I prefer Nuno and Erik's suggestion 
of a default method. I am contemplating adding a Disposable interface.


Kind regards,

--
Ben Caradoc-Davies 
Director
Transient Software Limited 
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


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

2018-06-05 Thread Nuno Oliveira

You can count on me, I can dedicate some spare during WE to this.

I guess before deciding on an attack plan, it would be good to have a list of 
the concerned interfaces, I have started to put a list together here:


https://docs.google.com/spreadsheets/d/1u3488JvSs34IMZ1TLjJ5FYQBAFHhQ4QHqfHfULH_k1s/edit?usp=sharing

Feel free to ask me edition permissions ...

On 06/05/2018 09:17 AM, Andrea Aime wrote:
On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton > wrote:



- Who is interested in participating in this work?


I'd be up to do some of it.


Same here. As spare time contribution, if we are a group, we do the 
deprecation, and attack one interface at a time.
As a code sprint if we want to do all toghether (though, in a week long code 
sprint, we might want to look into more

"urgent yet too big" stuff, like running the whole project stack on Java 10-11).

Cheers
Andrea

== GeoServer Professional Services from the experts! Visit 
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf 
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa (LU) 
phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549 
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


___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


--
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___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


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

2018-06-05 Thread Andrea Aime
On Tue, Jun 5, 2018 at 10:05 AM, Ian Turton  wrote:

>
>> - Who is interested in participating in this work?
>>
>>
> I'd be up to do some of it.
>

Same here. As spare time contribution, if we are a group, we do the
deprecation, and attack one interface at a time.
As a code sprint if we want to do all toghether (though, in a week long
code sprint, we might want to look into more
"urgent yet too big" stuff, like running the whole project stack on Java
10-11).

Cheers
Andrea

== GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information. == Ing. Andrea Aime @geowolf
Technical Lead GeoSolutions S.A.S. Via di Montramito 3/A 55054 Massarosa
(LU) phone: +39 0584 962313 fax: +39 0584 1660272 mob: +39 339 8844549
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___
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel


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

2018-06-05 Thread Ian Turton
On Tue, 5 Jun 2018 at 00:25, Ben Caradoc-Davies  wrote:

> 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 implement Closeable and thus AutoCloseable, but many do not.
>
> Java 7 try-with-resources improves code quality because it simplifies
> code by automating common boilerplate:
>
> https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
> https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
>
> Adding AutoCloseable to an interface is an API-breaking change because
> third-party subclasses that do not implement a close() method will no
> longer compile. Any change would be applied only to master and would
> target GeoTools 20.0 and GeoServer 2.14.0.
>

+1 for this anything that improves clean up and saves me writing code is
good!

>
> - Should we add AutoCloseable to interfaces, and if so which ones? We
> could make a list.
>

This is an obvious first step, is there an easy way to do it? grep for
dispose?


>
> - Do we make the change one interface at a time or try to do them all at
> once?
>
>
I would go for one at a time, working from a list. My feeling is that doing
one is something I could work on while waiting for something else to
complete, whereas doing all of them is going to be a weekend or more and
harder to share the work out.


> - Should we rename dispose() to close() in implementers and add a
> deprecated dispose() that wraps close(), or just add a close() that
> wraps dispose()?
>

I'd favour deprecating a dispose() that wraps close() - makes it clearer
what we intend.


>
> - As we are breaking the API anyway, should we get rid of dispose()
> entirely by renaming it to close() without adding a deprecated wrapper?
>
>
That is harder for downstream users to handle IMHO.


> - I thought of updating only interfaces and overrides. A more ambitious
> scope would find every deprecated dispose() and refactor to use
> try-with-resources. The alternative is to refactor incrementally over
> time. How do we wish to pay off our technical debt?
>
>
I would prefer to fight the debt as we go and find all the deprecated
disposes in our code as we go.


> - Who is interested in participating in this work?
>
>
I'd be up to do some of it.

Ian
--
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