You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Christopher Smith (Jira)" <ji...@apache.org> on 2020/12/09 03:30:00 UTC

[jira] [Created] (GROOVY-9855) Compiler does not resolve compile-time constants in string concatenation

Christopher Smith created GROOVY-9855:
-----------------------------------------

             Summary: Compiler does not resolve compile-time constants in string concatenation
                 Key: GROOVY-9855
                 URL: https://issues.apache.org/jira/browse/GROOVY-9855
             Project: Groovy
          Issue Type: Bug
          Components: Compiler, Static compilation
    Affects Versions: 3.0.7
            Reporter: Christopher Smith


{code:groovy}
@Qualifier(ConfigProps.PREFIX + '.suffix')
@CompileStatic
class ConfigProps {
    public static final String PREFIX = 'prefix'
}
{code}

In this case, the value ({{prefix.suffix}}) is a compile-time constant and should be available as an annotation parameter, but the compiler does not recognize this. Both plain and static compilation produce errors, though different errors:

dynamic:
{code}
The value for annotation attribute Qualifier.value must be a constant expression
{code}

static:
{code}
Attribute 'value' should have type 'java.lang.String'; but found type 'java.lang.Object'
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)