review request for 7021209, use try-with-resources in lang, math, util

Alan Bateman Alan.Bateman at oracle.com
Tue Feb 22 08:52:20 UTC 2011


Stuart Marks wrote:
> Hi all,
>
> The following webrev changes a variety of files in java.lang, math, 
> and util, and their corresponding tests, to use the new Java 7 
> try-with-resources construct. I think most of the changes should be 
> straightforward. In a few cases (e.g., Currency.java and 
> LocalGregorianCalendar.java) there was no close() call in the original 
> code so the open file was always leaked.
>
> Naoto, several of the util changes look like they're in the 
> internationalization area. I don't know if you're the right person to 
> review them; if not, please forward or cc this to the right person. 
> Or, should I forward this to something like i18n-dev?
>
> Webrev is here:
>
> http://cr.openjdk.java.net/~smarks/reviews/7021209/webrev.0/
>
> Thanks!
>
> s'marks
Looks good to me and great to it fixing the bugs in Currency and 
LocalGregorianCalendar.

Minor comment on test/java/util/Formatter/FailingConstructors.java is 
that an alternative to using try-with-resources is to just replace it 
with Files.write(file.toPath(), FILE_CONTENTS.getBytes()). Same thing in 
test/java/util/Scanner/FailingConstructors.java.

-Alan.



More information about the core-libs-dev mailing list