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

Alan Bateman alanb at openjdk.java.net
Thu Feb 10 13:39:06 UTC 2022


On Wed, 9 Feb 2022 23:58:43 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: Update spec of zero lock size in channels and remove from FileLock spec

src/java.base/share/classes/java/nio/channels/FileLock.java line 269:

> 267:      * <p> If {@code size} is negative, {@code false} is returned regardless
> 268:      * of the value of {@code position}.
> 269:      *

This is okay but maybe it should move to the "@returns" description. The "@returns" description states the condition when true is returned. We could add "false if size is negative of the lock range does not overlap". Try it and see if it looks a bit better.

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

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


More information about the nio-dev mailing list