Created attachment 992740 [details] reproducer web app Description of problem: Accessing JSP with JDK8 specific code (namely lambda expressions) fails due compilation error Version-Release number of selected component (if applicable): EAP 6.4.0 How reproducible: always Steps to Reproduce: 1. Deploy web app with jsp containing lambda expressions (you can use attached app) 2. Visit the jsp from URL (http://localhost:8080/lambda-expression-test/jsp-with-lambdas.jsp) Actual results: JSP failed to compile, see [1] Expected results: JSP was compiled and properly evaluated Additional info: I have tried changing source-vm and target-vm in /subsystem=web/configuration=jsp-configuration to 1.8 and it didn't help, by looking to code (org.apache.jasper.compiler.JDTCompiler) it seems that only version till 1.7 can be set. [1] org.apache.jasper.JasperException: JBWEB004062: Unable to compile class for JSP: JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp n cannot be resolved to a variable 7: // System.out.println(answerToEverything); 8: 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp Syntax error on token "-", -- expected 7: // System.out.println(answerToEverything); 8: 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: JBWEB004060: An error occurred at line: 10 in the jsp file: /jsp-with-lambdas.jsp n cannot be resolved to a variable 7: // System.out.println(answerToEverything); 8: 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp n cannot be resolved to a variable 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: 14: %> 15: </body> JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp Syntax error on token "-", -- expected 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: 14: %> 15: </body> JBWEB004060: An error occurred at line: 12 in the jsp file: /jsp-with-lambdas.jsp n cannot be resolved to a variable 9: List<Integer> list = Arrays.asList(1, 2, 3); 10: Arrays.asList(1).forEach(n-> System.out.println(n)); 11: 12: list.forEach(n -> response.getWriter().write("<p>" + n + "</p>")); 13: 14: %> 15: </body> JBWEB004211: Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:69) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:461) org.apache.jasper.compiler.Compiler.compile(Compiler.java:361) org.apache.jasper.compiler.Compiler.compile(Compiler.java:339) org.apache.jasper.compiler.Compiler.compile(Compiler.java:326) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:606) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:309) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:242) javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
It would also need JDT 4.4. I see no actual user benefit, so dev- for 6.4.0.
@Remy, how can we NAK something like this while saying we support Java 8?
This is not about running on Java 8, it is about putting some Java 8 code in webapps sources. But anyway, if it is a blocker, someone needs to set the blocker flag.
Tomaz Cerar <tomaz.cerar> updated the status of jira WFLY-4362 to Coding In Progress
The primary reason our customers will want to move to Java 8 is because Oracle Java 7 goes EOL in April 2015, not because they re-wrote their applications to use lambda expressions. So IMO this can be release noted and solved in a CP.
For upstream fix is two part. 1) fix the jastow (jasper fork for undertow) to allow source & target to be 1.8 PR for that: https://github.com/undertow-io/jastow/pull/15 2) update ecj to 4.4.1 in wildfly PR for wildfly is pending jastow release.
Very well then, changing the dev flag.
Created attachment 993682 [details] new reproducer web app In the previous example war there wasn't caught IOException causing that it would fail even after JDK 1.8 compilation fix. Updating the example with correct web app.
I removed the blocker flag. If we can get this into ER3 then let's do that. If we cannot get it in that build, and need another build, then it can go there. If ER3 is the GA, then let's target it for a CP.
The update to ECJ 4.4 is not risky at all, it is a compiler with very high use, and is already integrated in Tomcat.
Verified with EAP 6.4.0.ER3