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

Fix Painless method lookup over unknown super interfaces #97062

Merged
merged 2 commits into from Jun 24, 2023

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Jun 24, 2023

In Java 21 List now extends SequencedCollection, instead of Collection directly. When resolving methods Painless starts at the defined type, and iterates up through super classes and interfaces. Unfortunately if a superinterface was not known, as it is for SequencedCollection since it is not in the allowed list of classes, method resolution would give up. This commit adjusts the superinterface interation to continue traversing until the method is found or no more superinterfaces are found.

fixes #97022

In Java 21 List now extends SequencedCollection, instead of Collection
directly. When resolving methods Painless starts at the defined type,
and iterates up through super classes and interfaces. Unfortunately if a
superinterface was not known, as it is for SequencedCollection since it
is not in the allowed list of classes, method resolution would give up.
This commit adjusts the superinterface interation to continue traversing
until the method is found or no more superinterfaces are found.

fixes elastic#97022
@rjernst rjernst added >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v8.9.0 v8.10.0 labels Jun 24, 2023
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Jun 24, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

@elasticsearchmachine
Copy link
Collaborator

Hi @rjernst, I've created a changelog YAML for you.

Copy link
Contributor

@jdconrad jdconrad left a comment

Choose a reason for hiding this comment

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

LGTM!

@rjernst rjernst added auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) auto-backport-and-merge Automatically create backport pull requests and merge when ready labels Jun 24, 2023
@elasticsearchmachine elasticsearchmachine merged commit 16b4557 into elastic:main Jun 24, 2023
12 checks passed
@rjernst rjernst deleted the painless-java21 branch June 24, 2023 01:28
rjernst added a commit to rjernst/elasticsearch that referenced this pull request Jun 24, 2023
In Java 21 List now extends SequencedCollection, instead of Collection
directly. When resolving methods Painless starts at the defined type,
and iterates up through super classes and interfaces. Unfortunately if a
superinterface was not known, as it is for SequencedCollection since it
is not in the allowed list of classes, method resolution would give up.
This commit adjusts the superinterface interation to continue traversing
until the method is found or no more superinterfaces are found.

fixes elastic#97022
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.9

elasticsearchmachine pushed a commit that referenced this pull request Jun 24, 2023
…7064)

In Java 21 List now extends SequencedCollection, instead of Collection
directly. When resolving methods Painless starts at the defined type,
and iterates up through super classes and interfaces. Unfortunately if a
superinterface was not known, as it is for SequencedCollection since it
is not in the allowed list of classes, method resolution would give up.
This commit adjusts the superinterface interation to continue traversing
until the method is found or no more superinterfaces are found.

fixes #97022
breskeby pushed a commit to breskeby/elasticsearch that referenced this pull request Sep 5, 2023
In Java 21 List now extends SequencedCollection, instead of Collection
directly. When resolving methods Painless starts at the defined type,
and iterates up through super classes and interfaces. Unfortunately if a
superinterface was not known, as it is for SequencedCollection since it
is not in the allowed list of classes, method resolution would give up.
This commit adjusts the superinterface interation to continue traversing
until the method is found or no more superinterfaces are found.

fixes elastic#97022

(cherry picked from commit 16b4557)

# Conflicts:
#	gradle.properties
@breskeby
Copy link
Contributor

breskeby commented Sep 5, 2023

💚 All backports created successfully

Status Branch Result
7.17

Questions ?

Please refer to the Backport tool documentation

breskeby added a commit that referenced this pull request Sep 5, 2023
…9196)

In Java 21 List now extends SequencedCollection, instead of Collection
directly. When resolving methods Painless starts at the defined type,
and iterates up through super classes and interfaces. Unfortunately if a
superinterface was not known, as it is for SequencedCollection since it
is not in the allowed list of classes, method resolution would give up.
This commit adjusts the superinterface interation to continue traversing
until the method is found or no more superinterfaces are found.

fixes #97022

(cherry picked from commit 16b4557)

# Conflicts:
#	gradle.properties

Co-authored-by: Ryan Ernst <ryan@iernst.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport-and-merge Automatically create backport pull requests and merge when ready auto-merge Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache Team:Core/Infra Meta label for core/infra team v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Java 21 breaks painless lookups on java.util.List
4 participants