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

STC: extension method cannot provide map property (read mode)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.0.21, 4.0.21
    • 3.0.22, 4.0.22
    • Static Type Checker
    • None

    Description

      Consider the following:

      @TypeChecked
      void test() {
        def map = [:]
        print map.metaClass
      }
      test()
      

      The script prints "null" (before Groovy 5) indicating that "getMetaClass()" extension method is not used. However, node metadata indicates that the extension method is used. For example, adding "Number n = map.metaClass" says: "Cannot assign value of type groovy.lang.MetaClass to variable of type java.lang.Number"

      GROOVY-5001, GROOVY-5491, GROOVY-5568, GROOVY-9115, GROOVY-9123

      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: