summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2012-05-02 16:33:59 +0200
committerLukas Rytz <lukas.rytz@epfl.ch>2012-05-02 16:45:48 +0200
commit24b62e616ba2d18eee0a3bbffaf5c76abc6cc4b6 (patch)
tree09ea38f75b73aa95d17fd3a97e90a9067b80cd2b
parent90d2bee45b25844f809f8c5300aefcb1bfe9e336 (diff)
downloadscala-24b62e616ba2d18eee0a3bbffaf5c76abc6cc4b6.tar.gz
scala-24b62e616ba2d18eee0a3bbffaf5c76abc6cc4b6.tar.bz2
scala-24b62e616ba2d18eee0a3bbffaf5c76abc6cc4b6.zip
fix SI-5682
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala9
-rw-r--r--test/files/jvm/annotations.scala4
2 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
index 4c71772929..7dc105690c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/MethodSynthesis.scala
@@ -248,13 +248,12 @@ trait MethodSynthesis {
else List(Getter(vd))
)
def beanAccessors(vd: ValDef): List[DerivedFromValDef] = {
+ val setter = if (vd.mods.isMutable) List(BeanSetter(vd)) else Nil
if (forMSIL) Nil
- else if (vd.symbol hasAnnotation BeanPropertyAttr) {
- if (vd.mods.isMutable) List(BeanGetter(vd), BeanSetter(vd))
- else List(BeanGetter(vd))
- }
+ else if (vd.symbol hasAnnotation BeanPropertyAttr)
+ BeanGetter(vd) :: setter
else if (vd.symbol hasAnnotation BooleanBeanPropertyAttr)
- List(BooleanBeanGetter(vd))
+ BooleanBeanGetter(vd) :: setter
else Nil
}
def allValDefDerived(vd: ValDef) = {
diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala
index b1c3c8ba40..66ebde592b 100644
--- a/test/files/jvm/annotations.scala
+++ b/test/files/jvm/annotations.scala
@@ -193,7 +193,9 @@ object Test6 {
val c = new C("bob")
c.setText("dylan")
println(c.getText())
- if (new D(true).isProp()) {
+ val d = new D(true)
+ d.setProp(false)
+ if (!d.isProp()) {
println(new D(false).getM())
}
}