public void testParameterizedTypeInStrictMode4() { ParserContext ctx = new ParserContext(); ctx.setStrongTyping(true); ctx.addInput("base", Base.class); ExpressionCompiler compiler = new ExpressionCompiler("base.list.get(1).toUpperCase()"); CompiledExpression ce = compiler.compile(ctx); assertEquals(String.class, ce.getKnownEgressType()); }
public final void testDetermineEgressParametricType2() { final ParserContext parserContext = new ParserContext(); parserContext.setStrongTyping(true); parserContext.addInput("strings", List.class, new Class[] {String.class}); final CompiledExpression expr = new ExpressionCompiler("strings", parserContext).compile(); assertTrue(STRINGS.equals(executeExpression(expr, new A()))); final Type[] typeParameters = expr.getParserContext().getLastTypeParameters(); assertTrue(null != typeParameters); assertTrue(String.class.equals(typeParameters[0])); }