title: How do I add a constant and literal in an annotation?
body: <p>I'm trying to add a constant and literal in an annotation, but end up getting an "annotation argument needs to be a constant" error. I set up some example code that also produces the same error.</p>
  
  <h2>HelloWorld.scala</h2>
  
  <pre><code>package test
  
  @TestAnnotation(Constants.test + ", world!")
  object HelloWorld {
    def main(args: Array[String]) {
      println("Hello, world!")
    }
  }
  </code></pre>
  
  <h2>Constants.scala</h2>
  
  <pre><code>package test
  
  object Constants {
    final val test = "Hello"
  }
  </code></pre>
  
  <h2>TestAnnotation.java</h2>
  
  <pre><code>package test;
  
  @interface TestAnnotation {
      String value();
  }
  </code></pre>