apache / pekko-connectors

Apache Pekko Connectors is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Apache Pekko.
https://pekko.apache.org/
Apache License 2.0
64 stars 32 forks source link

DirectoryChangesSource.java does not compile with Java 21 #296

Open pjfanning opened 10 months ago

pjfanning commented 10 months ago

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

raboof commented 4 months ago

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 commented 4 months ago

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

pjfanning commented 4 months ago

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.

raboof commented 4 months ago

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.