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

STC: write property via extension method

    XMLWordPrintableJSON

Details

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      void test(OutputStream os) {
        os.bytes = new byte[0]
      }
      

      Compiler reports "No such property: bytes for class: java.io.OutputStream". This is because StaticTypeCheckingVisitor#existsProperty looks for isser/getter to determine property type. This only works for matched methods like "MetaClass getMetaClass()" and "void setMetaClass(MetaClass mc)".

      GROOVY-9115, GROOVY-9123, GROOVY-11370

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: