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

STC cannot locate method specified by interface but supplied by AST transform

    XMLWordPrintableJSON

Details

    Description

      Consider the following:

      package p
      interface A {
        String decode(String s)
      }
      class B implements A {
        String decode(String s) { s }
      }
      class C implements A {
        @Delegate private final B b = new B()
      }
      
      package p
      class D extends C { // implements A
        @groovy.transform.TypeChecked
        void test() {
          def x = decode('string')
        }
      }
      

      The class D implements A through its superclass C, which declares decode(String). However the type-checker says "Cannot find matching method D#decode(java.lang.String). Please check if the declared type is correct and if the method exists."

      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: