diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-01-31 11:30:41 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-01-31 11:39:36 +0100 |
commit | 2e664079445549288789ad24a95ce7d583ae205c (patch) | |
tree | 166e7ff1e412a151f0d16f734e6c4e3c40f93ba3 /src/compiler/scala/reflect/internal/Symbols.scala | |
parent | 263aa2ead1f599f48b218027eb9550745fef43f1 (diff) | |
download | scala-2e664079445549288789ad24a95ce7d583ae205c.tar.gz scala-2e664079445549288789ad24a95ce7d583ae205c.tar.bz2 scala-2e664079445549288789ad24a95ce7d583ae205c.zip |
Introduce getAnnotations that triggers symbol completion
Default getter for annotations doesn't perform initialization, hence
we've faced the following bug: https://issues.scala-lang.org/browse/SI-5423.
One of the approaches to fixing it would be to auto-complete on getter,
but according to Martin we'd better not do that because of cycles.
That's why I'm just introducing a new, eager, variation of `annotations'
and redirecting public API to it.
Review by @odersky.
Diffstat (limited to 'src/compiler/scala/reflect/internal/Symbols.scala')
-rw-r--r-- | src/compiler/scala/reflect/internal/Symbols.scala | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/scala/reflect/internal/Symbols.scala b/src/compiler/scala/reflect/internal/Symbols.scala index 94d764067f..e777491300 100644 --- a/src/compiler/scala/reflect/internal/Symbols.scala +++ b/src/compiler/scala/reflect/internal/Symbols.scala @@ -1272,6 +1272,16 @@ trait Symbols extends api.Symbols { self: SymbolTable => * the annotations attached to member a definition (class, method, type, field). */ def annotations: List[AnnotationInfo] = _annotations + + /** This getter is necessary for reflection, see https://issues.scala-lang.org/browse/SI-5423 + * We could auto-inject completion into `annotations' and `setAnnotations', but I'm not sure about that + * @odersky writes: I fear we can't do the forcing for all compiler symbols as that could introduce cycles + */ + def getAnnotations: List[AnnotationInfo] = { + initialize + _annotations + } + def setAnnotations(annots: List[AnnotationInfo]): this.type = { _annotations = annots this |