RFR: 8292279: (fs) Use try-with-resources to release NativeBuffer
Alan Bateman
alanb at openjdk.org
Fri Aug 12 09:27:15 UTC 2022
On Mon, 8 Aug 2022 07:35:44 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> Since [JDK-8260966](https://bugs.openjdk.org/browse/JDK-8260966), NativeBuffer implements AutoCloseable interface.
> Now we can use try-with-resources statements to simplify code.
This is a good cleanup. Many of the usages (esp. in UnixNativeDispatcher) has been converted to try-with-resources by way of other changes and it's good to go over the remaining and convert them too.
src/java.base/windows/classes/sun/nio/fs/WindowsFileAttributes.java line 267:
> 265: {
> 266: try (NativeBuffer buffer = NativeBuffers
> 267: .getNativeBuffer(SIZEOF_FILE_INFORMATION)) {
I think you can remove the line break to make this a bit more readable.
-------------
Marked as reviewed by alanb (Reviewer).
PR: https://git.openjdk.org/jdk/pull/9794
More information about the nio-dev
mailing list