summaryrefslogtreecommitdiff
path: root/test/files/jvm
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-01-30 11:06:55 -0800
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-01-30 11:06:55 -0800
commitfefe6ccc0c47d202156e5e1fc3385b92cbb589a5 (patch)
tree1dc1de0f5a414816f5790d3b77543e43c56ce803 /test/files/jvm
parente22d801a539f951422e91519844c7cb9ce81b413 (diff)
downloadscala-fefe6ccc0c47d202156e5e1fc3385b92cbb589a5.tar.gz
scala-fefe6ccc0c47d202156e5e1fc3385b92cbb589a5.tar.bz2
scala-fefe6ccc0c47d202156e5e1fc3385b92cbb589a5.zip
SI-7009: `@throws` annotation synthesized incorrectly
The 990b3c7 made `scala.throws` annotation polymorphic but forgot to adapt compiler code that synthesizes it, e.g. when parsing class files. The consequence was that we would get non-deterministically either `scala.throws` or `scala.throws[T]` as a type for synthesized annotation. The reason is that `Symbol.addAnnotation` would call `tpe` method which does not initialization of symbol so type parameters list would not be determined correctly. Only if info of that symbol was forced for other reason we would get `scala.throws[T]`. That non-deterministic behavior was observed in sbt's incremental compiler. Another problem we have is that Scala allows polymorphic exceptions so in ClassfileParser we could synthesize `@throws` annotation with wrong (polymorphic) type applied. In such case the best we can do is to convert such type to monomorphic one by introducing existentials. Here's list of changes this commit introduces: * The `Symbol.addAnnotation` that takes symbol as argument asserts that the type represented by that symbol is monomorphic (disabled due to cycles; see comments in the code) * Introduce `Symbol.addAnnotation` overload that allows us to pass an applied type * Change all places where polymorphic annotations are synthesized to pass an applied type * Handle polymorphic exception types in `ClassfileParser.parseExceptions` Fixes SI-7009.
Diffstat (limited to 'test/files/jvm')
-rw-r--r--test/files/jvm/throws-annot-from-java.check8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/files/jvm/throws-annot-from-java.check b/test/files/jvm/throws-annot-from-java.check
index 376061be2e..be3ba412f8 100644
--- a/test/files/jvm/throws-annot-from-java.check
+++ b/test/files/jvm/throws-annot-from-java.check
@@ -37,11 +37,11 @@ scala> :paste
// Exiting paste mode, now interpreting.
foo
-atp.typeParams.isEmpty: false
-throws(classOf[java.lang.IllegalStateException])
+atp.typeParams.isEmpty: true
+throws[IllegalStateException](classOf[java.lang.IllegalStateException])
bar
-tp.typeParams.isEmpty: false
-throws(classOf[test.PolymorphicException])
+tp.typeParams.isEmpty: true
+throws[test.PolymorphicException[_]](classOf[test.PolymorphicException])
scala>