-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add implicit this for class binding in Painless (#40285)
This change allows class bindings to add as their first argument, the base script class. The this reference to the base script class will be implicitly passed into a class binding as the first constructor argument upon initialization when specified as the first argument in whitelist entry for the class binding. This allows a class binding access to additional information added to the base script class such as more information about the current document or current shard. One extra requirement for this to work is the appropriate script base class must be whitelisted (should be empty).
- Loading branch information
Showing
7 changed files
with
133 additions
and
51 deletions.
There are no files selected for viewing
32 changes: 0 additions & 32 deletions
32
modules/lang-painless/src/main/java/org/elasticsearch/painless/BindingTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
...ainless/src/test/resources/org/elasticsearch/painless/spi/org.elasticsearch.painless.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# whitelist for tests | ||
class org.elasticsearch.painless.BindingsTests$BindingsTestScript { | ||
} | ||
|
||
static_import { | ||
int addWithState(int, int, int, double) bound_to org.elasticsearch.painless.BindingsTests$BindingTestClass | ||
int addThisWithState(BindingsTests.BindingsTestScript, int, int, int, double) bound_to org.elasticsearch.painless.BindingsTests$ThisBindingTestClass | ||
int addEmptyThisWithState(BindingsTests.BindingsTestScript, int) bound_to org.elasticsearch.painless.BindingsTests$EmptyThisBindingTestClass | ||
} |