From 0268e03cb461b0c7e8ae2082894988395fc0994a Mon Sep 17 00:00:00 2001 From: Eugene Burmako Date: Tue, 28 Jan 2014 19:37:59 +0300 Subject: SI-8118 simplifies Annotation down to a plain Tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per https://groups.google.com/forum/#!topic/scala-internals/8v2UL-LR9yY, annotations don’t have to be represented as AnnotationInfos and can be reduced to plain Trees. Due to compatibility reasons and because of the limitations of the cake pattern used in implementing current version of Reflection, we can’t just say `type Annotation = Tree`, however what we can definitely do is to deprecate all the methods on Annotation and expose `tree: Tree` instead. --- test/files/run/reflection-scala-annotations.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/files/run/reflection-scala-annotations.scala (limited to 'test/files/run/reflection-scala-annotations.scala') diff --git a/test/files/run/reflection-scala-annotations.scala b/test/files/run/reflection-scala-annotations.scala new file mode 100644 index 0000000000..f6a6895ee0 --- /dev/null +++ b/test/files/run/reflection-scala-annotations.scala @@ -0,0 +1,16 @@ +import scala.reflect.runtime.universe._ +import scala.annotation._ + +class sann(x: Int, y: List[Int]) extends StaticAnnotation +class jann(x: Int, y: Array[Int]) extends ClassfileAnnotation + +@sann(1, List(1, 2)) +class S + +@jann(y = Array(1, 2), x = 2) +class J + +object Test extends App { + println(symbolOf[S].annotations.head.tree) + println(symbolOf[J].annotations.head.tree) +} -- cgit v1.2.3