Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8917

Failed to infer parameter type of some SAM, e.g. BinaryOperator

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-alpha-4
    • None
    • None

    Description

              import groovy.transform.CompileStatic
              import java.util.stream.Collectors
              import java.util.stream.Stream
              
              @CompileStatic
              public class Test1 {
                  public static void main(String[] args) {
                      p();
                  }
                  
                  public static void p() {
                      // If we do not explicitly declare the type of parameter, STC fails
                      assert 13 == [1, 2, 3].stream().reduce(7, (Integer r, Integer e) -> r + e);
                  }
              }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            daniel_sun Daniel Sun
            daniel_sun Daniel Sun
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment