RFR: 8293067: (fs) Implement WatchService using system library (macOS) [v8]

Maxim Kartashev mkartashev at openjdk.org
Wed Oct 19 06:26:00 UTC 2022


On Wed, 19 Oct 2022 06:15:17 GMT, Maxim Kartashev <mkartashev at openjdk.org> wrote:

>> src/java.base/macosx/classes/sun/nio/fs/MacOSXWatchService.java line 313:
>> 
>>> 311:         private static final long kFSEventStreamEventFlagRootChanged     = 0x00000020;
>>> 312: 
>>> 313:         private static final Path relativeRootPath = theFS.getPath("");
>> 
>> Same comment as for lines 51-52. Unsure of line 311 however as that refers to a specific constant. Should that be perhaps in `UnixConstants`?
>
> I'll change the spelling of all but `kFSEventStreamEventFlagRootChanged`, which I'd rather keep as is. The constant being spelled exactly the same as in the corresponding C header file makes it easier to check its correctness (https://developer.apple.com/documentation/coreservices/1455361-fseventstreameventflags/kfseventstreameventflagrootchanged?language=objc).
> As for moving it to `UnixConstants`, I'm also not so sure as it is hardly a "Unix" constant, more like a macOS constant.

How about I make `kFSEventStreamEventFlagRootChanged` into a local variable? It's only used in one place and doesn't have to be a static field really.

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

PR: https://git.openjdk.org/jdk/pull/10140


More information about the nio-dev mailing list