Skip to content

Deprecated warnings cause build failures with JDK 20 #4312

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

Closed
WorMzy opened this issue Apr 20, 2023 · 6 comments
Closed

Deprecated warnings cause build failures with JDK 20 #4312

WorMzy opened this issue Apr 20, 2023 · 6 comments

Comments

@WorMzy
Copy link

WorMzy commented Apr 20, 2023

OS:
Arch Linux

Package versions:

  • jdk-openjdk: 20.0.1.u9
  • maven: 3.8.7
  • ctags: 6.0.0
  • java-jsvc: 1.3.3
  • eclipse-ecj: 4.22

Several deprecated warnings are generated when running mvn:

[WARNING] COMPILATION WARNING : 
[INFO] -------------------------------------------------------------
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/framework/PluginFramework.java:[385,18] java.security.AccessController in java.security has been deprecated and marked for removal
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/util/Executor.java:[402,43] getId() in java.lang.Thread has been deprecated
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/logger/formatter/LogFormatter.java:[96,23] getThreadID() in java.util.logging.LogRecord has been deprecated
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/OpenGrokThreadFactory.java:[47,59] getId() in java.lang.Thread has been deprecated
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/Util.java:[682,19] URL(java.lang.String) in java.net.URL has been deprecated
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/Util.java:[1457,19] URL(java.lang.String) in java.net.URL has been deprecated
[WARNING] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/web/Util.java:[1474,19] URL(java.lang.String) in java.net.URL has been deprecated
[INFO] 7 warnings 
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /build/opengrok/src/opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/authorization/AuthorizationFramework.java: warnings found and -Werror specified
[INFO] 1 error

Full build log: opengrok-1.11.7-1-x86_64-build.log

@vladak
Copy link
Member

vladak commented Apr 21, 2023

Thanks for the report ! While OpenGrok is currently on Java 11 (and the switch to Java 17 is considered - #3899), it definitely would not hurt to address these. Is this something you'd like to work on ?

@vladak vladak added the build label Apr 21, 2023
@WorMzy
Copy link
Author

WorMzy commented Apr 21, 2023

Unfortunately I've not touched java code in over 15 years, so this is just a friendly heads-up rather than a volunteer to fix it. :)

Thanks for working on Opengrok!

@xbreizh
Copy link

xbreizh commented May 2, 2023

@vladak Hi, I can take a look if that's fine?

@vladak
Copy link
Member

vladak commented May 2, 2023

@vladak Hi, I can take a look if that's fine?

Sure, all issues are generally open to public :-)

@vladak vladak mentioned this issue Oct 2, 2023
@vladak vladak changed the title Deprecated warnings cause build failures Deprecated warnings cause build failures with JDK 20 Oct 27, 2023
@vladak
Copy link
Member

vladak commented Apr 17, 2025

The URL class related warnings were addressed in #4750.

@vladak
Copy link
Member

vladak commented Apr 17, 2025

The trouble with Thread.getId() is that until we switch the target bytecode to 19+ (which introduced the Thread.threadId() method) it has to stay that way unless we resort to reflection or conditional compilation.

vladak added a commit to vladak/OpenGrok that referenced this issue Apr 17, 2025
vladak added a commit to vladak/OpenGrok that referenced this issue Apr 17, 2025
vladak added a commit to vladak/OpenGrok that referenced this issue Apr 17, 2025
@vladak vladak closed this as completed in 447d311 Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants