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(); }
Activity
Mike Brock
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | In Progress [ 3 ] |
Mike Brock
made changes -
| Status | In Progress [ 3 ] | Resolved [ 5 ] |
| Fix Version/s | 2.0.18 [ 16328 ] | |
| Resolution | Fixed [ 1 ] |
Mike Brock
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |