diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2013-01-31 20:40:16 +0100 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2013-02-01 16:55:40 +0100 |
commit | f1701f704a2485fcc2eb6d5d8b5d0228beddd9b3 (patch) | |
tree | 1ed30237e997bfcd76f7f595adaab4e21dcfaecb /test/files/run/t7008/Impls_Macros_1.scala | |
parent | 309ff57ba62b6a6ec1a9c1b28b8bbabfd1b47b72 (diff) | |
download | scala-f1701f704a2485fcc2eb6d5d8b5d0228beddd9b3.tar.gz scala-f1701f704a2485fcc2eb6d5d8b5d0228beddd9b3.tar.bz2 scala-f1701f704a2485fcc2eb6d5d8b5d0228beddd9b3.zip |
SI-7008 @throws annotations are now populated in reflect
Runtime reflection in JavaMirrors previously forgot to fill in
@throws when importing Java reflection artifacts. Now this is fixed.
Note that generic exception types used in `throws` specifications will
be garbled (i.e. erased), because we don't use `getGenericExceptionTypes`
in favor of just `getExceptionTypes` to stay compatible with the behavior
of ClassfileParser. That's a bug, but a separate one and should be fixed
separately.
Also note that this commit updated javac-artifacts.jar, because we need
to test how reflection works with javac-produced classfiles. The sources
that were used to produce those classfiles can be found in the jar next
to the classfiles.
Diffstat (limited to 'test/files/run/t7008/Impls_Macros_1.scala')
-rw-r--r-- | test/files/run/t7008/Impls_Macros_1.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/files/run/t7008/Impls_Macros_1.scala b/test/files/run/t7008/Impls_Macros_1.scala new file mode 100644 index 0000000000..f2eb7425f5 --- /dev/null +++ b/test/files/run/t7008/Impls_Macros_1.scala @@ -0,0 +1,12 @@ +import language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = { + val decls = c.typeOf[JavaClassWithCheckedExceptions[_]].declarations.toList + val s = decls.sortBy(_.name.toString).map(decl => (s"${decl.name}: ${decl.annotations}")).mkString(scala.compat.Platform.EOL) + c.universe.reify(println(c.literal(s).splice)) + } + + def foo = macro impl +}
\ No newline at end of file |