RFR: 8341282: (fs) Move creation time fallback logic to Java layer (Linux)

Alan Bateman alanb at openjdk.org
Tue Oct 1 08:50:42 UTC 2024


On Mon, 30 Sep 2024 22:57:15 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> Move the decision as to whether `BasicFileAttributes.creationTime()` falls back to the modified time from the native layer to the Java layer.

src/java.base/unix/classes/sun/nio/fs/UnixFileAttributes.java line 167:

> 165:     @Override
> 166:     public FileTime creationTime() {
> 167:         if (UnixNativeDispatcher.birthtimeSupported() && !birthtime_invalid) {

If you invert and rename this from "invalid" to "valid" then it would improve the readability.

src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c line 630:

> 628:                          (jlong)buf->stx_btime.tv_sec);
> 629:     (*env)->SetLongField(env, attrs, attrs_st_birthtime_nsec,
> 630:                          (jlong)buf->stx_btime.tv_nsec);

If you allow the lines to be just a bit long then it would avoid the line splits in this change.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21274#discussion_r1782373291
PR Review Comment: https://git.openjdk.org/jdk/pull/21274#discussion_r1782372966


More information about the nio-dev mailing list