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

Static type checking - Cannot find matching method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2
    • 2.3.1
    • None
    • Maven 3 with groovy-eclipse-compiler 2.8.0-01
      OpenJDK 1.7.0_51

    Description

      @TypeChecked
      class Issue2 {
      
          public void issue() {
      
              transform(new Function<String, String>() {
      
                  String apply(String input) {
                      return "ok"
                  }
              })
          }
      
          public <I, O> void transform(Function<? super I, ? extends O> function) {
          }
      }
      
      

      Compiler fails with the following error:
      TypeChecker/src/main/java/org/issues/Issue2.groovy: 14 Groovy:[Static type checking] - Cannot find matching method org.issues.Issue2#transform(org.issues.Issue2$1). Please check if the declared type is right and if the method exists.

      See attachment (org.issues.Issue2)

      Attachments

        1. TypeChecker.zip
          3 kB
          Nicolas Labrot

        Activity

          People

            melix Cédric Champeau
            nithril Nicolas Labrot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: