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

Regression: STC loses track of package-scope constants

    XMLWordPrintableJSON

Details

    Description

      This bug was introduced in 4.0.13.

      I have two classes:

      package bug.repro
      
      class Constants {
        @PackageScope static final String CONSTANT = 'foo'
      }
      
      package bug.repro
      
      import static bug.repro.Constants.CONSTANT
      
      @groovy.transform.CompileStatic
      class UsesConstants {
        void run() {
          println CONSTANT.isEmpty()
        }
      }
      

      As of 4.0.12, this compiles as expected (would print false). As of 4.0.13, it produces

      [Static type checking] - Cannot find matching method bug.repro.constants#getCONSTANT(). Please check if the declared type is correct and if the method exists.
      

      Attachments

        Issue Links

          Activity

            People

              emilles Eric Milles
              chrylis Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: