Re: Lambda expression question on Tomcat_8_0_15
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. So I figured that we will always get back a LambdaExpression. 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\; } On Mon, Dec 15, 2014 at 4:20 PM, Mark Thomas ma...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Lambda expression question on Tomcat_8_0_15
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 ma...@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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Lambda expression question on Tomcat_8_0_15
Hi, I am new to learn the LambdaExpression , and I am trying to run a test with JDK7 on Tomcat_8_0_15 server protected void doGet... { ELProcessor elp = new ELProcessor(); sos.println(Test: + (LambdaExpression) elp.eval(()-64)); } But I always get this error java.lang.ClassCastException: java.lang.Long incompatible with javax.el.LambdaExpression I have also tried passing an empty array in the invoke() per the API Object[] empty_array = {}; sos.println(Test: + ((LambdaExpression) elp.eval(()-64)).invoke(empty_array)); Same Exception, java.lang.ClassCastException: java.lang.Long incompatible with javax.el.LambdaExpression Can someone help and tell me what I am doing wrong. Thanks,
Re: Lambda expression question on Tomcat_8_0_15
On 15/12/2014 20:19, 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 protected void doGet... { ELProcessor elp = new ELProcessor(); sos.println(Test: + (LambdaExpression) elp.eval(()-64)); } But I always get this error java.lang.ClassCastException: java.lang.Long incompatible with javax.el.LambdaExpression You are trying to cast the result of the LambaExpression which is a Long to LambdaExpression which isn't going to work. Just remove the cast. I have also tried passing an empty array in the invoke() per the API Object[] empty_array = {}; sos.println(Test: + ((LambdaExpression) elp.eval(()-64)).invoke(empty_array)); Same Exception, java.lang.ClassCastException: java.lang.Long incompatible with javax.el.LambdaExpression Can someone help and tell me what I am doing wrong. Same error as above. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Lambda expression question on Tomcat_8_0_15
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? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Lambda expression question on Tomcat_8_0_15
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-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org