diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala | 8 | ||||
-rw-r--r-- | test/files/pos/annotations.scala | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala index fc9585cfa1..854b9525c8 100644 --- a/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala +++ b/src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala @@ -261,20 +261,24 @@ trait SyntheticMethods { self: Analyzer => def addBeanGetterMethod(sym: Symbol) = { val getter = beanSetterOrGetter(sym) - if (getter != NoSymbol) + if (getter != NoSymbol) { + clazz.info.decls.enter(getter) ts += typer.typed(DefDef( getter, vparamss => if (sym hasFlag DEFERRED) EmptyTree else gen.mkAttributedRef(sym))) + } } def addBeanSetterMethod(sym: Symbol) = { val setter = beanSetterOrGetter(sym) - if (setter != NoSymbol) + if (setter != NoSymbol) { + clazz.info.decls.enter(setter) ts += typer.typed(DefDef( setter, vparamss => if (sym hasFlag DEFERRED) EmptyTree else Apply(gen.mkAttributedRef(sym), List(Ident(vparamss.head.head))))) + } } def isPublic(sym: Symbol) = diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala index d96c8e0c6a..558fd62956 100644 --- a/test/files/pos/annotations.scala +++ b/test/files/pos/annotations.scala @@ -9,4 +9,14 @@ object Test { def c: Int @ann(x) = 1 def d: String @ann({val z = 0; z - 1}) = "2" + + import scala.reflect.BeanProperty + + // bug #637 + trait S { def getField(): Int } + class O extends S { @BeanProperty val field = 0 } + + // bug #1070 + trait T { @BeanProperty var field = 1 } } + |