tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: Lambda expression question on Tomcat_8_0_15
Date Tue, 16 Dec 2014 16:41:28 GMT
On 16/12/2014 16:32, Anup Aggarwal wrote:
> Thanks for the response ,
> 
> So the value itself is returned and not an ELExpression, The API said
> A LambdaExpression is created when an EL expression containing a Lambda
> expression is evaluated.

The Javadoc for ELProcessor.eval() says nothing of the sort.

> So I figured that we will always get back a LambdaExpression.

If you want to know what ELProcessor.eval() returns, read the Javadoc
for that method.

> Now I am trying to print some values in the same case, and keep on getting
> Null , any ideas what is wrong here,
> 
> protected void doGet... {
>              ELProcessor elp = new ELProcessor();
>             sos.println("Test: " + (LambdaExpression)
> (elp.eval("()->System.out.println(\"Hello World\")")));
> }

Are you paying any attention to the advice you are being given? You CAN
NOT cast the result of ELProcessor.eval() to LambdaExpression. You are
getting away with it because the expression you are evaluating is
returning null.

In terms of seeing Null in the ServletOutputStream that looks to be
entirely expected since the expression is calling a method that returns
void.

Mark


> On Mon, Dec 15, 2014 at 4:20 PM, Mark Thomas <markt@apache.org> wrote:
>>
>> On 15/12/2014 21:13, David Wall wrote:
>>> On 12/15/2014 12:19 PM, Anup Aggarwal wrote:
>>>> Hi,
>>>>
>>>> I am new to learn the LambdaExpression , and I am trying to run a test
>>>> with
>>>> JDK7 on Tomcat_8_0_15 server
>>>
>>> Don't you need JDK8 for Lamdas?
>>
>> Not in this case, no. The EL 3.0 specification includes a form of lambda
>> support and requires Java 7 or later.
>>
>> Mark
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message