Revisiting MayHoldCloseableResource
Doug Lea
dl at cs.oswego.edu
Sat Aug 3 09:48:45 PDT 2013
> Observation: the need for Stream to have a close() method comes about
> because of the desire to have static factory methods that will create
> streams that encapsulate a resource that requires closing, when there is
> no way to get access to that underlying resource. Such as Files.walk(dir)
> or Files.lines(path).
>
Or rather, no way provided in JDK. What if these methods were
recast do so? That is, exposing some closeable thing.
Maybe something like Files.directoryStream(dir).files().
A little less convenient, but avoids lots of problems.
> Orthogonal to Options 2 and 3 would be fixing the spec of AC.
Definitely. And it is clearly a fix. A spec itself should
just say what things do.
-Doug
More information about the lambda-libs-spec-observers
mailing list