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

SAM parameter type inference for explicit parameter

    XMLWordPrintableJSON

Details

    Description

      import groovy.transform.CompileStatic
      import java.util.function.Predicate
      
      @CompileStatic
      static boolean foo(Predicate<? super String> p) {
          p.test("foo")
      }
      
      @CompileStatic
      static def testPredicate() {
          foo { // it ->
              it.toUpperCase()
              true
          }
      }
      

      Uncomment it, compiler will say:

      Cannot find matching method java.lang.Object#toUpperCase()
      

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              daniilo Daniil Ovchinnikov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: