You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/09/19 16:41:00 UTC
[jira] [Assigned] (GROOVY-11180) Regression: STC loses track of package-scope constants
[ https://issues.apache.org/jira/browse/GROOVY-11180?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-11180:
------------------------------------
Assignee: Eric Milles
> 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.13, 4.0.14, 4.0.15
> Reporter: Christopher Smith
> Assignee: Eric Milles
> Priority: Major
>
> 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)