Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DirectoryChangesSource.java does not compile with Java 21 #296

Open
pjfanning opened this issue Dec 23, 2023 · 4 comments
Open

DirectoryChangesSource.java does not compile with Java 21 #296

pjfanning opened this issue Dec 23, 2023 · 4 comments
Labels
file the 'file' component help wanted Extra attention is needed

Comments

@pjfanning
Copy link
Contributor

pjfanning commented Dec 23, 2023

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
Copy link
Member

raboof commented Jul 1, 2024

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
Copy link
Member

raboof commented Jul 2, 2024

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

@raboof raboof added the file the 'file' component label Jul 2, 2024
@pjfanning
Copy link
Contributor Author

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
Copy link
Member

raboof commented Jul 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file the 'file' component help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants