diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2012-06-22 12:08:29 +0200 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2012-06-22 12:14:38 +0200 |
commit | 7527979be7f3578b44997e0089f7734667cfd160 (patch) | |
tree | 3d1ca561385afdc505d74454137b43be4232c8d2 /src | |
parent | cfc0e18dc55b33274c1275c192ade4a8d707d635 (diff) | |
download | scala-7527979be7f3578b44997e0089f7734667cfd160.tar.gz scala-7527979be7f3578b44997e0089f7734667cfd160.tar.bz2 scala-7527979be7f3578b44997e0089f7734667cfd160.zip |
Don't swallow `Throwables` while parsing bytecode. Print a warning and go on.
This has caused hours of debugging, to find out that 'package X does not have a member Y' were caused by a `NullPointerException`.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 13 |
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 d8bf23f4fe..31e1bf6389 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 } /** |