LUCENE-5207: Remove classloader field (is not needed, we call only once)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1522967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-09-13 15:10:23 +00:00
parent 9617a1ddaa
commit 01b002b510
1 changed files with 2 additions and 3 deletions

View File

@ -136,8 +136,6 @@ public class JavascriptCompiler {
private static final int MAX_SOURCE_LENGTH = 16384;
private final Loader loader = new Loader(getClass().getClassLoader());
private ClassWriter classWriter;
private MethodVisitor methodVisitor;
private Map<String, Integer> externalsMap;
@ -192,7 +190,8 @@ public class JavascriptCompiler {
recursiveCompile(antlrTree, ComputedType.DOUBLE);
endCompile();
Class<? extends Expression> evaluatorClass = loader.define(COMPILED_EXPRESSION_CLASS, classWriter.toByteArray());
Class<? extends Expression> evaluatorClass = new Loader(getClass().getClassLoader())
.define(COMPILED_EXPRESSION_CLASS, classWriter.toByteArray());
Constructor<? extends Expression> constructor = evaluatorClass.getConstructor(String.class, String[].class);
return constructor.newInstance(sourceText, externalsList.toArray(new String[externalsList.size()]));
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException exception) {