Christopher Smith created GROOVY-11180:
------------------------------------------

             Summary: Regression: STC loses track of package-scope constants
                 Key: GROOVY-11180
                 URL: https://issues.apache.org/jira/browse/GROOVY-11180
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 4.0.15, 4.0.14, 4.0.13
            Reporter: Christopher Smith


This bug was introduced in 4.0.13.

I have two classes:

{code:groovy}
package bug.repro

class Constants {
  @PackageScope static final String CONSTANT = 'foo'
}
{code}

{code:groovy}
package bug.repro

import static bug.repro.Constants.CONSTANT

@groovy.transform.CompileStatic
class UsesConstants {
  void run() {
    println CONSTANT.isEmpty()
  }
}
{code}

As of 4.0.12, this compiles as expected (would print {{false}}). As of 4.0.13, 
it produces 
{code}
[Static type checking] - Cannot find matching method 
bug.repro.constants#getCONSTANT(). Please check if the declared type is correct 
and if the method exists.
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to