summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-06-27 07:42:34 -0700
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-06-27 07:42:34 -0700
commit489b38b5356cfa4103d25de7afef2e5ebbe1f873 (patch)
treeea356418ab0dfd265f4f0723a457084fa02dd96d /src/compiler
parentfcc8bb5c9cbe1b11d609cfacb8f636f7eaf21f51 (diff)
parent7527979be7f3578b44997e0089f7734667cfd160 (diff)
downloadscala-489b38b5356cfa4103d25de7afef2e5ebbe1f873.tar.gz
scala-489b38b5356cfa4103d25de7afef2e5ebbe1f873.tar.bz2
scala-489b38b5356cfa4103d25de7afef2e5ebbe1f873.zip
Merge pull request #757 from dragos/warn-when-swallowing-throwables
Don't just swallow `Throwables` while parsing bytecode. Print a warning
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index aad3cfb974..046b177444 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -1013,9 +1013,16 @@ abstract class ClassfileParser {
} catch {
case f: FatalError => throw f // don't eat fatal errors, they mean a class was not found
case ex: Throwable =>
- debuglog("dropping annotation on " + sym + ", an error occured during parsing (e.g. annotation class not found)")
-
- None // ignore malformed annotations ==> t1135
+ // We want to be robust when annotations are unavailable, so the very least
+ // we can do is warn the user about the exception
+ // There was a reference to ticket 1135, but that is outdated: a reference to a class not on
+ // the classpath would *not* end up here. A class not found is signaled
+ // with a `FatalError` exception, handled above. Here you'd end up after a NPE (for example),
+ // and that should never be swallowed silently.
+ warning("Caught: " + ex + " while parsing annotations in " + in.file)
+ if (settings.debug.value) ex.printStackTrace()
+
+ None // ignore malformed annotations
}
/**