Skip to content

Instantly share code, notes, and snippets.

@alivesay
Created October 17, 2013 17:30
Show Gist options
  • Select an option

  • Save alivesay/7028958 to your computer and use it in GitHub Desktop.

Select an option

Save alivesay/7028958 to your computer and use it in GitHub Desktop.
Sup with scala field annotations?
Welcome to Scala version 2.10.0-20121205-235900-18481cef9b (OpenJDK 64-Bit Server VM, Java 1.7.0_40).
Type in expressions to have them evaluated.
Type :help for more information.
scala> class MyAnno extends scala.annotation.StaticAnnotation
defined class MyAnno
scala> case class Foo(@(MyAnno @scala.annotation.meta.field) x:Int)
defined class Foo
scala> classOf[Foo].getDeclaredFields.map(_.getAnnotations)
res0: Array[Array[java.lang.annotation.Annotation]] = Array(Array())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment