RFR: 8371689: (fs) CopyMoveHelper.copyToForeignTarget use of sourcePosixView is confusing [v3]

Alan Bateman alanb at openjdk.org
Fri Nov 14 18:19:12 UTC 2025


On Fri, 14 Nov 2025 18:11:56 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/share/classes/java/nio/file/CopyMoveHelper.java line 122:
>> 
>>> 120:                                                PosixFileAttributes.class,
>>> 121:                                                linkOptions);
>>> 122:         if (sourceAttrs == null)
>> 
>> This could if-then-else too.
>
>> This could if-then-else too.
> 
> Since if the posix view is supported, then `sourceAttrs` could not be `null` here, correct?

Right, but it can be simplified to `if (sourceSupportsPosixAttributes) { .. } else { ..}`.  What you have is okay too.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28304#discussion_r2528476157


More information about the nio-dev mailing list