RFR: 5041655: (ch) FileLock: negative param and overflow issues [v7]

Alan Bateman alanb at openjdk.java.net
Fri Feb 11 10:25:11 UTC 2022


On Thu, 10 Feb 2022 21:01:03 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Add an implementation note to `java.nio.channels.FileLock.overlaps(long,long)` indicating that the method does not check its parameters. Adding such checks would be an incompatible change.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   5041655: Further refinement of zero size lock specification

src/java.base/share/classes/java/nio/channels/AsynchronousFileChannel.java line 429:

> 427:      * {@link #lock(Object,CompletionHandler)} method simply locks a region
> 428:      * of size {@link Long#MAX_VALUE}. If a lock is created with a valid
> 429:      * {@code position} and a {@code size} parameter of zero, then a lock of

I think we've got the javadoc change to a good place. One minor point is that "created with a valid position" may be a bit confusing as you can't create a lock with an invalid position. What would you think of "If the position is non-negative and the size is zero then a lock of size ...".

-------------

PR: https://git.openjdk.java.net/jdk/pull/7254


More information about the nio-dev mailing list