From 4f1bfece9bc429ea465991355353a1e2c38c2e1a Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 25 Feb 2013 16:33:07 -0800 Subject: Fix SI-7107: scala now thinks every exception is polymorphic We need to force info of the `cls` in `parseExceptions` because we pass `cls` to `addThrowsAnnotation` which in turn calls `Symbol.isMonomorphicType` that relies on a symbol being initialized to give right answers. In the future we should just clean up implementation of `isMonomorphicType` method to not rely on a symbol being initialized as there's no inherent reason for that in most cases. In cases where there's reason for that we should just force the initialization. This patch does not come with a test-case because it's hard to reproduce not initialized symbols in partest reliably. --- src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index a517a33279..1f42fa8aab 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -1044,6 +1044,9 @@ abstract class ClassfileParser { for (n <- 0 until nClasses) { // FIXME: this performs an equivalent of getExceptionTypes instead of getGenericExceptionTypes (SI-7065) val cls = pool.getClassSymbol(in.nextChar.toInt) + // we call initialize due to the fact that we call Symbol.isMonomorphicType in addThrowsAnnotation + // and that method requires Symbol to be forced to give the right answers, see SI-7107 for details + cls.initialize sym.addThrowsAnnotation(cls) } } -- cgit v1.2.3