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

STC: entry vs field for map-based types

    XMLWordPrintableJSON

Details

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

    Description

      Consider the following:

      @groovy.transform.TypeChecked
      void test() {
        def map = new HashMap()
        def xxx = map.table
        def yyy = map.with{
          def z = table
        }
        print xxx
        print yyy
      }
      test()
      

      The script should output "nullnull" – which it does without STC – and the inferred types of "xxx", "yyy" and "z" should be String. However, the script throws IllegalAccessError for the "z" line and the inferred type of the variables is "Node<String,String>[]".

      GROOVY-11367

      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: