Below is the pseudo code
public void testImportInContext() {
ParserContext ctx = new ParserContext();
ctx.addImport("List", List.class);
ctx.addImport("ArrayList", ArrayList.class);
MVEL.eval("List test = null;User u =null", ctx);
}
Exception occurred
- [Error: could not access: List; in class: org.mvel2.ParserContext]
- [Near : {... List test = null;User u =null ....}]
Because you can only use this functionality with the compiler. The eval() interpreter does not support static type analysis. The second parameter of eval is for an evaluation context object. Not a ParserContext.