-
Notifications
You must be signed in to change notification settings - Fork 409
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
[Improvement] Compile fails when using JDK21 #906
Comments
It's OK on Ubuntu 22.04 with JDK21, maybe we should also test other Linux release OS including Ubuntu. |
I'm now getting different issues. The current main fails on OSX due to a spotless issue:
uname -a
Darwin Justins-MBP.hub 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:41:28 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_ARM64_T6020 arm64
% java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing) The current main fails on Ubuntu due to a spotless issue, but this looks different from the OSX one. It works on JDK8.
uname -a
Linux ip-172-31-4-208 6.2.0-1012-aws #12~22.04.1-Ubuntu SMP Thu Sep 7 14:01:24 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
:~/gravitino$ java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment (build 21.0.1+12-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 21.0.1+12-Ubuntu-222.04, mixed mode, sharing) |
I don't have any issue testing on macOS with jdk21 as default java version. Please using the latest main branch and test again. |
Actually, our build enforces the compile jdk version to 8 and 17, no matter which version you installed in your OS. |
Steps to reproduce:
java -version
openjdk version "21.0.1" 2023-10-17
OpenJDK Runtime Environment Homebrew (build 21.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 21.0.1, mixed mode, sharing)
|
Given the issues are remove unused imports should be simple to fix - unless there are other issues. |
Also fails using JDK11 BTW |
This actually is a spotless problem, not a gravitino problem, see diffplug/spotless#1819. We should upgrade the spotless version to fix this problem. |
Currently, we can have two choices:
Both ways have pros and cons. I have a fix for solution 2, but it will introduce several JDK versions and confuse people. @xunliu @qqqttt123 @yuqi1129 @FANNG1 @justinmclean what's your opinion? |
JDK 21 is hard to support because it is hard to be compatible with JDK8 on java code style, so currently only support from 8 to 17. |
JDK11 should be worked, I verified several times, I guess you doesn't test in a clean environment, you still have Gradle deamon running when you switching to JDK11. I see this problem only exists in JDK21. |
+1 |
JDK11 and JDK17 are now working on the current main branch. |
### What changes were proposed in this pull request? Current spotless plugin has issues running against JDK21 (diffplug/spotless#1819), but we cannot upgrade the spotless version to a newer version to fix this issue, because newer version of Spotless requires at least JDK11. So for now, we enforce the JDK version to <= 17 when we running Gradle. ### Why are the changes needed? Fix the problem when Gradle running with JDK21. Fix: #906 ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Verified locally on JDK 8, 11, 17 between macOS and Ubuntu.
What would you like to be improved?
Compile fails when using JDK21 with this error:
Build gravitino FAILURE reason:
Execution failed for task ':api:compileJava':
java.lang.RuntimeException: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid'
How should we improve?
Be able to compile when using JDK21
The text was updated successfully, but these errors were encountered: