summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/AnnotationInfos.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2012-07-17 10:50:59 +0200
committerIulian Dragos <jaguarul@gmail.com>2012-07-18 15:01:25 +0200
commit01be1b1c201d6908522d7254075fd1cdf633809a (patch)
tree322b4f62436a5483dcfa9f9d04afdff2ba5ce2cb /src/reflect/scala/reflect/internal/AnnotationInfos.scala
parentff954063ae75376d284bb09302ea3ccba8cdc268 (diff)
downloadscala-01be1b1c201d6908522d7254075fd1cdf633809a.tar.gz
scala-01be1b1c201d6908522d7254075fd1cdf633809a.tar.bz2
scala-01be1b1c201d6908522d7254075fd1cdf633809a.zip
Fixed SI-6092. Fixed leaky annotations, and relaxed the conditions under which a try-catch is lifted
out to an inner method. Less known fact: lazy values null-out their dependent values is their accessed only from their initializer. The analysis is not context-dependent (meaning the owner where a reference happens needs to be exactly that lazy value). * Removed no-op code around positions in `LazyAnnotationInfo` * Don't lift expressions that have no `catch` clause The two changes combined fix a memory leak that's been plaguing the IDE: an annotation (even when forced) would hang on to a namer, through the outer field of its call-by-name parameter. The test for the memory leak is in the IDE project (couldn't find a simple way to reproduce it outside the IDE), but there's a test checking that the field is null after initialization.
Diffstat (limited to 'src/reflect/scala/reflect/internal/AnnotationInfos.scala')
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index c283ae408e..2bcc95b9a8 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -160,12 +160,7 @@ trait AnnotationInfos extends api.AnnotationInfos { self: SymbolTable =>
*/
final class LazyAnnotationInfo(lazyInfo: => AnnotationInfo) extends AnnotationInfo {
private var forced = false
- private lazy val forcedInfo =
- try {
- val result = lazyInfo
- if (result.pos == NoPosition) result setPos pos
- result
- } finally forced = true
+ private lazy val forcedInfo = try lazyInfo finally forced = true
def atp: Type = forcedInfo.atp
def args: List[Tree] = forcedInfo.args