Groovy - Unable to use static final string in an annotation
<p>Something is really wierd.
I'm using a static final String in an annotation value.</p>

<pre><code>class Constants {
    static final String myConstant = "ting tong"   
}

class Service {
    @CacheEvict(cacheNames = Constants.myConstant)
    void doSomethingNice() {    
    }
}
</code></pre>

<p>However, i just cant get it to compile.</p>

<p>Here's the error message</p>

<blockquote>
  <p>Attribute 'myConstant' should have type 'java.lang.String'; but found
  type 'java.lang.Object' in
  @org.springframework.cache.annotation.CacheEvict</p>
  
  <p>Expected 'Constants.getMyConstant()' to be an inline constant of type
  java.lang.String in @org.springframework.cache.annotation.CacheEvict</p>
</blockquote>

<p>What can be the problem? This works perfectly in Java</p>