-
Notifications
You must be signed in to change notification settings - Fork 49
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
NoSuchMethodError when formatting with JDK 21 #885
Comments
gnodet
added a commit
to gnodet/palantir-java-format
that referenced
this issue
Jun 19, 2023
The JDK internal class JCImport has changed recently. In JDK 17, the method was defined as: public JCTree getQualifiedIdentifier() { return qualid; } and in JDK 21: public JCFieldAccess getQualifiedIdentifier() { return qualid; } One possibility to fix that would be to fix the getSimpleName() method to use an argument of type com.sun.source.tree.ImportTree and call the getQualifiedIdentifier() method which returns a com.sun.source.tree.Tree and has not changed.
gnodet
added a commit
to gnodet/palantir-java-format
that referenced
this issue
Jun 20, 2023
The JDK internal class JCImport has changed recently. In JDK 17, the method was defined as: public JCTree getQualifiedIdentifier() { return qualid; } and in JDK 21: public JCFieldAccess getQualifiedIdentifier() { return qualid; } One possibility to fix that would be to fix the getSimpleName() method to use an argument of type com.sun.source.tree.ImportTree and call the getQualifiedIdentifier() method which returns a com.sun.source.tree.Tree and has not changed.
openjdk version "21-ea" 2023-09-19 Still broken for me on 2.33.0 and 2.34.0:
|
gnodet
added a commit
to gnodet/palantir-java-format
that referenced
this issue
Aug 2, 2023
fawind
pushed a commit
that referenced
this issue
Aug 7, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happened?
When compiling maven master branch using JDK 21, I have the following exception:
What did you want to happen?
The formatting should work !
Analysis
The
getSimpleName
method needs to adapted somehow. The JDK internal classJCImport
has changed recently. In JDK 17, the method was defined as:and in JDK 21:
One possibility to fix that would be to fix the
getSimpleName()
method to use an argument of typecom.sun.source.tree.ImportTree
and call thegetQualifiedIdentifier()
method which returns acom.sun.source.tree.Tree
and has not changed.The text was updated successfully, but these errors were encountered: