File tree 2 files changed +13
-1
lines changed 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -346,6 +346,9 @@ class Definitions {
346
346
lazy val UncheckedStableAnnot = ctx.requiredClass(" scala.annotation.unchecked.uncheckedStable" )
347
347
lazy val UncheckedVarianceAnnot = ctx.requiredClass(" scala.annotation.unchecked.uncheckedVariance" )
348
348
lazy val VolatileAnnot = ctx.requiredClass(" scala.volatile" )
349
+ lazy val FieldMetaAnnot = ctx.requiredClass(" scala.annotation.meta.field" )
350
+ lazy val GetterMetaAnnot = ctx.requiredClass(" scala.annotation.meta.getter" )
351
+ lazy val SetterMetaAnnot = ctx.requiredClass(" scala.annotation.meta.setter" )
349
352
350
353
// convenient one-parameter method types
351
354
def methOfAny (tp : Type ) = MethodType (List (AnyType ), tp)
Original file line number Diff line number Diff line change @@ -50,7 +50,16 @@ import Decorators._
50
50
name = sym.name.asTermName.fieldName,
51
51
flags = Private | (if (sym is Stable ) EmptyFlags else Mutable ),
52
52
info = sym.info.resultType,
53
- coord = tree.pos).enteredAfter(thisTransform)
53
+ coord = tree.pos)
54
+ .withAnnotationsCarrying(sym, defn.FieldMetaAnnot )
55
+ .enteredAfter(thisTransform)
56
+
57
+ /** Can be used to filter annotations on getters and setters; not used yet */
58
+ def keepAnnotations (denot : SymDenotation , meta : ClassSymbol ) = {
59
+ val cpy = sym.copySymDenotation()
60
+ cpy.filterAnnotations(_.symbol.derivesFrom(meta))
61
+ if (cpy.annotations ne denot.annotations) cpy.installAfter(thisTransform)
62
+ }
54
63
55
64
lazy val field = sym.field.orElse(newField).asTerm
56
65
if (sym.is(Accessor , butNot = NoFieldNeeded ))
You can’t perform that action at this time.
0 commit comments