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

Compiler does not resolve compile-time constants in string concatenation

    XMLWordPrintableJSON

Details

    Description

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

      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:

      The value for annotation attribute Qualifier.value must be a constant expression
      

      static:

      Attribute 'value' should have type 'java.lang.String'; but found type 'java.lang.Object'
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h
                1h