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

STC: type inference of variable expression with superclass field and access method

    XMLWordPrintableJSON

Details

    Description

      Consider the following:

      abstract class A {
        protected Object thing = 'field'
        String getThing() { 'property' }
      }
      @groovy.transform.CompileStatic
      class C extends A {
        void test() {
          print thing.toUpperCase()
        }
      }
      new C().test()
      

      If ".toUpperCase()" is removed, the script prints "property". However the STC type recorded comes from the field.

      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: