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

Konrad Windszus commented on JCRVLT-348:
----------------------------------------

After having a 2nd thougth those IO related classes should rather implement 
Closeable (instead of AutoCloseable) because
# the semantics are slightly different (close() in AutoCloseable doesn't have 
to be idempotent: 
https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html) and for 
archive this is clearly idempotent
# a generic exception is never thrown
# Archive is an IO class and should therefore use the more specific interface 
for IO classes
# Closeable implements AutoCloseable (i.e. it is still possible to use try with 
resources)

Done in  https://svn.apache.org/r1864117.

> Implement AutoCloseable for classes which have a close method
> -------------------------------------------------------------
>
>                 Key: JCRVLT-348
>                 URL: https://issues.apache.org/jira/browse/JCRVLT-348
>             Project: Jackrabbit FileVault
>          Issue Type: Improvement
>          Components: vlt
>    Affects Versions: 3.2.8
>            Reporter: Konrad Windszus
>            Assignee: Konrad Windszus
>            Priority: Major
>             Fix For: 3.2.10
>
>
> To be able to close with [try with 
> resources|https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html]
>  all interfaces which provide a close() method (not throwing any unchecked 
> exceptions) should extend from {{AutoCloseable}} 
> (https://docs.oracle.com/javase/7/docs/api/java/lang/AutoCloseable.html) 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to