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

STC: assign method pointer to SAM-type

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.19, 4.0.15
    • 3.0.20, 4.0.16
    • Static Type Checker
    • None

    Description

      Consider the following:

      import java.util.function.Consumer
      
      void setX(String string) { }
      Consumer<String> c = this.&setX
      

      With STC enabled, the compiler states Closure<Void> cannot be assigned to Consumre<String>.

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: