From 7bc91c00d9329268ac5bb612f442d74fcf04ae73 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Fri, 20 May 2016 14:12:15 +0200 Subject: [PATCH] More elegant way to force class initialization --- .../java/org/elasticsearch/painless/PainlessPlugin.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java index de774344ee2..7533707cf63 100644 --- a/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java +++ b/modules/lang-painless/src/main/java/org/elasticsearch/painless/PainlessPlugin.java @@ -30,14 +30,9 @@ import org.elasticsearch.script.ScriptModule; */ public final class PainlessPlugin extends Plugin { - // parse our definition at startup (not on the user's first script) - // compilation process is sandboxed and has no file access. + // force to pare our definition at startup (not on the user's first script) static { - try { - Class.forName("org.elasticsearch.painless.Definition"); - } catch (ClassNotFoundException e) { - throw new RuntimeException(e); - } + Definition.voidType.hashCode(); } @Override