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

[Painless] Add a Map for java names to classes for use in the custom classloader #34424

Merged
merged 4 commits into from
Oct 12, 2018

Conversation

jdconrad
Copy link
Contributor

This fixes a bug that wasn't including the class used for a static import where only the static import is whitelisted. This affects extensions that use classes that are not part of the core.

This fixes a bug that wasn't including the class used for a static
import where only the static import is whitelisted.
@jdconrad jdconrad added >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v7.0.0 v6.5.0 labels Oct 12, 2018
@jdconrad jdconrad requested a review from rjernst October 12, 2018 18:01
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

With this change, that canonical map can contain different things than the Java class map right? Maybe they should be named to reflect that, or at least have very clear documentation about the difference (Java map being a superset).

Class<?> existingClass = javaClassNamesToClasses.get(clazz.getName());

if (existingClass == null) {
javaClassNamesToClasses.put(clazz.getName(), existingClass);
Copy link
Member

Choose a reason for hiding this comment

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

Why are you putting existingClass which is null, shouldn't it be clazz?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, yes!

@jdconrad
Copy link
Contributor Author

This whole thing needs docs. It's actually on my list to do for both this class and the PainlessLookup class. If it's all right I would like to do that as one PR together instead of just adding a couple bits here.

@rjernst
Copy link
Member

rjernst commented Oct 12, 2018

Can you at least add a single line // comment indicating one is a superset? And also a test would be good

@rjernst
Copy link
Member

rjernst commented Oct 12, 2018

You could also add a check in the lookup constructor ensuring the superset precondition

@jdconrad
Copy link
Contributor Author

It's not a superset. Will add a comment.

@jdconrad
Copy link
Contributor Author

Comments added.

@jdconrad
Copy link
Contributor Author

Point noted: I was thinking of the names, the values are a superset.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM

@jdconrad
Copy link
Contributor Author

@rjernst Thanks for the review!

@jdconrad jdconrad merged commit a7c4dbb into elastic:master Oct 12, 2018
jdconrad added a commit that referenced this pull request Oct 12, 2018
…classloader (#34424)

This fixes a bug that wasn't including the class used for a static import 
where only the static import is whitelisted.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Oct 15, 2018
* elastic/master:
  Mute PartitionedRoutingIT#testShrinking on Windows
  Mute testToQuery test
  [TEST] Make sure there are shards started so that `ESIntegTestCase#assertSameDocIdsOnShards()` does not fail with shard not found.
  Change shard changes api's threadpool from get to search (elastic#34421)
  Update TESTING.asciidoc title (elastic#34401)
  Tests: Fix DateFormatter equals tests with locale (elastic#34435)
  Docs: Remove unnecessary qualifier from wildcard import note (elastic#34419)
  CCR/TEST: AwaitsFix testFailOverOnFollower
  [Painless] Add a Map for java names to classes for use in the custom classloader (elastic#34424)
  TEST: Fix indentation in FullClusterRestartIT (elastic#34420)
  [WIP] Ingest Attachement: Upgrade tika to v1.19.1 (elastic#33896)
  NETWORKING: Upgrade Netty to 4.1.30 (elastic#34417)
  Allow an AuthenticationResult to return metadata (elastic#34382)
  [ML] Add an ingest pipeline definition to structure finder (elastic#34350)
  Handle pre-6.x time fields (elastic#34373)
  ListenableFuture should preserve ThreadContext (elastic#34394)
@jdconrad jdconrad mentioned this pull request Oct 16, 2018
23 tasks
kcm pushed a commit that referenced this pull request Oct 30, 2018
…classloader (#34424)

This fixes a bug that wasn't including the class used for a static import 
where only the static import is whitelisted.
@jimczi jimczi added v7.0.0-beta1 and removed v7.0.0 labels Feb 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v6.5.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants