RFR: 8017513: Support for closeable streams

Zhong Yu zhong.j.yu at gmail.com
Wed Jul 10 22:17:43 UTC 2013


A few things that require clarification:

If we have

    interface A extends B, C
    interface B extends MayHoldCloseableResource
    interface C extends AutoCloseable

is A considered definitely holding resource?

If @HoldsResource is applied to a subtype of MayHoldCloseableResource

    @HoldsResource
    interface D extends B

What does it mean?

If it mean that D definitely holds resource, is @HoldResource still
necessary on  methods that return D?


Zhong Yu



On Wed, Jul 10, 2013 at 4:30 PM, Henry Jen <henry.jen at oracle.com> 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.
>
> Cheers,
> Henry



More information about the core-libs-dev mailing list