diff options
author | Martin Odersky <odersky@gmail.com> | 2012-01-25 15:04:53 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-01-25 15:04:53 +0100 |
commit | c749710859d32252291802d55d48abe518ddd118 (patch) | |
tree | fef90dd9afa4c595b533cb137d27c64b66cb2ce6 /src/compiler/scala/reflect/internal/Definitions.scala | |
parent | 65a1e8bd2dbd796bedc0232615cfc3caf18fd4b3 (diff) | |
download | scala-c749710859d32252291802d55d48abe518ddd118.tar.gz scala-c749710859d32252291802d55d48abe518ddd118.tar.bz2 scala-c749710859d32252291802d55d48abe518ddd118.zip |
Making reflection thread-safe.
The idea is that all operations that need to be synchronized are overriden in classes reflect.runtime.Synchronized*. Sometimes this applies to operations defined in SymbolTable, which can be directly overridden. Sometimes it is more convenient to generate SynchronizedClazz subclasses of SymbolTable classes Clazz. In the latter case, all instance creation must go over factory methods that can be overridden in the Synchronized traits.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Definitions.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Definitions.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala index d38b62cbb4..a733f0d1ee 100644 --- a/src/compiler/scala/reflect/internal/Definitions.scala +++ b/src/compiler/scala/reflect/internal/Definitions.scala @@ -16,7 +16,7 @@ trait Definitions extends reflect.api.StandardDefinitions { private def newClass(owner: Symbol, name: TypeName, parents: List[Type], flags: Long = 0L): Symbol = { val clazz = owner.newClassSymbol(name, NoPosition, flags) - clazz setInfoAndEnter ClassInfoType(parents, new Scope, clazz) + clazz setInfoAndEnter ClassInfoType(parents, newScope, clazz) } private def newMethod(owner: Symbol, name: TermName, formals: List[Type], restpe: Type, flags: Long = 0L): Symbol = { val msym = owner.newMethod(name.encode, NoPosition, flags) @@ -206,7 +206,7 @@ trait Definitions extends reflect.api.StandardDefinitions { sealed abstract class BottomClassSymbol(name: TypeName, parent: Symbol) extends ClassSymbol(ScalaPackageClass, NoPosition, name) { locally { this initFlags ABSTRACT | TRAIT | FINAL - this setInfoAndEnter ClassInfoType(List(parent.tpe), new Scope, this) + this setInfoAndEnter ClassInfoType(List(parent.tpe), newScope, this) } final override def isBottomClass = true } @@ -352,7 +352,7 @@ trait Definitions extends reflect.api.StandardDefinitions { ) lazy val EqualsPatternClass = { val clazz = newClass(ScalaPackageClass, tpnme.EQUALS_PATTERN_NAME, Nil) - clazz setInfo polyType(List(newTypeParam(clazz, 0)), ClassInfoType(anyparam, new Scope, clazz)) + clazz setInfo polyType(List(newTypeParam(clazz, 0)), ClassInfoType(anyparam, newScope, clazz)) } lazy val MatchingStrategyClass = getRequiredClass("scala.MatchingStrategy") @@ -823,7 +823,7 @@ trait Definitions extends reflect.api.StandardDefinitions { clazz.setInfo( polyType( List(tparam), - ClassInfoType(List(AnyRefClass.tpe, p), new Scope, clazz))) + ClassInfoType(List(AnyRefClass.tpe, p), newScope, clazz))) } private def newAlias(owner: Symbol, name: TypeName, alias: Type): Symbol = |