org.codehaus.groovy.control.CompilationFailedException Java Examples
The following examples show how to use
org.codehaus.groovy.control.CompilationFailedException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroovyParser.java From warnings-ng-plugin with MIT License | 6 votes |
/** * Performs on-the-fly validation on the Groovy script. * * @param script * the script * * @return the validation result */ @RequirePOST public FormValidation doCheckScript(@QueryParameter(required = true) final String script) { if (isNotAllowedToRunScripts()) { return NO_RUN_SCRIPT_PERMISSION_WARNING; } try { if (StringUtils.isBlank(script)) { return FormValidation.error(Messages.GroovyParser_Error_Script_isEmpty()); } GroovyExpressionMatcher matcher = new GroovyExpressionMatcher(script); Script compiled = matcher.compile(); Ensure.that(compiled).isNotNull(); return FormValidation.ok(); } catch (CompilationFailedException exception) { return FormValidation.error( Messages.GroovyParser_Error_Script_invalid(exception.getLocalizedMessage())); } }
Example #2
Source File: ConditionAndActionPortalFactory.java From stendhal with GNU General Public License v2.0 | 6 votes |
/** * Extract the quest name from a context. * * @param ctx * The configuration context. * @return The quest name. * @throws IllegalArgumentException * If the quest attribute is missing. */ protected ChatCondition getCondition(final ConfigurableFactoryContext ctx) { String value = ctx.getString("condition", null); if (value == null) { return null; } Binding groovyBinding = new Binding(); final GroovyShell interp = new GroovyShell(groovyBinding); try { String code = "import games.stendhal.server.entity.npc.condition.*;\r\n" + value; return (ChatCondition) interp.evaluate(code); } catch (CompilationFailedException e) { throw new IllegalArgumentException(e); } }
Example #3
Source File: AccessCheckingPortalFactory.java From stendhal with GNU General Public License v2.0 | 6 votes |
/** * Creates a new ChatAction from ConfigurableFactoryContext. * * @param ctx * ConfigurableFactoryContext * @return * ChatAction instance */ protected ChatAction getRejectedAction(final ConfigurableFactoryContext ctx) { String value = ctx.getString("rejectedAction", null); if (value == null) { return null; } Binding groovyBinding = new Binding(); final GroovyShell interp = new GroovyShell(groovyBinding); try { String code = "import games.stendhal.server.entity.npc.action.*;\r\n" + value; return (ChatAction) interp.evaluate(code); } catch (CompilationFailedException e) { throw new IllegalArgumentException(e); } }
Example #4
Source File: GroovyClassLoader.java From groovy with Apache License 2.0 | 6 votes |
/** * (Re)Compiles the given source. * This method starts the compilation of a given source, if * the source has changed since the class was created. For * this isSourceNewer is called. * * @param source the source pointer for the compilation * @param className the name of the class to be generated * @param oldClass a possible former class * @return the old class if the source wasn't new enough, the new class else * @throws CompilationFailedException if the compilation failed * @throws IOException if the source is not readable * @see #isSourceNewer(URL, Class) */ protected Class recompile(URL source, String className, Class oldClass) throws CompilationFailedException, IOException { if (source != null) { // found a source, compile it if newer if (oldClass == null || isSourceNewer(source, oldClass)) { String name = source.toExternalForm(); sourceCache.remove(name); if (isFile(source)) { try { return parseClass(new GroovyCodeSource(new File(source.toURI()), sourceEncoding)); } catch (URISyntaxException e) { // do nothing and fall back to the other version } } return parseClass(new InputStreamReader(URLStreams.openUncachedStream(source), sourceEncoding), name); } } return oldClass; }
Example #5
Source File: ImputationPipelineTest.java From imputationserver with GNU Affero General Public License v3.0 | 6 votes |
public void testWithWrongReferencePanelUnphased() throws IOException, CompilationFailedException, ClassNotFoundException { String template = "--refHaps ${ref} --haps ${vcf} --start ${start} --end ${end} --window ${window} --prefix ${prefix} --chr ${chr} --noPhoneHome --format GT,DS,GP --allTypedSites --meta --minRatio 0.00001 ${unphased ? '--unphasedOutput' : ''} ${mapMinimac != null ? '--referenceEstimates --map ' + mapMinimac : ''}"; Map<String, Object> binding = new HashMap<String, Object>(); binding.put("ref", "ref.txt"); binding.put("vcf", "vcf.txt"); binding.put("start", 55); binding.put("end", 100); binding.put("window", 22); binding.put("prefix", "output-prefix"); binding.put("chr", 22); binding.put("unphased", false); binding.put("mapMinimac", null); SimpleTemplateEngine engine = new SimpleTemplateEngine(); String outputTemplate = engine.createTemplate(template).make(binding).toString(); assertEquals( "--refHaps ref.txt --haps vcf.txt --start 55 --end 100 --window 22 --prefix output-prefix --chr 22 --noPhoneHome --format GT,DS,GP --allTypedSites --meta --minRatio 0.00001 ", outputTemplate); }
Example #6
Source File: GradleModellingLanguageTransformer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void call(SourceUnit source) throws CompilationFailedException { ModelRegistryDslHelperStatementGenerator statementGenerator = new ModelRegistryDslHelperStatementGenerator(); BlockStatement rootStatementBlock = source.getAST().getStatementBlock(); ListIterator<Statement> statementsIterator = rootStatementBlock.getStatements().listIterator(); while (statementsIterator.hasNext()) { Statement statement = statementsIterator.next(); ScriptBlock scriptBlock = AstUtils.detectScriptBlock(statement, SCRIPT_BLOCK_NAMES); if (scriptBlock != null) { statementsIterator.remove(); ScopeVisitor scopeVisitor = new ScopeVisitor(source, statementGenerator); scriptBlock.getClosureExpression().getCode().visit(scopeVisitor); } } rootStatementBlock.addStatements(statementGenerator.getGeneratedStatements()); }
Example #7
Source File: ImputationPipelineTest.java From imputationserver with GNU Affero General Public License v3.0 | 6 votes |
public void testWithWrongReferencePanel() throws IOException, CompilationFailedException, ClassNotFoundException { String template = "--refHaps ${ref} --haps ${vcf} --start ${start} --end ${end} --window ${window} --prefix ${prefix} --chr ${chr} --noPhoneHome --format GT,DS,GP --allTypedSites --meta --minRatio 0.00001 ${unphased ? '--unphasedOutput' : ''} ${mapMinimac != null ? '--referenceEstimates --map ' + mapMinimac : ''}"; Map<String, Object> binding = new HashMap<String, Object>(); binding.put("ref", "ref.txt"); binding.put("vcf", "vcf.txt"); binding.put("start", 55); binding.put("end", 100); binding.put("window", 22); binding.put("prefix", "output-prefix"); binding.put("chr", 22); binding.put("unphased", true); binding.put("mapMinimac", null); SimpleTemplateEngine engine = new SimpleTemplateEngine(); String outputTemplate = engine.createTemplate(template).make(binding).toString(); assertEquals( "--refHaps ref.txt --haps vcf.txt --start 55 --end 100 --window 22 --prefix output-prefix --chr 22 --noPhoneHome --format GT,DS,GP --allTypedSites --meta --minRatio 0.00001 --unphasedOutput ", outputTemplate); }
Example #8
Source File: StatementLabelsScriptTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void call(final SourceUnit source) throws CompilationFailedException { // currently we only look in script code; could extend this to build script classes AstUtils.visitScriptCode(source, new ClassCodeVisitorSupport() { @Override protected SourceUnit getSourceUnit() { return source; } @Override protected void visitStatement(Statement statement) { if (statement.getStatementLabel() != null) { String message = String.format("Statement labels may not be used in build scripts.%nIn case you tried to configure a property named '%s', replace ':' with '=' or ' ', otherwise it will not have the desired effect.", statement.getStatementLabel()); addError(message, statement); } } }); }
Example #9
Source File: StatementLabelsScriptTransformer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void call(final SourceUnit source) throws CompilationFailedException { // currently we only look in script code; could extend this to build script classes AstUtils.visitScriptCode(source, new ClassCodeVisitorSupport() { @Override protected SourceUnit getSourceUnit() { return source; } @Override protected void visitStatement(Statement statement) { if (statement.getStatementLabel() != null) { String message = String.format("Statement labels may not be used in build scripts.%nIn case you tried to configure a property named '%s', replace ':' with '=' or ' ', otherwise it will not have the desired effect.", statement.getStatementLabel()); addError(message, statement); } } }); }
Example #10
Source File: TemplateTest.java From groovy with Apache License 2.0 | 5 votes |
public void testMixedTemplateText() throws CompilationFailedException, ClassNotFoundException, IOException { Template template1 = new SimpleTemplateEngine().createTemplate("<%= \"test\" %> of expr and <% test = 1 %>${test} script."); assertEquals("test of expr and 1 script.", template1.make().toString()); Template template2 = new GStringTemplateEngine().createTemplate("<%= \"test\" %> of expr and <% test = 1 %>${test} script."); assertEquals("test of expr and 1 script.", template2.make().toString()); }
Example #11
Source File: BlockTargetFactory.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Create a ChatAction * * @param action the configuration String * @return the action or null * @throws CompilationFailedException */ private ChatAction createAction(String action) throws CompilationFailedException { final GroovyShell interp = createGroovyShell(); String code = "import games.stendhal.server.entity.npc.action.*;\r\n" + action; ChatAction created = (ChatAction) interp.evaluate(code); return created; }
Example #12
Source File: PuzzleEventDispatcher.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * parses a Groovy expression * * @param buildingBlock BuildingBlock on which the expression is defined * @param expression expression to parse * @return Groovy script */ public Script parseExpression(PuzzleBuildingBlock buildingBlock, String expression) { try { Script script = shell.parse(expression); script.setProperty("buildingBlock", buildingBlock); return script; } catch (CompilationFailedException e) { throw new IllegalArgumentException(e); } }
Example #13
Source File: ContentWorker.java From scipio-erp with Apache License 2.0 | 5 votes |
/** Returns a boolean, result of whenStr evaluation with context. * If whenStr is empty return defaultReturn. * @param context A <code>Map</code> containing initial variables * @param whenStr A <code>String</code> condition expression * @param defaultReturn A <code>boolean</code> default return value * @return A <code>boolan</code> result of evaluation */ public static boolean checkWhen(Map<String, Object> context, String whenStr, boolean defaultReturn) { boolean isWhen = defaultReturn; if (UtilValidate.isNotEmpty(whenStr)) { FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr); String newWhen = fse.expandString(context); try { // SCIPIO: 2018-09-19: use Groovy // FIXME?: NO SCRIPT CACHING: It is not currently possible to cache this condition script safely, // because the method and transforms calling it are public so it is unknown who will call this from where, // so we could be receiving parametrized input and exploding the cache. //final boolean useCache = fse.isConstant(); final boolean useCache = false; Object retVal = GroovyUtil.evalConditionExpr(newWhen, context, useCache); // retVal should be a Boolean, if not something weird is up... if (retVal instanceof Boolean) { Boolean boolVal = (Boolean) retVal; isWhen = boolVal; } else { throw new IllegalArgumentException("Return value from use-when condition eval was not a Boolean: " + (retVal != null ? retVal.getClass().getName() : "null") + " [" + retVal + "]"); } } catch (CompilationFailedException e) { Debug.logError("Error in evaluating :" + whenStr + " : " + e.getMessage(), module); throw new RuntimeException(e.getMessage()); } } return isWhen; }
Example #14
Source File: FixMainScriptTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void call(SourceUnit source) throws CompilationFailedException { ClassNode scriptClass = AstUtils.getScriptClass(source); if (scriptClass == null) { return; } for (MethodNode methodNode : scriptClass.getMethods()) { if (methodNode.getName().equals("main")) { AstUtils.removeMethod(scriptClass, methodNode); break; } } }
Example #15
Source File: GroovyShell.java From groovy with Apache License 2.0 | 5 votes |
/** * Evaluates some script against the current Binding and returns the result * * @param in the stream reading the script * @param fileName is the logical file name of the script (which is used to create the class name of the script) */ public Object evaluate(Reader in, String fileName) throws CompilationFailedException { Script script = null; try { script = parse(in, fileName); return script.run(); } finally { if (script != null) { InvokerHelper.removeClass(script.getClass()); } } }
Example #16
Source File: HerdDBCLI.java From herddb with Apache License 2.0 | 5 votes |
private static void executeScript(final Connection connection, final HerdDBDataSource datasource, final Statement statement, String script) throws IOException, CompilationFailedException { Map<String, Object> variables = new HashMap<>(); variables.put("connection", connection); variables.put("datasource", datasource); variables.put("statement", statement); GroovyShell shell = new GroovyShell(new Binding(variables)); shell.evaluate(new File(script)); }
Example #17
Source File: GroovyRule.java From tddl with Apache License 2.0 | 5 votes |
private void initGroovy() { if (expression == null) { throw new IllegalArgumentException("未指定 expression"); } GroovyClassLoader loader = new GroovyClassLoader(GroovyRule.class.getClassLoader()); String groovyRule = getGroovyRule(expression, extraPackagesStr); Class<?> c_groovy; try { c_groovy = loader.parseClass(groovyRule); } catch (CompilationFailedException e) { throw new IllegalArgumentException(groovyRule, e); } try { // 新建类实例 Object ruleObj = c_groovy.newInstance(); if (ruleObj instanceof ShardingFunction) { shardingFunction = (ShardingFunction) ruleObj; } else { throw new IllegalArgumentException("should not be here"); } // 获取方法 } catch (Throwable t) { throw new IllegalArgumentException("实例化规则对象失败", t); } }
Example #18
Source File: StatementLabelsScriptTransformer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void call(final SourceUnit source) throws CompilationFailedException { final List<Statement> logStats = Lists.newArrayList(); // currently we only look in script code; could extend this to build script classes AstUtils.visitScriptCode(source, new ClassCodeVisitorSupport() { @Override protected SourceUnit getSourceUnit() { return source; } @Override protected void visitStatement(Statement statement) { if (statement.getStatementLabel() != null) { // Because we aren't failing the build, the script will be cached and this transformer won't run the next time. // In order to make the deprecation warning stick, we have to weave the call to StatementLabelsDeprecationLogger // into the build script. String label = statement.getStatementLabel(); String sample = source.getSample(statement.getLineNumber(), statement.getColumnNumber(), null); Expression logExpr = new StaticMethodCallExpression(ClassHelper.makeWithoutCaching(StatementLabelsDeprecationLogger.class), "log", new ArgumentListExpression(new ConstantExpression(label), new ConstantExpression(sample))); logStats.add(new ExpressionStatement(logExpr)); } } }); source.getAST().getStatementBlock().addStatements(logStats); }
Example #19
Source File: ModelBlockTransformer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void call(SourceUnit source) throws CompilationFailedException { if (!isEnabled()) { return; } List<Statement> statements = source.getAST().getStatementBlock().getStatements(); for (Statement statement : statements) { ScriptBlock scriptBlock = AstUtils.detectScriptBlock(statement, SCRIPT_BLOCK_NAMES); if (scriptBlock == null) { // Look for model(«») (i.e. call to model with anything other than non literal closure) MethodCallExpression methodCall = AstUtils.extractBareMethodCall(statement); if (methodCall == null) { continue; } String methodName = AstUtils.extractConstantMethodName(methodCall); if (methodName == null) { continue; } if (methodName.equals(MODEL)) { source.getErrorCollector().addError( new SyntaxException(NON_LITERAL_CLOSURE_TO_TOP_LEVEL_MODEL_MESSAGE, statement.getLineNumber(), statement.getColumnNumber()), source ); } } else { RuleVisitor ruleVisitor = new RuleVisitor(source); RulesVisitor rulesVisitor = new RulesVisitor(source, ruleVisitor); scriptBlock.getClosureExpression().getCode().visit(rulesVisitor); } } }
Example #20
Source File: TemplateTest.java From groovy with Apache License 2.0 | 5 votes |
public void testBinding() throws CompilationFailedException, ClassNotFoundException, IOException { Map binding = new HashMap(); binding.put("sam", "pullara"); Template template1 = new SimpleTemplateEngine().createTemplate("<%= sam %><% print sam %>"); assertEquals("pullarapullara", template1.make(binding).toString()); Template template2 = new GStringTemplateEngine().createTemplate("<%= sam %><% out << sam %>"); assertEquals("pullarapullara", template2.make(binding).toString()); Template template3 = new GStringTemplateEngine().createTemplate("<%= sam + \" \" + sam %><% out << sam %>"); assertEquals("pullara pullarapullara", template3.make(binding).toString()); }
Example #21
Source File: ModelForm.java From scipio-erp with Apache License 2.0 | 5 votes |
/** * iterate through alt-row-styles list to see if should be used, then add style * @return The style for item row */ public String getStyleAltRowStyle(Map<String, Object> context) { String styles = ""; try { for (AltRowStyle altRowStyle : this.altRowStyles) { String useWhen = altRowStyle.useWhen.expandString(context); // SCIPIO: added FlexibleStringExpander support // SCIPIO: 2018-09-19: Now using Groovy as second interpreter // IMPORTANT: Only enable cache if the flexible expression was a constant, otherwise the cache could blow up! final boolean useCache = altRowStyle.useWhen.isConstant(); Object retVal = GroovyUtil.evalConditionExpr(useWhen, context, useCache); // retVal should be a Boolean, if not something weird is up... if (retVal instanceof Boolean) { // SCIPIO: Slight refactor here if ((Boolean) retVal) { styles += altRowStyle.style; } } else { throw new IllegalArgumentException("Return value from style condition eval was not a Boolean: " + retVal.getClass().getName() + " [" + retVal + "] of form " + getName()); } } } catch (CompilationFailedException e) { String errmsg = "Error evaluating groovy style conditions on form " + getName(); Debug.logError(e, errmsg, module); throw new IllegalArgumentException(errmsg); } return styles; }
Example #22
Source File: ModelForm.java From scipio-erp with Apache License 2.0 | 5 votes |
/** iterate through altTargets list to see if any should be used, if not return original target * @return The target for this Form */ public String getTarget(Map<String, Object> context, String targetType) { Map<String, Object> expanderContext = UtilCodec.EncodingMapWrapper.getEncodingMapWrapper(context, WidgetWorker.getEarlyEncoder(context)); // SCIPIO: simplified try { for (AltTarget altTarget : this.altTargets) { String useWhen = altTarget.useWhen.expandString(context); // SCIPIO: changed for useWhen as FlexibleStringExpander // SCIPIO: 2018-09-19: Now using Groovy as second interpreter // IMPORTANT: Only enable cache if the flexible expression was a constant, otherwise the cache could blow up! final boolean useCache = altTarget.useWhen.isConstant(); Object retVal = GroovyUtil.evalConditionExpr(useWhen, context, useCache); // retVal should be a Boolean, if not something weird is up... if (retVal instanceof Boolean) { // SCIPIO: Slight refactor here if (((boolean) retVal) && !"inter-app".equals(targetType)) { return altTarget.targetExdr.expandString(expanderContext); } } else { throw new IllegalArgumentException("Return value from target condition eval was not a Boolean: " + retVal.getClass().getName() + " [" + retVal + "] of form " + getName()); } } } catch (CompilationFailedException e) { String errmsg = "Error evaluating groovy target conditions on form " + getName(); Debug.logError(e, errmsg, module); throw new IllegalArgumentException(errmsg); } return target.expandString(expanderContext); }
Example #23
Source File: GroovyScriptEngine.java From james with Apache License 2.0 | 5 votes |
private InformationPointHandler createOrGetCachedHandler(InformationPoint informationPoint) throws CompilationFailedException { InformationPointHandler handlerFromCache = handlersCache.computeIfAbsent(informationPoint.getScript().get(), scriptTextKey -> { InformationPointHandler handler = (InformationPointHandler) getOrCreateShell(informationPoint.getBaseScript()).parse(scriptTextKey); handler.setEventPublisher(publisher); handler.setToolkitManager(toolkitManager); return handler; }); handlerFromCache.setMetadata(informationPoint.getMetadata()); return handlerFromCache; }
Example #24
Source File: BlockTargetZoneConfigurator.java From stendhal with GNU General Public License v2.0 | 5 votes |
/** * Create a ChatAction * * @param action the configuration String * @return the action or null * @throws CompilationFailedException */ private ChatAction createAction(String action) throws CompilationFailedException { final GroovyShell interp = createGroovyShell(); String code = "import games.stendhal.server.entity.npc.action.*;\r\n" + action; ChatAction created = (ChatAction) interp.evaluate(code); return created; }
Example #25
Source File: AllTestSuite.java From groovy with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected void loadTest(String filename) throws CompilationFailedException, IOException { Class type = compile(filename); if (TestCase.class.isAssignableFrom(type)) { addTestSuite((Class<? extends TestCase>)type); } else if (Script.class.isAssignableFrom(type)) { addTest(new ScriptTestAdapter(type, EMPTY_ARGS)); } else { throw new RuntimeException("Don't know how to treat " + filename + " as a JUnit test"); } }
Example #26
Source File: ConditionAndActionAreaFactory.java From stendhal with GNU General Public License v2.0 | 5 votes |
protected ChatAction getAction(final ConfigurableFactoryContext ctx) { String value = ctx.getString("action", null); if (value == null) { return null; } Binding groovyBinding = new Binding(); final GroovyShell interp = new GroovyShell(groovyBinding); try { String code = "import games.stendhal.server.entity.npc.action.*;\r\n" + value; return (ChatAction) interp.evaluate(code); } catch (CompilationFailedException e) { throw new IllegalArgumentException(e); } }
Example #27
Source File: ImputationPipeline.java From imputationserver with GNU Affero General Public License v3.0 | 5 votes |
public boolean imputeVCF(VcfChunkOutput output) throws InterruptedException, IOException, CompilationFailedException { String chr = ""; if (build.equals("hg38")) { chr = "chr" + output.getChromosome(); } else { chr = output.getChromosome(); } // set parameters Map<String, Object> binding = new HashMap<String, Object>(); binding.put("ref", refFilename); binding.put("vcf", output.getPhasedVcfFilename()); binding.put("start", output.getStart()); binding.put("end", output.getEnd()); binding.put("window", minimacWindow); binding.put("prefix", output.getPrefix()); binding.put("chr", chr); binding.put("unphased", false); binding.put("mapMinimac", mapMinimac); String[] params = createParams(minimacParams, binding); // minimac command Command minimac = new Command(minimacCommand); minimac.setSilent(false); minimac.setParams(params); minimac.saveStdOut(output.getPrefix() + ".minimac.out"); minimac.saveStdErr(output.getPrefix() + ".minimac.err"); System.out.println(minimac.getExecutedCommand()); return (minimac.execute() == 0); }
Example #28
Source File: SourceAwareCustomizer.java From groovy with Apache License 2.0 | 5 votes |
@Override public void call(final SourceUnit source, final GeneratorContext context, final ClassNode classNode) throws CompilationFailedException { String fileName = source.getName(); ReaderSource reader = source.getSource(); if (reader instanceof FileReaderSource) { FileReaderSource file = (FileReaderSource) reader; fileName = file.getFile().getName(); } if (acceptSource(source) && acceptClass(classNode) && accept(fileName)) { delegate.call(source, context, classNode); } }
Example #29
Source File: DigAreaFactory.java From stendhal with GNU General Public License v2.0 | 5 votes |
protected ChatAction getAction(final ConfigurableFactoryContext ctx) { String value = ctx.getString("action", null); if (value == null) { return null; } Binding groovyBinding = new Binding(); final GroovyShell interp = new GroovyShell(groovyBinding); try { String code = "import games.stendhal.server.entity.npc.action.*;\r\n" + value; return (ChatAction) interp.evaluate(code); } catch (CompilationFailedException e) { throw new IllegalArgumentException(e); } }
Example #30
Source File: GroovyScriptEngineImpl.java From hasor with Apache License 2.0 | 5 votes |
Class getScriptClass(String script) throws SyntaxException, CompilationFailedException, IOException { Class clazz = classMap.get(script); if (clazz != null) { return clazz; } clazz = loader.parseClass(script, generateScriptName()); classMap.put(script, clazz); return clazz; }