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

Compiler does not resolve compile-time constants in string concatenation

    XMLWordPrintableJSON

Details

    Description

      This appears to be the same behavior marked as fixed in GROOVY-9855. In a Groovy 4.0.4 compilation, this code:

      @CompileStatic
      @RequestMapping(path = FooController.BASE_URL)
      class FooController {
        public static final String BASE_URL = '/foos'
      }
      
      @CompileStatic
      @RequestMapping(path = FooBarController.BASE_URL)
      class FooBarController {
        public static final String BASE_URL = FooController.BASE_URL + '/{fooId}/bars'
      }
      

      succeeds for FooController, but FooBarController produces a pair of errors:

      FooBarController.groovy: 20: Expected 'com.example.FooBarController.BASE_URL' to be an inline constant of type java.lang.String not a property expression in @org.springframework.web.bind.annotation.RequestMapping
      FooBarController.groovy: 20: Attribute 'path' should have type 'java.lang.String'; but found type 'java.lang.Object' in @org.springframework.web.bind.annotation.RequestMapping
      

      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: