From 7211017813e56f4314fba09fe765a94748696af6 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Sat, 14 May 2016 17:23:29 +0200 Subject: [PATCH] painless: Some cleanups --- .../java/org/elasticsearch/painless/WriterConstants.java | 5 +++-- .../java/org/elasticsearch/painless/node/LDefArray.java | 6 ++---- .../main/java/org/elasticsearch/painless/node/LDefCall.java | 2 +- .../java/org/elasticsearch/painless/node/LDefField.java | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/WriterConstants.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/WriterConstants.java index 98aee5b7d90..86111d8f1a5 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/WriterConstants.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/WriterConstants.java @@ -37,9 +37,10 @@ import java.util.Map; public final class WriterConstants { public final static String BASE_CLASS_NAME = Executable.class.getName(); - public final static String CLASS_NAME = BASE_CLASS_NAME + "$Script"; public final static Type BASE_CLASS_TYPE = Type.getType(Executable.class); - public final static Type CLASS_TYPE = Type.getType("L" + CLASS_NAME.replace(".", "/") + ";"); + + public final static String CLASS_NAME = BASE_CLASS_NAME + "$Script"; + public final static Type CLASS_TYPE = Type.getObjectType(CLASS_NAME.replace('.', '/')); public final static Method CONSTRUCTOR = getAsmMethod(void.class, "", String.class, String.class); public final static Method EXECUTE = diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java index 41eac59e4ff..38e8bf89cc9 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefArray.java @@ -61,15 +61,13 @@ final class LDefArray extends ALink { @Override void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { final String desc = Type.getMethodDescriptor(after.type, definition.defType.type, index.actual.type); - adapter.visitInvokeDynamicInsn( - "arrayLoad", desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.ARRAY_LOAD }); + adapter.visitInvokeDynamicInsn("arrayLoad", desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.ARRAY_LOAD); } @Override void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type, index.actual.type, definition.defType.type); - adapter.visitInvokeDynamicInsn( - "arrayStore", desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.ARRAY_STORE }); + adapter.visitInvokeDynamicInsn("arrayStore", desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.ARRAY_STORE); } } diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java index eef3c835e45..2bf53bcf89b 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefCall.java @@ -84,7 +84,7 @@ final class LDefCall extends ALink { // return value signature.append(after.type.getDescriptor()); - adapter.visitInvokeDynamicInsn(name, signature.toString(), DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.METHOD_CALL }); + adapter.visitInvokeDynamicInsn(name, signature.toString(), DEF_BOOTSTRAP_HANDLE, DefBootstrap.METHOD_CALL); } @Override diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java index cb1c37a7b01..68fb7ffb95a 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/node/LDefField.java @@ -57,12 +57,12 @@ final class LDefField extends ALink { @Override void load(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { final String desc = Type.getMethodDescriptor(after.type, definition.defType.type); - adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.LOAD }); + adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.LOAD); } @Override void store(final CompilerSettings settings, final Definition definition, final GeneratorAdapter adapter) { final String desc = Type.getMethodDescriptor(definition.voidType.type, definition.defType.type, definition.defType.type); - adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, new Object[] { DefBootstrap.STORE }); + adapter.visitInvokeDynamicInsn(value, desc, DEF_BOOTSTRAP_HANDLE, DefBootstrap.STORE); } }