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

@CompileStatic with Method References

    XMLWordPrintableJSON

Details

    Description

      The following code worked fine until 3.0.5:

      @Test
      @CompileStatic
      void methodReference() {
          def list = ['']
          list.removeIf(String::isBlank)
      
          assert list.empty
      }
      

      Using version 3.0.6/3.0.7 this no longer compiles:

      Groovyc: [Static type checking] - Cannot call java.util.List <java.lang.String>#removeIf(java.util.function.Predicate <? super java.lang.String>) with arguments [groovy.lang.Closure <java.lang.Boolean>]
      

      Attachments

        Activity

          People

            emilles Eric Milles
            mspahn Michael Spahn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h