You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scala>classWextends scala.annotation.Annotation
defined classW
scala>traitA {
|@Wvala:Int| }
defined traitA
scala> typeOf[A].members.last
res0: $r.intp.global.Symbol= value a
scala> res0.getAnnotations
res1:List[$r.intp.global.AnnotationInfo] =List()
The text was updated successfully, but these errors were encountered:
@xeno-by said (edited on Sep 15, 2012 6:26:48 PM UTC):
This issue exposes two important annotation-related gotchas.
To have an annotation visible by Scala reflection, you need to extend either StaticAnnotation or ClassfileAnnotation. Just Annotation won't cut it.
Annotation on a val is by default added to the underlying field of a val. Since val in question is abstract, there's no underlying field, so the annotation goes to waste. Writing @(W @scala.annotation.meta.getter) would attach the annotation to the getter as desired in this situation.
The text was updated successfully, but these errors were encountered: