Skip to content

Fix NoSuchMethodError happening on JDK 21 (fixes #885)#886

Merged
fawind merged 1 commit intopalantir:developfrom
gnodet:i885-no-such-method-error
Jun 20, 2023
Merged

Fix NoSuchMethodError happening on JDK 21 (fixes #885)#886
fawind merged 1 commit intopalantir:developfrom
gnodet:i885-no-such-method-error

Conversation

@gnodet
Copy link
Copy Markdown
Contributor

@gnodet gnodet commented Jun 19, 2023

See #885 for the full description of this issue.
The PR simply changed the argument to the interface so that the return type is not changed across JDKs.

@palantirtech
Copy link
Copy Markdown
Member

Thanks for your interest in palantir/palantir-java-format, @gnodet! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

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.
Copy link
Copy Markdown
Contributor

@fawind fawind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for contibuting!

@fawind
Copy link
Copy Markdown
Contributor

fawind commented Jun 20, 2023

Will take a look at getting the "Validation" action running on forks

@fawind fawind merged commit 013e6f6 into palantir:develop Jun 20, 2023
@svc-autorelease
Copy link
Copy Markdown
Collaborator

Released 2.33.0

@basil
Copy link
Copy Markdown

basil commented Aug 1, 2023

Did not fix the problem for me: #885 (comment)

@gnodet
Copy link
Copy Markdown
Contributor Author

gnodet commented Aug 1, 2023

Did not fix the problem for me: #885 (comment)

Unfortunately, I have to agree here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants