-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Conversation
This fixes a bug that wasn't including the class used for a static import where only the static import is whitelisted.
Pinging @elastic/es-core-infra |
There was a problem hiding this 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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yes!
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. |
Can you at least add a single line // comment indicating one is a superset? And also a test would be good |
You could also add a check in the lookup constructor ensuring the superset precondition |
It's not a superset. Will add a comment. |
Comments added. |
Point noted: I was thinking of the names, the values are a superset. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rjernst Thanks for the review! |
…classloader (#34424) This fixes a bug that wasn't including the class used for a static import where only the static import is whitelisted.
* 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)
…classloader (#34424) This fixes a bug that wasn't including the class used for a static import where only the static import is whitelisted.
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.