From a780ec14f05ed7affe606f211c44be4bb1ae7004 Mon Sep 17 00:00:00 2001 From: Jack Conradson Date: Wed, 20 Nov 2019 07:07:33 -0800 Subject: [PATCH] Painless: Upgrade ASM to 7.2 (#49263) This upgrades Painless to use the latest ASM libraries providing support up to Java 14. Note the library is not published with the latest versions in an "all" package, so we pick up each lib independently that's required. There were some changes to the getType method that require descriptors to be used in place of internal class names. --- modules/lang-painless/build.gradle | 6 +++++- modules/lang-painless/licenses/asm-7.2.jar.sha1 | 1 + modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1 | 1 + modules/lang-painless/licenses/asm-commons-7.2.jar.sha1 | 1 + modules/lang-painless/licenses/asm-debug-all-5.1.jar.sha1 | 1 - modules/lang-painless/licenses/asm-tree-7.2.jar.sha1 | 1 + modules/lang-painless/licenses/asm-util-7.2.jar.sha1 | 1 + .../org/elasticsearch/painless/PainlessScriptEngine.java | 6 +++--- 8 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 modules/lang-painless/licenses/asm-7.2.jar.sha1 create mode 100644 modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1 create mode 100644 modules/lang-painless/licenses/asm-commons-7.2.jar.sha1 delete mode 100644 modules/lang-painless/licenses/asm-debug-all-5.1.jar.sha1 create mode 100644 modules/lang-painless/licenses/asm-tree-7.2.jar.sha1 create mode 100644 modules/lang-painless/licenses/asm-util-7.2.jar.sha1 diff --git a/modules/lang-painless/build.gradle b/modules/lang-painless/build.gradle index b7103c71453..75e41dcf2e2 100644 --- a/modules/lang-painless/build.gradle +++ b/modules/lang-painless/build.gradle @@ -32,7 +32,11 @@ testClusters.integTest { dependencies { compile 'org.antlr:antlr4-runtime:4.5.3' - compile 'org.ow2.asm:asm-debug-all:5.1' + compile 'org.ow2.asm:asm-util:7.2' + compile 'org.ow2.asm:asm-tree:7.2' + compile 'org.ow2.asm:asm-commons:7.2' + compile 'org.ow2.asm:asm-analysis:7.2' + compile 'org.ow2.asm:asm:7.2' compile project('spi') } diff --git a/modules/lang-painless/licenses/asm-7.2.jar.sha1 b/modules/lang-painless/licenses/asm-7.2.jar.sha1 new file mode 100644 index 00000000000..acb97fc1a02 --- /dev/null +++ b/modules/lang-painless/licenses/asm-7.2.jar.sha1 @@ -0,0 +1 @@ +fa637eb67eb7628c915d73762b681ae7ff0b9731 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1 b/modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1 new file mode 100644 index 00000000000..849b5e0bfa6 --- /dev/null +++ b/modules/lang-painless/licenses/asm-analysis-7.2.jar.sha1 @@ -0,0 +1 @@ +b6e6abe057f23630113f4167c34bda7086691258 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-commons-7.2.jar.sha1 b/modules/lang-painless/licenses/asm-commons-7.2.jar.sha1 new file mode 100644 index 00000000000..b634981fc89 --- /dev/null +++ b/modules/lang-painless/licenses/asm-commons-7.2.jar.sha1 @@ -0,0 +1 @@ +ca2954e8d92a05bacc28ff465b25c70e0f512497 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-debug-all-5.1.jar.sha1 b/modules/lang-painless/licenses/asm-debug-all-5.1.jar.sha1 deleted file mode 100644 index 926910cbc68..00000000000 --- a/modules/lang-painless/licenses/asm-debug-all-5.1.jar.sha1 +++ /dev/null @@ -1 +0,0 @@ -dde860d586960d55a87cd52c4fc1f5059c89cbc6 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-tree-7.2.jar.sha1 b/modules/lang-painless/licenses/asm-tree-7.2.jar.sha1 new file mode 100644 index 00000000000..986a1c55f5e --- /dev/null +++ b/modules/lang-painless/licenses/asm-tree-7.2.jar.sha1 @@ -0,0 +1 @@ +3a23cc36edaf8fc5a89cb100182758ccb5991487 \ No newline at end of file diff --git a/modules/lang-painless/licenses/asm-util-7.2.jar.sha1 b/modules/lang-painless/licenses/asm-util-7.2.jar.sha1 new file mode 100644 index 00000000000..6f70a0eea65 --- /dev/null +++ b/modules/lang-painless/licenses/asm-util-7.2.jar.sha1 @@ -0,0 +1 @@ +a3ae34e57fa8a4040e28247291d0cc3d6b8c7bcf \ No newline at end of file diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngine.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngine.java index ce3f1936f26..871e4371630 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngine.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessScriptEngine.java @@ -196,7 +196,7 @@ public final class PainlessScriptEngine implements ScriptEngine { for (int count = 0; count < newFactory.getParameterTypes().length; ++count) { constructor.loadThis(); constructor.loadArg(count); - constructor.putField(Type.getType(className), "$arg" + count, Type.getType(newFactory.getParameterTypes()[count])); + constructor.putField(Type.getType("L" + className + ";"), "$arg" + count, Type.getType(newFactory.getParameterTypes()[count])); } constructor.returnValue(); @@ -230,7 +230,7 @@ public final class PainlessScriptEngine implements ScriptEngine { for (int count = 0; count < newFactory.getParameterTypes().length; ++count) { adapter.loadThis(); - adapter.getField(Type.getType(className), "$arg" + count, Type.getType(newFactory.getParameterTypes()[count])); + adapter.getField(Type.getType("L" + className + ";"), "$arg" + count, Type.getType(newFactory.getParameterTypes()[count])); } adapter.loadArgs(); @@ -243,7 +243,7 @@ public final class PainlessScriptEngine implements ScriptEngine { loader.defineFactory(className.replace('/', '.'), writer.toByteArray()); - return Type.getType(className); + return Type.getType("L" + className + ";"); } /**