Details
Description
The following expression does not compile when strict mode is enabled :
for(int i=0;i<2;i++) { System.out.println(i+""); } return true;
I get the following error :
[Error: Failed to compile: 1 compilation error(s): - (1,1) unqualified type in strict mode for: i] [Near : {... Unknown ....}] ^ [Line: 1, Column: 0] return true;
Example :
ParserContext ctx = new ParserContext(); ctx.setStrongTyping(true); ctx.setStrictTypeEnforcement(true); String script = "for(int i=0;i<2;i++) { " + " System.out.println(i+\"\");" + "} " + " return true;"; try { CompiledExpression compiled = (CompiledExpression)MVEL.compileExpression(script, ctx); HashMap<String, Object> map = new HashMap<String, Object>(); new MVELScript(compiled).execute(map); } catch(Exception e) { e.printStackTrace(); }
fixed in latest commit.