From 858cc3297fcdd779f44239dd44781f46707da7e9 Mon Sep 17 00:00:00 2001 From: Stuart Tettemer Date: Wed, 4 Aug 2021 11:41:43 -0500 Subject: [PATCH] Script: Remove FieldAccess (#76109) Remove FieldAccess inner class from fields api classes based on changes in #76045 --- .../org.elasticsearch.script.fields.numbersort.txt | 7 +------ .../spi/org.elasticsearch.script.fields.score.txt | 7 +------ .../org.elasticsearch.script.fields.stringsort.txt | 7 +------ .../org/elasticsearch/script/DocBasedScript.java | 12 ------------ .../org/elasticsearch/script/NumberSortScript.java | 12 ------------ .../java/org/elasticsearch/script/ScoreScript.java | 12 ------------ .../org/elasticsearch/script/StringSortScript.java | 12 ------------ 7 files changed, 3 insertions(+), 66 deletions(-) diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.numbersort.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.numbersort.txt index 14c4597ef763b..c25c7729f0cfc 100644 --- a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.numbersort.txt +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.numbersort.txt @@ -8,13 +8,8 @@ # The whitelist for the fields api -# The scripts must be whitelisted for painless to find the classes +# The scripts must be whitelisted for painless to find the classes for the field API class org.elasticsearch.script.NumberSortScript @no_import { } class org.elasticsearch.script.NumberSortScript$Factory @no_import { } - -# Class bindings -static_import { - org.elasticsearch.script.Field field(org.elasticsearch.script.NumberSortScript, String) bound_to org.elasticsearch.script.NumberSortScript$FieldAccess -} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.score.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.score.txt index 96106385ea39d..928efbb0ca29f 100644 --- a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.score.txt +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.score.txt @@ -8,13 +8,8 @@ # The whitelist for the fields api -# The scripts must be whitelisted for painless to find the classes +# The scripts must be whitelisted for painless to find the classes for the field API class org.elasticsearch.script.ScoreScript @no_import { } class org.elasticsearch.script.ScoreScript$Factory @no_import { } - -# Class bindings -static_import { - org.elasticsearch.script.Field field(org.elasticsearch.script.ScoreScript, String) bound_to org.elasticsearch.script.ScoreScript$FieldAccess -} diff --git a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.stringsort.txt b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.stringsort.txt index 59bb1148e08d3..1e653e56bbc8a 100644 --- a/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.stringsort.txt +++ b/modules/lang-painless/src/main/resources/org/elasticsearch/painless/spi/org.elasticsearch.script.fields.stringsort.txt @@ -7,13 +7,8 @@ # # The whitelist for the fields api -# The scripts must be whitelisted for painless to find the classes +# The scripts must be whitelisted for painless to find the classes for the field API class org.elasticsearch.script.StringSortScript @no_import { } class org.elasticsearch.script.StringSortScript$Factory @no_import { } - -# Class bindings -static_import { - org.elasticsearch.script.Field field(org.elasticsearch.script.StringSortScript, String) bound_to org.elasticsearch.script.StringSortScript$FieldAccess -} diff --git a/server/src/main/java/org/elasticsearch/script/DocBasedScript.java b/server/src/main/java/org/elasticsearch/script/DocBasedScript.java index a9c1c4f26a815..9e08228cd7c70 100644 --- a/server/src/main/java/org/elasticsearch/script/DocBasedScript.java +++ b/server/src/main/java/org/elasticsearch/script/DocBasedScript.java @@ -60,16 +60,4 @@ public Map> getDoc() { } return docReader.doc(); } - - public static class FieldAccess { - private final DocBasedScript script; - - public FieldAccess(DocBasedScript script) { - this.script = script; - } - - public Field field(String fieldName) { - return script.field(fieldName); - } - } } diff --git a/server/src/main/java/org/elasticsearch/script/NumberSortScript.java b/server/src/main/java/org/elasticsearch/script/NumberSortScript.java index 39f2794372cb4..3fb085b61020c 100644 --- a/server/src/main/java/org/elasticsearch/script/NumberSortScript.java +++ b/server/src/main/java/org/elasticsearch/script/NumberSortScript.java @@ -49,16 +49,4 @@ public interface Factory extends ScriptFactory { // in LeafFactory.newInstance to set fallbacks. LeafFactory newFactory(Map params, SearchLookup searchLookup); } - - public static class FieldAccess { - private final NumberSortScript script; - - public FieldAccess(NumberSortScript script) { - this.script = script; - } - - public Field field(String fieldName) { - return script.field(fieldName); - } - } } diff --git a/server/src/main/java/org/elasticsearch/script/ScoreScript.java b/server/src/main/java/org/elasticsearch/script/ScoreScript.java index 40f39ab2107dd..9b800f6e98e8e 100644 --- a/server/src/main/java/org/elasticsearch/script/ScoreScript.java +++ b/server/src/main/java/org/elasticsearch/script/ScoreScript.java @@ -207,16 +207,4 @@ public interface Factory extends ScriptFactory { } public static final ScriptContext CONTEXT = new ScriptContext<>("score", ScoreScript.Factory.class); - - public static class FieldAccess { - private final ScoreScript script; - - public FieldAccess(ScoreScript script) { - this.script = script; - } - - public Field field(String fieldName) { - return script.field(fieldName); - } - } } diff --git a/server/src/main/java/org/elasticsearch/script/StringSortScript.java b/server/src/main/java/org/elasticsearch/script/StringSortScript.java index 97c7e96676bb2..729706617b925 100644 --- a/server/src/main/java/org/elasticsearch/script/StringSortScript.java +++ b/server/src/main/java/org/elasticsearch/script/StringSortScript.java @@ -35,16 +35,4 @@ public interface LeafFactory { public interface Factory extends ScriptFactory { LeafFactory newFactory(Map params); } - - public static class FieldAccess { - private final StringSortScript script; - - public FieldAccess(StringSortScript script) { - this.script = script; - } - - public Field field(String fieldName) { - return script.field(fieldName); - } - } }