I looked at http://www.scala-lang.org/old/node/9363 and expected to tell you that you need static and / or final (which you already have) on your Constants.test , but I ran your code, and it works in section 2.10.4
$ sbt run [info] Compiling 2 Scala sources and 1 Java source to .../so22717836annotation/target/scala-2.10/classes... [info] Running HelloWorld Hello, world!
here is the code:
$ for i in `echo build.sbt; find src/main -type f`; do \ echo '###' $i '###'; echo; perl -pe 's/^/ /' $i; echo; done
build.sbt
name := "so22717836" version := "0.0.1" scalaVersion := "2.10.4"
Src / home / java / test / TestAnnotation.java
package test; public @interface TestAnnotation { String value(); }
Src / main / scala / HelloWorld.scala
import test._ @TestAnnotation(Constants.test + ", world!") object HelloWorld { def main(args: Array[String]) { println("Hello, world!") } }
SRC / Primary / scala / Constants.scala
object Constants { final val test = "Hello" }
source share