summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-10-25 15:06:10 +0300
committerPaul Phillips <paulp@improving.org>2012-10-31 13:22:20 -0700
commitc15171dd280bede6e7c3814d055017965c490e76 (patch)
treebdd7d8eca84246a8c91d446f13b5bc2a3b58d4b2 /src
parent8eefac8c25c2b20e2e8d1e7de1882460e90ceeb5 (diff)
downloadscala-c15171dd280bede6e7c3814d055017965c490e76.tar.gz
scala-c15171dd280bede6e7c3814d055017965c490e76.tar.bz2
scala-c15171dd280bede6e7c3814d055017965c490e76.zip
silences optional logs in reflection
Some parts of the compiler call `SymbolTable.log` to dump information about the progress of compilation, type inference, etc. In Global.scala, `log` checks the -Ylog configuration setting to approve or reject incoming messages. However in runtime reflection (scala.reflect.runtime.JavaUniverse) `log` always prints its argument, which is annoying. Here's why this is happening. In runtime reflection -Ylog is inapplicable, because this is a phase-based setting, whereas reflection does not have a notion of phases. Moreover reflection doesn't expose `settings` to the programmers (the corresponding `def settings` definition is declared in scala.reflect.internal.Required). Therefore there's no obvious solution to conditional printing in `log` when invoked in reflective setting. The situation is tough and needs to be addressed in a principled manner. However we're in between RC1 and RC2 at the moment, so I don't fancy significant changes right now. Nevertheless we need to fix the annoyance right away, therefore I change reflective `log` to use -Ydebug. This is inconsistent w.r.t how Global works, and also there's no way to enable logging short of casting to `scala.reflect.runtime.SymbolTable`, but it looks like a decent temporary measure.
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/runtime/JavaUniverse.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/runtime/JavaUniverse.scala b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
index e18435d5b0..1b69ca4e89 100644
--- a/src/reflect/scala/reflect/runtime/JavaUniverse.scala
+++ b/src/reflect/scala/reflect/runtime/JavaUniverse.scala
@@ -17,7 +17,7 @@ class JavaUniverse extends internal.SymbolTable with ReflectSetup with runtime.S
def forInteractive = false
def forScaladoc = false
- def log(msg: => AnyRef): Unit = println(" [] "+msg)
+ def log(msg: => AnyRef): Unit = if (settings.debug.value) println(" [] "+msg)
type TreeCopier = InternalTreeCopierOps
def newStrictTreeCopier: TreeCopier = new StrictTreeCopier