[ 
https://issues.apache.org/jira/browse/GROOVY-8251?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16076827#comment-16076827
 ] 

John Wagenleitner edited comment on GROOVY-8251 at 7/6/17 4:30 PM:
-------------------------------------------------------------------

Looks like GROOVY-7572 added a {{withAutoCloseable}} method in the NIO 
submodule and it's in 2.5.  Since 2.5 is Java 7+ it may make more sense to move 
the new method into core rather than NIO.


was (Author: jwagenleitner):
Looks like GROOVY-7572 added a {{withAutoCloseable}} method in the NIO 
submodule and it's in 2.5.  I don't know if there was a reason for the 
different name, but I think it would make more sense to allow {{withCloseable}} 
to take either a {{Closeable}} or {{AutoCloseable}}.  I think to keep binary 
compatibility a new {{withCloseable}} method would have to be added and not 
changing the signature of the existing method.  Since 2.5 is not out yet (still 
in beta), depending on how others feel, I wonder if there's still time to make 
a change.

> Implement withCloseable on AutoCloseable
> ----------------------------------------
>
>                 Key: GROOVY-8251
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8251
>             Project: Groovy
>          Issue Type: Bug
>          Components: groovy-jdk
>    Affects Versions: 2.5.0-beta-1
>            Reporter: Henri Tremblay
>
> The Groovy implementation of try-with-resource is through 
> {{withCloseable()}}. The problem is that {{withCloseable}} only exists for 
> classes implementing the {{Closeable}} interface.
> But a try-with-resource works with the {{AutoCloseable}} interface. So 
> {{withCloseable}} should probably be moved on step below to {{AutoCloseable}} 
> (that {{Closeable}} extends).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to