aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-02-05 01:57:02 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-02-05 02:05:51 +0100
commit11df014b7fab14999d2de1ce5f86ef860dabfe2e (patch)
treee7400179c59fea580e66fb96f6ed9b16cc0f1627
parent9d8c92d1d52fcfa95d57ce88d91dbb84c8ecfbd1 (diff)
downloaddotty-11df014b7fab14999d2de1ce5f86ef860dabfe2e.tar.gz
dotty-11df014b7fab14999d2de1ce5f86ef860dabfe2e.tar.bz2
dotty-11df014b7fab14999d2de1ce5f86ef860dabfe2e.zip
Hide stack traces behind -Ydebug
They're not very useful for end users and some tests like tests/neg/selfreq.scala always print these exceptions which makes it harder to read the test logs, Also use Thread.dumpStack() instead of creating an Exception and calling printStackTrace() on it.
-rw-r--r--src/dotty/tools/dotc/core/Types.scala2
-rw-r--r--src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala4
-rw-r--r--src/dotty/tools/dotc/printing/PlainPrinter.scala2
-rw-r--r--src/dotty/tools/dotc/reporting/ConsoleReporter.scala2
-rw-r--r--src/dotty/tools/dotc/transform/PatternMatcher.scala2
5 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index e266bab6f..db5cca90a 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -3386,7 +3386,7 @@ object Types {
class MissingType(pre: Type, name: Name)(implicit ctx: Context) extends TypeError(
i"""cannot resolve reference to type $pre.$name
|the classfile defining the type might be missing from the classpath${otherReason(pre)}""".stripMargin) {
- printStackTrace()
+ if (ctx.debug) printStackTrace()
}
private def otherReason(pre: Type)(implicit ctx: Context): String = pre match {
diff --git a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
index 618e3ceea..3b415c9e3 100644
--- a/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
+++ b/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala
@@ -186,7 +186,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
val ex = new BadSignature(
sm"""error reading Scala signature of $classRoot from $source:
|error occurred at position $readIndex: $msg""")
- /*if (debug)*/ original.getOrElse(ex).printStackTrace() // !!! DEBUG
+ if (ctx.debug) original.getOrElse(ex).printStackTrace()
throw ex
}
@@ -423,7 +423,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
owner.info.decls.checkConsistent()
if (slowSearch(name).exists)
System.err.println(i"**** slow search found: ${slowSearch(name)}")
- new Exception().printStackTrace()
+ if (ctx.debug) Thread.dumpStack()
ctx.newStubSymbol(owner, name, source)
}
}
diff --git a/src/dotty/tools/dotc/printing/PlainPrinter.scala b/src/dotty/tools/dotc/printing/PlainPrinter.scala
index 8f9d70d4c..6d026dde7 100644
--- a/src/dotty/tools/dotc/printing/PlainPrinter.scala
+++ b/src/dotty/tools/dotc/printing/PlainPrinter.scala
@@ -32,7 +32,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
protected def recursionLimitExceeded() = {
ctx.warning("Exceeded recursion depth attempting to print.")
- (new Throwable).printStackTrace
+ if (ctx.debug) Thread.dumpStack()
}
/** If true, tweak output so it is the same before and after pickling */
diff --git a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
index e9b9964c3..8f1fbf797 100644
--- a/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
+++ b/src/dotty/tools/dotc/reporting/ConsoleReporter.scala
@@ -63,7 +63,7 @@ class ConsoleReporter(
if (reader != null) {
val response = reader.read().asInstanceOf[Char].toLower
if (response == 'a' || response == 's') {
- (new Exception).printStackTrace()
+ Thread.dumpStack()
if (response == 'a')
sys.exit(1)
}
diff --git a/src/dotty/tools/dotc/transform/PatternMatcher.scala b/src/dotty/tools/dotc/transform/PatternMatcher.scala
index 7c8d0a10f..4d626c67b 100644
--- a/src/dotty/tools/dotc/transform/PatternMatcher.scala
+++ b/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -327,7 +327,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
private[TreeMakers] def incorporateOuterRebinding(outerSubst: Rebindings): Unit = {
if (currSub ne null) {
ctx.debuglog("BUG: incorporateOuterRebinding called more than once for " + ((this, currSub, outerSubst)))
- Thread.dumpStack()
+ if (ctx.debug) Thread.dumpStack()
}
else currSub = outerSubst >> rebindings
}