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

@CompileStatic with Method References

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.6, 3.0.7
    • Fix Version/s: 3.0.8, 4.0.0-alpha-3
    • Component/s: Static compilation
    • Labels:
      None
    • Environment:
      JDK 11

      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

            • Assignee:
              emilles Eric Milles
              Reporter:
              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