RFR: 8017513: Support for closeable streams

Alan Bateman Alan.Bateman at oracle.com
Wed Jul 24 02:26:30 UTC 2013


On 10/07/2013 14:30, Henry Jen wrote:
> Hi,
>
> Please review webrev at
> http://cr.openjdk.java.net/~henryjen/ccc/8017513/0/webrev/index.html
>
> This webrev improve resource release experience on Streams by
> eliminating CloseableStream, instead, fold close capability into Stream.
>
> A new interface, java.util.MayHoldCloseableResource, indicates an
> implementation may or may not hold a resource need to be closed.
> Annotation {@link HoldsResource} may be used to guide users/static
> analysis tools that a MHCR instance that definitely hold a Closeable
> resource.
>
Overall this looks very reasonable to me.

A small point on Files.lines is that it could catch any IOException 
thrown by br.close and add it as a suppressed exception.

In XXXStream.concat then maybe it should be "are invoked" instead of "is 
invoked".

MayHoldCloseableResource needs an @since, also I assume the copyright 
data should be 2013.

FilesLambdaTest seems to overlap with Files/StreamsTest - do you need we 
need both? The sqeutil directory is a bit odd, is this used by other 
tests that are coming soon?

-Alan.



More information about the core-libs-dev mailing list