Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-66641

Unable to use Java 8 language features in JSPs

    Details

      Description

      For JSPs in modules, Liferay hard-codes the language level to JDK7, even when running on JDK8. As a result, the following JSP code which attempts to use JDK8 features does not work when used inside of a JSP:

      <%@ page import="java.util.Arrays" %>
      <%@ page import="java.util.stream.Collectors" %>
      <%@ page import="java.util.List" %>
      
      <%
      List<String> items = Arrays.asList(new String[] {"alpha", "bravo", "charlie"});
      
      /*
      for (String item : items) {
      	out.print(item.charAt(0));
      }
      */
      
      for (Character ch : items.stream().map(s -> s.charAt(0)).collect(Collectors.toList())) {
      	out.print(ch);
      }
      %>
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              joyce.wang Joyce Wang
              Reporter:
              minhchau.dang Minhchau Dang
              Participants of an Issue:
              Recent user:
              Csaba Turcsan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 46 weeks, 6 days ago

                  Packages

                  Version Package
                  7.0.0 DXP FP3
                  7.0.0 DXP SP1
                  Master