Automatic Resource Management, V.2
Stephen Colebourne
scolebourne at joda.org
Mon Apr 20 02:31:11 PDT 2009
2009/4/20 Joshua Bloch <jjb at google.com>:
> * 3. Does the construct work properly with “decorated” resources?*
> try (FileReader fr = new FileReader(path) {
> try (BufferedReader br = new BufferedReader(fr) {
> ... // Use buffered reader
> }
> }
Would this section be better written:
try (FileReader fr = new FileReader(path); BufferedReader br = new
BufferedReader(fr) {
... // Use buffered reader
}
ie. the second resource is derived from the first within one ARM block.
(More generally, I think I'd prefer a single resource per ARM, as I
think its a lot clearer overall and more consistent, but since you've
allowed it in the proposal, I assume you'd want to keep to that
style.)
Stephen
More information about the coin-dev
mailing list