review request for 7022624, convert java.io test to use try-with-resources

Stuart Marks stuart.marks at oracle.com
Mon Feb 28 22:29:48 UTC 2011


Here's a small webrev with changes to a handful of java.io tests to use TWR.

http://cr.openjdk.java.net/~smarks/reviews/7022624/webrev.0/

I have a few minor questions:

* test/java/io/File/SetLastModified.java

Should the channel corresponding to a stream be considered a separate resource, 
or is it more like another object that represents the "same" resource? Since 
closing one closes the other, I treated them as peers and I didn't unroll the 
FileOutputStream and its channel into separate resource variables. However, I'm 
flexible on this.

* test/java/io/OutputStreamWriter/Encode.java

Pretty clearly a ServerSocket is a distinct resource from a Socket returned 
from the accept() call. However, does Socket.getInputStream() represent a 
distinct resource from the Socket? In this case it seemed most sensible to 
unroll them into separate resource variables, but again I could go either way 
on this.

* test/java/io/PrintStream/FailingConstructors.java

Please check over my NIO usage here. Hm, I did more conversion here than in the 
other FailingConstructors tests (see webrev for 7021209). Maybe I should go 
back and fix the others....

* test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java
* test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java

Odd, seems like mostly duplicate code....

Thanks!

s'marks



More information about the core-libs-dev mailing list