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

Concatenated strings not treated as compile-time constants

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.12
    • 5.0.0-alpha-3, 4.0.16
    • Compiler
    • None

    Description

      This problem was marked fixed with GROOVY-9855, but I'm seeing (a variant of?) it again:

      @Grab(Example.CONSTANT)
      // ^ The value for annotation attribute Grab.value must be a constant expression
      class Example {
        public static final String GROUP = 'asdf'
        public static final String CONSTANT = GROUP + ':asdf:0.1'
      }
      

      In case it's relevant, the non-minimal case involves a statically imported constant from another class:

      class MyController {
        public static final String PARAM_OWNER = 'filter[' + REL_OWNER + ']'
      
        @GetMapping(params = PARAM_OWNER)
        // ^ Expected 'PARAM_OWNER' to be an inline constant of type java.lang.String not a field expression in @org.springframework.web.bind.annotation.GetMapping
        ...
      }
      

      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: