This isn't straightforward, because sun.nio.fs.UnixPath#register validates the WatchService instance is sun.nio.fs.AbstractWatchService, but sun.nio.fs.AbstractWatchService is package private, so we can't extend it.
A lot of code in sun.nio.fs is actually package-private and make extensions difficult.
Additionally, it is considered poor practice to replace the Default FileSystem (see Kevin Bourillon's comment on https://plus.google.com/+googleguava/posts/a3idqfdnpzC); however in this particular case, we might consider it an exception to the rule.
This will also mean removing a host of code duplicated from OpenJDK.
This isn't straightforward, because
sun.nio.fs.UnixPath#register
validates theWatchService
instance issun.nio.fs.AbstractWatchService
, butsun.nio.fs.AbstractWatchService
is package private, so we can't extend it. A lot of code insun.nio.fs
is actually package-private and make extensions difficult.Additionally, it is considered poor practice to replace the Default FileSystem (see Kevin Bourillon's comment on https://plus.google.com/+googleguava/posts/a3idqfdnpzC); however in this particular case, we might consider it an exception to the rule.
This will also mean removing a host of code duplicated from OpenJDK.