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

Static type check reports an error when accessing some property

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0-rc-2
    • 2.0-rc-3
    • Static Type Checker
    • None

    Description

      @groovy.transform.CompileStatic
      class Test {
       
        List getListVar() {
          new ArrayList()
        }
       
        void someMethod() {
           def t = new Object()
           t = this
           
           t.getListVar()     //No error here
           t.listVar          //error is being reported here
        } 
      }
      

      1 compilation error:

      Access to java.lang.Object#listVar is forbidden at line: 13, column: 6

      Attachments

        Activity

          People

            melix Cédric Champeau
            ariel.andres.morelli Ariel Morelli Andres
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: