summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/internal/Symbols.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 17:25:16 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-15 09:23:58 +0100
commit1dda1760113f782ffbcf10f0ca7b9e4f8817a62a (patch)
treebe926837dc9b6afd0c02ca3d536b1051e3e810d2 /src/reflect/scala/reflect/internal/Symbols.scala
parentd7b6662ddd346d0a4dc12ea62a3392ac176bf271 (diff)
downloadscala-1dda1760113f782ffbcf10f0ca7b9e4f8817a62a.tar.gz
scala-1dda1760113f782ffbcf10f0ca7b9e4f8817a62a.tar.bz2
scala-1dda1760113f782ffbcf10f0ca7b9e4f8817a62a.zip
SI-7044 deprecates Symbol.associatedFile
Before this commit, Symbol.associatedFile used to be broken in two ways. Firstly, it was never autoloaded (just like we used to have flags, privateWithin and annotations). Secondly, it was never filled in by runtime reflection. My first attempt at fixing those problems was, well, just fixing them. However, its runtime implementation was based on a hacky function that we were not very much excited about supported (see comments), whereas its compile-time usefulness was somewhat questionable. Therefore the second attempt at fixing this bug is deprecating the API altogether, replacing it with `Symbol.pos.source`. Since `Symbol.pos` isn't retained for runtime consumption, `Symbol.pos.source` is still going to return `NoAbstractFile` as before this commit, but that's left for future work, and suggested approach is documented in SI-8259.
Diffstat (limited to 'src/reflect/scala/reflect/internal/Symbols.scala')
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 35c7a59683..5e81badfad 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -3166,8 +3166,10 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
override def associatedFile = (
if (!isTopLevel) super.associatedFile
- else if (_associatedFile eq null) NoAbstractFile // guarantee not null, but save cost of initializing the var
- else _associatedFile
+ else {
+ if (_associatedFile eq null) NoAbstractFile // guarantee not null, but save cost of initializing the var
+ else _associatedFile
+ }
)
override def associatedFile_=(f: AbstractFile) { _associatedFile = f }