title: Java SpEL EL1043E: Unexpected token. Expected 'rparen())' but was 'comma(,)'
body: <p>I try to learn SpEL but one of my script doesn't work.
  My script is:</p>
  
  <pre><code>changePages(#{T(StoryContent).pages}, (x, y) -&gt; x.replaceAll(y, x.substring(0, 1) + '...' + x.substring(x.length() - 1, x.length())))
  </code></pre>
  
  <p>Java Code:</p>
  
  <pre><code>     public void validate(Story story, List&lt;StoryRule&gt; rules) throws NoSuchMethodException, SecurityException {
              StoryContent storyContent = storyContentRepository.findOne(story.getContentId());
              story.setStatus(SchedulerStatus.VALIDATION);
              storyRepository.save(story);
              ExpressionParser parser = new SpelExpressionParser();
              StandardEvaluationContext inventorContext = new StandardEvaluationContext(storyContent);
              inventorContext.registerFunction("changePages", ValidationByRuleServiceImpl.class
                      .getDeclaredMethod("changePages", new Class[] { List.class, BiFunction.class }));
              try {
                  rules.stream().map(StoryRule::getScript)
                          .forEach(script -&gt; parser.parseExpression(script).getValue(inventorContext));
                  if (!storyContent.getTitle().equals(story.getName()))
                      story.setName(storyContent.getTitle());
                  story.setStatus(SchedulerStatus.PUBLISHED);
                  storyContentRepository.save(storyContent);
              } catch (Exception e) {
                  LOG.error(e.getMessage());
                  story.setStatus(SchedulerStatus.ERROR);
              } finally {
                  storyRepository.save(story);
              }
      }
      private void changePages(List&lt;String&gt; pages, BiFunction&lt;String, String, String&gt; function) {
          pages.forEach(System.out::println);
      }
  </code></pre>
  
  <p>Error is:</p>
  
  <pre><code>Expression [changePages(T(StoryContent).pages, (x, y) -&gt; x.replaceAll(y, x.substring(0, 1) + '...' + x.substring(x.length() - 1, x.length())))] @37: EL1043E: Unexpected token. Expected 'rparen())' but was 'comma(,)'
  </code></pre>
  
  <p>I get List of SpEL scripts from DB.</p>
  
  <p>I don't know what is wrong, my script or my java code?</p>