From 4e86106b5b0637aa88de2e3d5a8751d918e4c069 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Mon, 10 Oct 2011 06:24:46 +0000 Subject: Moved meta annotations to annotation.meta, plus. It took me a long time to find a trivial error while adjusting the annotation packages, so I spent even longer trying to make sure next time it would take me less time. It's the usual business of eliminating duplication and unnecessary indirection. Behavioral note: there was no consistency or deducible reasoning regarding when annotation checks would be performed against the typeSymbol directly (thus excluding annotation subclasses) or when they would do a subclass check. I saw no reason it shouldn't always be a subclass check; if the annotation isn't supposed to be subclassed it should be final, and if it is, then the subclasses had probably better not stop exhibiting the behavior of the base class. Example: this now draws deprecated warnings, but did not before. class bippy extends deprecated("hi mom", "burma shave") @bippy def f = 5 (The deprecation message isn't printed so we're not there yet, but closer.) There is some new internal documentation on annotations, sadly lacking in my famous ascii diagrams, and some new conveniences. Review by rytz. --- test/files/jvm/annotations.scala | 8 ++++---- test/files/pos/annotations.scala | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala index a0b087a8db..b1c3c8ba40 100644 --- a/test/files/jvm/annotations.scala +++ b/test/files/jvm/annotations.scala @@ -94,7 +94,7 @@ object Test4 { } class Foo8(@SourceAnnotation("constructor val") val n: Int) {} class Foo9 { - import scala.beans.meta._ + import scala.annotation.meta._ import scala.beans.BeanProperty @(SourceAnnotation @getter)("http://apple.com") val x = 0 @BeanProperty @(SourceAnnotation @beanSetter)("http://uppla.com") var y = 0 @@ -103,8 +103,8 @@ object Test4 { @BeanProperty @myAnn("http://eppli.com") var z = 0 } class Foo10(@SourceAnnotation("on param 1") val name: String) - class Foo11(@(SourceAnnotation @scala.beans.meta.field)("on param 2") val name: String) - class Foo12(@(SourceAnnotation @scala.beans.meta.setter)("on param 3") var name: String) + class Foo11(@(SourceAnnotation @scala.annotation.meta.field)("on param 2") val name: String) + class Foo12(@(SourceAnnotation @scala.annotation.meta.setter)("on param 3") var name: String) def run { import java.lang.annotation.Annotation import java.lang.reflect.AnnotatedElement @@ -183,7 +183,7 @@ object Test5 { object Test6 { import scala.beans.BeanProperty - import scala.reflect.BooleanBeanProperty + import scala.beans.BooleanBeanProperty class C(@BeanProperty var text: String) class D(@BooleanBeanProperty var prop: Boolean) { @BeanProperty val m: Int = if (prop) 1 else 2 diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala index 1cae262bb0..4e5fddda39 100644 --- a/test/files/pos/annotations.scala +++ b/test/files/pos/annotations.scala @@ -79,7 +79,7 @@ class C extends T with BeanF { trait T { @scala.beans.BeanProperty var f = "nei" - @scala.reflect.BooleanBeanProperty var g = false + @scala.beans.BooleanBeanProperty var g = false } trait BeanF { -- cgit v1.2.3