pekko-connectors icon indicating copy to clipboard operation
pekko-connectors copied to clipboard

DirectoryChangesSource.java does not compile with Java 21

Open pjfanning opened this issue 2 years ago • 4 comments

The CI build applies -Werror when CI build happens (see project/Common.scala)

DirectoryChangesSource.java uses a com.sun class that has been deprecated.

I tried adding @SuppressWarnings("deprecation") in various places but the Werror check still fails.

[warn] /home/runner/work/pekko-connectors/pekko-connectors/file/src/main/java/org/apache/pekko/stream/connectors/file/impl/DirectoryChangesSource.java:103:1: com.sun.nio.file.SensitivityWatchEventModifier in com.sun.nio.file has been deprecated and marked for removal

pjfanning avatar Dec 23 '23 23:12 pjfanning

The deprecated flag is:

      private final WatchKey watchKey =
          directoryPath.register(
              service,
              new WatchEvent.Kind<?>[] {ENTRY_CREATE, ENTRY_MODIFY, ENTRY_DELETE, OVERFLOW},
              // this is com.sun internal, but the service is useless on OSX without it
              SensitivityWatchEventModifier.HIGH);

https://bugs.openjdk.org/browse/JDK-8307097 says:

The polling based WatchService has been changed to ignore these modifiers when registering files to be watched.

It seems there's no alternative...

raboof avatar Jul 01 '24 21:07 raboof

Should we keep this open to decide if/when/how/... we can drop the reference to SensitivityWatchEventModifier.HIGH?

raboof avatar Jul 02 '24 06:07 raboof

Can we keep this open to remind us about the issue? At some stage, Java might announce the class is being removed and we will be forced to react.

pjfanning avatar Jul 02 '24 09:07 pjfanning

Can we keep this open to remind us about the issue? At some stage, Java might announce the class is being removed and we will be forced to react.

Sounds reasonable to me! It probably already affects people who use the module system right now.

raboof avatar Jul 02 '24 09:07 raboof