use of org.mvel2.integration.impl.StaticMethodImportResolverFactory in project mvel by mvel.
the class TypesAndInferenceTests method testStrictTypingCompilation2.
public void testStrictTypingCompilation2() throws Exception {
ParserContext ctx = new ParserContext();
// noinspection RedundantArrayCreation
ctx.addImport("getRuntime", new MethodStub(Runtime.class.getMethod("getRuntime", new Class[] {})));
ctx.setStrictTypeEnforcement(true);
ExpressionCompiler compiler = new ExpressionCompiler("getRuntime()", ctx);
StaticMethodImportResolverFactory si = new StaticMethodImportResolverFactory(ctx);
Serializable expression = compiler.compile();
serializationTest(expression);
assertTrue(executeExpression(expression, si) instanceof Runtime);
}
use of org.mvel2.integration.impl.StaticMethodImportResolverFactory in project mvel by mikebrock.
the class TypesAndInferenceTests method testStrictTypingCompilation2.
public void testStrictTypingCompilation2() throws Exception {
ParserContext ctx = new ParserContext();
// noinspection RedundantArrayCreation
ctx.addImport("getRuntime", new MethodStub(Runtime.class.getMethod("getRuntime", new Class[] {})));
ctx.setStrictTypeEnforcement(true);
ExpressionCompiler compiler = new ExpressionCompiler("getRuntime()");
StaticMethodImportResolverFactory si = new StaticMethodImportResolverFactory(ctx);
Serializable expression = compiler.compile(ctx);
serializationTest(expression);
assertTrue(executeExpression(expression, si) instanceof Runtime);
}
Aggregations