summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2016-11-18 14:56:13 +1000
committerJason Zaugg <jzaugg@gmail.com>2016-11-25 12:07:41 +1000
commit824103644337758f2a6a70ea69a33a9671e1e69c (patch)
treef2554f994f64add5803fd79b004b3d7378417d20 /src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
parent73678d4dafe250f0b38df2e953787af26b1a4ee3 (diff)
downloadscala-824103644337758f2a6a70ea69a33a9671e1e69c.tar.gz
scala-824103644337758f2a6a70ea69a33a9671e1e69c.tar.bz2
scala-824103644337758f2a6a70ea69a33a9671e1e69c.zip
SI-9814 Fix synchronized in specialized overrides
Specialization creates a subclasses of a specializd class for each type parameter combination. These contains copies of the methods from the superclass. However, before this transform, the pattern of self-synchronization in a method body had been replace by flag Flag.SYNCHRONIZED on the method symbol. This was not being propagated to the override, and hence no locking occured. This commit modifies the creation of the specialized overload symbol to copy the SYNCHRONIZED flag, as was already done for ASBOVERRIDE. I have also done the same for the `@strictfp` annotation.
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala')
-rw-r--r--src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
index c171050bbd..84f47c1caa 100644
--- a/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
+++ b/src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
@@ -1049,7 +1049,8 @@ abstract class SpecializeTypes extends InfoTransform with TypingTransformers {
}
}
debuglog(s"specialized overload $om for ${overriding.name.decode} in ${pp(env)}: ${om.info}")
- if (overriding.isAbstractOverride) om.setFlag(ABSOVERRIDE)
+ om.setFlag(overriding.flags & (ABSOVERRIDE | SYNCHRONIZED))
+ om.withAnnotations(overriding.annotations.filter(_.symbol == ScalaStrictFPAttr))
typeEnv(om) = env
addConcreteSpecMethod(overriding)
if (overriding.isDeferred) { // abstract override