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

Enable xtf build on jdk 21 #590

Closed
mchoma opened this issue Oct 9, 2024 · 6 comments
Closed

Enable xtf build on jdk 21 #590

mchoma opened this issue Oct 9, 2024 · 6 comments

Comments

@mchoma
Copy link
Contributor

mchoma commented Oct 9, 2024

Experiencing

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project core: Fatal error compiling: java.lang.NoSuchFieldError: Class com.sun.tools.javac.tree.JCTree$JCImport does not have member field 'com.sun.tools.javac.tree.JCTree qualid' -> [Help 1]

with

java -version
openjdk version "21.0.4" 2024-07-16
OpenJDK Runtime Environment (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)
@mchoma
Copy link
Contributor Author

mchoma commented Oct 9, 2024

@dosu do you know what the solution for this problem could be?

Copy link

dosubot bot commented Oct 9, 2024

The error you're encountering is due to the use of internal JDK classes, specifically com.sun.tools.javac.tree.JCTree, which have changed in JDK 21. These internal APIs are not guaranteed to be stable across JDK versions.

To resolve this issue, consider the following steps:

  1. Update Dependencies: Check if any third-party libraries or plugins you are using have been updated to support JDK 21. Update them to the latest versions if available.

  2. Avoid Internal APIs: Refactor the code to avoid using internal JDK classes. Look for alternatives in the public API that can achieve the same functionality.

  3. Use a Compatible Compiler Plugin: Ensure that the maven-compiler-plugin or any other tools you are using are compatible with JDK 21. You might need to upgrade to a newer version if available.

  4. Check for Updates: Look for any updates or patches in the xtf project or related documentation that address compatibility with JDK 21.

These steps should help you address the compatibility issues with JDK 21.

To continue talking to Dosu, mention @dosu.

@mchoma
Copy link
Contributor Author

mchoma commented Oct 9, 2024

@dosu are you able to find out which particular dependency need update?

Copy link

dosubot bot commented Oct 9, 2024

The specific dependency that needs to be updated is the maven-compiler-plugin. The current version is 3.8.1, and it should be updated to a version that supports JDK 21, such as 3.10.1 or later [1].

To continue talking to Dosu, mention @dosu.

@mchoma
Copy link
Contributor Author

mchoma commented Oct 9, 2024

For reference looking around on internet it could be also lombok. https://stackoverflow.com/questions/77171270/compilation-error-after-upgrading-to-jdk-21-nosuchfielderror-jcimport-does-n

mchoma added a commit to mchoma/xtf that referenced this issue Oct 10, 2024

Verified

This commit was signed with the committer’s verified signature.
RossBrunton Ross Brunton
mnovak pushed a commit that referenced this issue Oct 11, 2024

Verified

This commit was signed with the committer’s verified signature.
RossBrunton Ross Brunton
@mchoma
Copy link
Contributor Author

mchoma commented Nov 26, 2024

This was fixed by #593. Closing.

@mchoma mchoma closed this as completed Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant