summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-10-01 05:16:22 +0000
committerPaul Phillips <paulp@improving.org>2011-10-01 05:16:22 +0000
commit55109d0d253c7e89660f1b61d17408648c0c53a4 (patch)
treedb44f381515b79a575562cb2eacaaa8b7b590b7d /src/library
parentff5619e1f0d1653642e93e2c6a051c88231c95fb (diff)
downloadscala-55109d0d253c7e89660f1b61d17408648c0c53a4.tar.gz
scala-55109d0d253c7e89660f1b61d17408648c0c53a4.tar.bz2
scala-55109d0d253c7e89660f1b61d17408648c0c53a4.zip
Shuffling classes around.
Old Man Reflection is coming home and he's not going to like finding out a bunch of beans have moved into his reflecting room. We had better evict those guys before he blows his stack. scala.reflect.*Bean* --> scala.beans.* scala.beans, that's kind of a fancy package name for some beans. I figure it's time to start fishing or cutting bait on this kind of thing. I don't even know what beans are, but if we're going to have them in the mainline, the least surprising place to find them is scala.beans. If we don't want to put them in scala.beans for whatever reason, then I say they don't belong in trunk at all. Bonus round: scala.annotation.target --> scala.beans.meta I don't know if there is any more unfortunate name for a package possible than "target". Maybe ".svn" or ".git" if you could have dots in package names. Package CVS wouldn't hit too hard these days. Package lib_managed? I'll try to come up with something. In any case this golden opportunity could not be squandered. There is a new starr included, because GenJVM contains all kinds of shooting-from-the-hip Bean-related name hardcoding. (Yes, still. I ran out of stones. So a few birds escape with their lives... this time.)
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/annotation/target/package.scala93
-rw-r--r--src/library/scala/beans/BeanDescription.scala (renamed from src/library/scala/reflect/BeanDescription.scala)2
-rw-r--r--src/library/scala/beans/BeanDisplayName.scala (renamed from src/library/scala/reflect/BeanDisplayName.scala)2
-rw-r--r--src/library/scala/beans/BeanInfo.scala (renamed from src/library/scala/reflect/BeanInfo.scala)2
-rw-r--r--src/library/scala/beans/BeanInfoSkip.scala (renamed from src/library/scala/reflect/BeanInfoSkip.scala)2
-rw-r--r--src/library/scala/beans/BeanProperty.scala (renamed from src/library/scala/reflect/BeanProperty.scala)6
-rw-r--r--src/library/scala/beans/BooleanBeanProperty.scala (renamed from src/library/scala/reflect/BooleanBeanProperty.scala)6
-rw-r--r--src/library/scala/beans/ScalaBeanInfo.scala (renamed from src/library/scala/reflect/ScalaBeanInfo.scala)2
-rw-r--r--src/library/scala/beans/meta/beanGetter.scala (renamed from src/library/scala/annotation/target/beanGetter.scala)4
-rw-r--r--src/library/scala/beans/meta/beanSetter.scala (renamed from src/library/scala/annotation/target/beanSetter.scala)4
-rw-r--r--src/library/scala/beans/meta/field.scala (renamed from src/library/scala/annotation/target/field.scala)4
-rw-r--r--src/library/scala/beans/meta/getter.scala (renamed from src/library/scala/annotation/target/getter.scala)4
-rw-r--r--src/library/scala/beans/meta/package.scala68
-rw-r--r--src/library/scala/beans/meta/param.scala (renamed from src/library/scala/annotation/target/param.scala)4
-rw-r--r--src/library/scala/beans/meta/setter.scala (renamed from src/library/scala/annotation/target/setter.scala)4
-rw-r--r--src/library/scala/deprecated.scala2
-rw-r--r--src/library/scala/deprecatedName.scala2
-rw-r--r--src/library/scala/reflect/package.scala14
-rw-r--r--src/library/scala/transient.scala2
-rw-r--r--src/library/scala/volatile.scala2
20 files changed, 136 insertions, 93 deletions
diff --git a/src/library/scala/annotation/target/package.scala b/src/library/scala/annotation/target/package.scala
index 454ce46e5c..3aff964c7b 100644
--- a/src/library/scala/annotation/target/package.scala
+++ b/src/library/scala/annotation/target/package.scala
@@ -1,68 +1,29 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
package scala.annotation
-/**
- * When defining a field, the Scala compiler creates up to four accessors
- * for it: a getter, a setter, and if the field is annotated with
- * `@BeanProperty`, a bean getter and a bean setter.
- *
- * For instance in the following class definition
- *
- * {{{
- * class C(@myAnnot @BeanProperty var c: Int)
- * }}}
- *
- * there are six entities which can carry the annotation `@myAnnot`: the
- * constructor parameter, the generated field and the four accessors.
- *
- * By default, annotations on (`val`-, `var`- or plain) constructor parameters
- * end up on the parameter, not on any other entity. Annotations on fields
- * by default only end up on the field.
- *
- * The meta-annotations in package `scala.annotation.target` are used
- * to control where annotations on fields and class parameters are copied.
- * This is done by annotating either the annotation type or the annotation
- * class with one or several of the meta-annotations in this package.
- *
- * ==Annotating the annotation type==
- *
- * The target meta-annotations can be put on the annotation type when
- * instantiating the annotation. In the following example, the annotation
- * `@Id` will be added only to the bean getter `getX`.
- *
- * {{{
- * import javax.persistence.Id
- * class A {
- * @(Id @beanGetter) @BeanProperty val x = 0
- * }
- * }}}
- *
- * In order to annotate the field as well, the meta-annotation `@field`
- * would need to be added.
- *
- * The syntax can be improved using a type alias:
- *
- * {{{
- * object ScalaJPA {
- * type Id = javax.persistence.Id @beanGetter
- * }
- * import ScalaJPA.Id
- * class A {
- * @Id @BeanProperty val x = 0
- * }
- * }}}
- *
- * ==Annotating the annotation class==
- *
- * For annotations defined in Scala, a default target can be specified
- * in the annotation class itself, for example
- *
- * {{{
- * @getter
- * class myAnnotation extends Annotation
- * }}}
- *
- * This only changes the default target for the annotation `myAnnotation`.
- * When instantiating the annotation, the target can still be specified
- * as described in the last section.
- */
-package object target
+package object target {
+ @deprecated("Use `@scala.beans.meta.beanGetter` instead", "2.10.0")
+ type beanGetter = scala.beans.meta.beanGetter
+
+ @deprecated("Use `@scala.beans.meta.beanSetter` instead", "2.10.0")
+ type beanSetter = scala.beans.meta.beanSetter
+
+ @deprecated("Use `@scala.beans.meta.field` instead", "2.10.0")
+ type field = scala.beans.meta.field
+
+ @deprecated("Use `@scala.beans.meta.getter` instead", "2.10.0")
+ type getter = scala.beans.meta.getter
+
+ @deprecated("Use `@scala.beans.meta.param` instead", "2.10.0")
+ type param = scala.beans.meta.param
+
+ @deprecated("Use `@scala.beans.meta.setter` instead", "2.10.0")
+ type setter = scala.beans.meta.setter
+}
diff --git a/src/library/scala/reflect/BeanDescription.scala b/src/library/scala/beans/BeanDescription.scala
index d0069cdf79..d6c9b0c736 100644
--- a/src/library/scala/reflect/BeanDescription.scala
+++ b/src/library/scala/beans/BeanDescription.scala
@@ -7,7 +7,7 @@
\* */
-package scala.reflect
+package scala.beans
/** Provides a short description that will be included when generating
* bean information. This annotation can be attached to the bean itself,
diff --git a/src/library/scala/reflect/BeanDisplayName.scala b/src/library/scala/beans/BeanDisplayName.scala
index 5fecee4dc3..fbbfa08ffc 100644
--- a/src/library/scala/reflect/BeanDisplayName.scala
+++ b/src/library/scala/beans/BeanDisplayName.scala
@@ -7,7 +7,7 @@
\* */
-package scala.reflect
+package scala.beans
/** Provides a display name when generating bean information. This
* annotation can be attached to the bean itself, or to any member.
diff --git a/src/library/scala/reflect/BeanInfo.scala b/src/library/scala/beans/BeanInfo.scala
index 0522377f8e..1a1d8defa4 100644
--- a/src/library/scala/reflect/BeanInfo.scala
+++ b/src/library/scala/beans/BeanInfo.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-package scala.reflect
+package scala.beans
/** This annotation indicates that a JavaBean-compliant `BeanInfo` class
* should be generated for this annotated Scala class.
diff --git a/src/library/scala/reflect/BeanInfoSkip.scala b/src/library/scala/beans/BeanInfoSkip.scala
index 40596865c0..23adf74924 100644
--- a/src/library/scala/reflect/BeanInfoSkip.scala
+++ b/src/library/scala/beans/BeanInfoSkip.scala
@@ -7,7 +7,7 @@
\* */
-package scala.reflect
+package scala.beans
/** This annotation indicates that bean information should
* <strong>not</strong> be generated for the val, var, or def that it is
diff --git a/src/library/scala/reflect/BeanProperty.scala b/src/library/scala/beans/BeanProperty.scala
index b52774cdff..f5708a0ab0 100644
--- a/src/library/scala/reflect/BeanProperty.scala
+++ b/src/library/scala/beans/BeanProperty.scala
@@ -6,9 +6,9 @@
** |/ **
\* */
-package scala.reflect
+package scala.beans
-import annotation.target._
+import meta._
/** When attached to a field, this annotation adds a setter and a getter
* method following the Java Bean convention. For example:
@@ -22,7 +22,7 @@ import annotation.target._
* def getStatus: String = this.status
* }}}
* For fields of type `Boolean`, if you need a getter named `isStatus`,
- * use the `scala.reflect.BooleanBeanProperty` annotation instead.
+ * use the `scala.beans.BooleanBeanProperty` annotation instead.
*/
@field
class BeanProperty extends annotation.StaticAnnotation
diff --git a/src/library/scala/reflect/BooleanBeanProperty.scala b/src/library/scala/beans/BooleanBeanProperty.scala
index 97c05ffb7c..2215177a80 100644
--- a/src/library/scala/reflect/BooleanBeanProperty.scala
+++ b/src/library/scala/beans/BooleanBeanProperty.scala
@@ -6,12 +6,12 @@
** |/ **
\* */
-package scala.reflect
+package scala.beans
-import annotation.target._
+import meta._
/** This annotation has the same functionality as
- * `scala.reflect.BeanProperty`, but the generated Bean getter will be
+ * `scala.beans.BeanProperty`, but the generated Bean getter will be
* named `isFieldName` instead of `getFieldName`.
*/
@field
diff --git a/src/library/scala/reflect/ScalaBeanInfo.scala b/src/library/scala/beans/ScalaBeanInfo.scala
index bcb76c38bc..4661b23568 100644
--- a/src/library/scala/reflect/ScalaBeanInfo.scala
+++ b/src/library/scala/beans/ScalaBeanInfo.scala
@@ -7,7 +7,7 @@
\* */
-package scala.reflect
+package scala.beans
/** Provides some simple runtime processing necessary to create
* JavaBean descriptors for Scala entities. The compiler creates
diff --git a/src/library/scala/annotation/target/beanGetter.scala b/src/library/scala/beans/meta/beanGetter.scala
index 1707a9d258..3eb2dcbda3 100644
--- a/src/library/scala/annotation/target/beanGetter.scala
+++ b/src/library/scala/beans/meta/beanGetter.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class beanGetter extends annotation.StaticAnnotation
diff --git a/src/library/scala/annotation/target/beanSetter.scala b/src/library/scala/beans/meta/beanSetter.scala
index 11e95db3cb..8c61acfe6d 100644
--- a/src/library/scala/annotation/target/beanSetter.scala
+++ b/src/library/scala/beans/meta/beanSetter.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class beanSetter extends annotation.StaticAnnotation
diff --git a/src/library/scala/annotation/target/field.scala b/src/library/scala/beans/meta/field.scala
index cd0e5a58b3..135b2e590c 100644
--- a/src/library/scala/annotation/target/field.scala
+++ b/src/library/scala/beans/meta/field.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class field extends annotation.StaticAnnotation
diff --git a/src/library/scala/annotation/target/getter.scala b/src/library/scala/beans/meta/getter.scala
index 9363401d35..18afa8e324 100644
--- a/src/library/scala/annotation/target/getter.scala
+++ b/src/library/scala/beans/meta/getter.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class getter extends annotation.StaticAnnotation
diff --git a/src/library/scala/beans/meta/package.scala b/src/library/scala/beans/meta/package.scala
new file mode 100644
index 0000000000..c7b7b425e1
--- /dev/null
+++ b/src/library/scala/beans/meta/package.scala
@@ -0,0 +1,68 @@
+package scala.beans
+
+/**
+ * When defining a field, the Scala compiler creates up to four accessors
+ * for it: a getter, a setter, and if the field is annotated with
+ * `@BeanProperty`, a bean getter and a bean setter.
+ *
+ * For instance in the following class definition
+ *
+ * {{{
+ * class C(@myAnnot @BeanProperty var c: Int)
+ * }}}
+ *
+ * there are six entities which can carry the annotation `@myAnnot`: the
+ * constructor parameter, the generated field and the four accessors.
+ *
+ * By default, annotations on (`val`-, `var`- or plain) constructor parameters
+ * end up on the parameter, not on any other entity. Annotations on fields
+ * by default only end up on the field.
+ *
+ * The meta-annotations in package `scala.beans.meta` are used
+ * to control where annotations on fields and class parameters are copied.
+ * This is done by annotating either the annotation type or the annotation
+ * class with one or several of the meta-annotations in this package.
+ *
+ * ==Annotating the annotation type==
+ *
+ * The target meta-annotations can be put on the annotation type when
+ * instantiating the annotation. In the following example, the annotation
+ * `@Id` will be added only to the bean getter `getX`.
+ *
+ * {{{
+ * import javax.persistence.Id
+ * class A {
+ * @(Id @beanGetter) @BeanProperty val x = 0
+ * }
+ * }}}
+ *
+ * In order to annotate the field as well, the meta-annotation `@field`
+ * would need to be added.
+ *
+ * The syntax can be improved using a type alias:
+ *
+ * {{{
+ * object ScalaJPA {
+ * type Id = javax.persistence.Id @beanGetter
+ * }
+ * import ScalaJPA.Id
+ * class A {
+ * @Id @BeanProperty val x = 0
+ * }
+ * }}}
+ *
+ * ==Annotating the annotation class==
+ *
+ * For annotations defined in Scala, a default target can be specified
+ * in the annotation class itself, for example
+ *
+ * {{{
+ * @getter
+ * class myAnnotation extends Annotation
+ * }}}
+ *
+ * This only changes the default target for the annotation `myAnnotation`.
+ * When instantiating the annotation, the target can still be specified
+ * as described in the last section.
+ */
+package object meta
diff --git a/src/library/scala/annotation/target/param.scala b/src/library/scala/beans/meta/param.scala
index 5b917b883f..45c3e3e00f 100644
--- a/src/library/scala/annotation/target/param.scala
+++ b/src/library/scala/beans/meta/param.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class param extends annotation.StaticAnnotation
diff --git a/src/library/scala/annotation/target/setter.scala b/src/library/scala/beans/meta/setter.scala
index 1c13a796a0..5a23b7b53d 100644
--- a/src/library/scala/annotation/target/setter.scala
+++ b/src/library/scala/beans/meta/setter.scala
@@ -5,9 +5,9 @@
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
-package scala.annotation.target
+package scala.beans.meta
/**
- * Consult the documentation in package [[scala.annotation.target]].
+ * Consult the documentation in package [[scala.beans.meta]].
*/
final class setter extends annotation.StaticAnnotation
diff --git a/src/library/scala/deprecated.scala b/src/library/scala/deprecated.scala
index 53f5c456c2..12c36da8d3 100644
--- a/src/library/scala/deprecated.scala
+++ b/src/library/scala/deprecated.scala
@@ -8,7 +8,7 @@
package scala
-import annotation.target._
+import beans.meta._
/** An annotation that designates that a definition is deprecated.
* Access to the member then generates a deprecated warning.
diff --git a/src/library/scala/deprecatedName.scala b/src/library/scala/deprecatedName.scala
index 090ec133fe..53f26573c0 100644
--- a/src/library/scala/deprecatedName.scala
+++ b/src/library/scala/deprecatedName.scala
@@ -8,7 +8,7 @@
package scala
-import annotation.target._
+import beans.meta._
/**
* An annotation that designates the name of the parameter to which it is
diff --git a/src/library/scala/reflect/package.scala b/src/library/scala/reflect/package.scala
index ad541ce46e..d18924c409 100644
--- a/src/library/scala/reflect/package.scala
+++ b/src/library/scala/reflect/package.scala
@@ -17,4 +17,18 @@ package object reflect extends ReflectionUtils {
type Type = mirror.Type
type Tree = mirror.Tree
*/
+ @deprecated("Use `@scala.beans.BeanDescription` instead", "2.10.0")
+ type BeanDescription = scala.beans.BeanDescription
+ @deprecated("Use `@scala.beans.BeanDisplayName` instead", "2.10.0")
+ type BeanDisplayName = scala.beans.BeanDisplayName
+ @deprecated("Use `@scala.beans.BeanInfo` instead", "2.10.0")
+ type BeanInfo = scala.beans.BeanInfo
+ @deprecated("Use `@scala.beans.BeanInfoSkip` instead", "2.10.0")
+ type BeanInfoSkip = scala.beans.BeanInfoSkip
+ @deprecated("Use `@scala.beans.BeanProperty` instead", "2.10.0")
+ type BeanProperty = scala.beans.BeanProperty
+ @deprecated("Use `@scala.beans.BooleanBeanProperty` instead", "2.10.0")
+ type BooleanBeanProperty = scala.beans.BooleanBeanProperty
+ @deprecated("Use `@scala.beans.ScalaBeanInfo` instead", "2.10.0")
+ type ScalaBeanInfo = scala.beans.ScalaBeanInfo
}
diff --git a/src/library/scala/transient.scala b/src/library/scala/transient.scala
index c17fab1cb4..fd3c824e81 100644
--- a/src/library/scala/transient.scala
+++ b/src/library/scala/transient.scala
@@ -10,7 +10,7 @@
package scala
-import annotation.target._
+import beans.meta._
@field
class transient extends annotation.StaticAnnotation
diff --git a/src/library/scala/volatile.scala b/src/library/scala/volatile.scala
index 9b47a52766..a45bdf8d14 100644
--- a/src/library/scala/volatile.scala
+++ b/src/library/scala/volatile.scala
@@ -10,7 +10,7 @@
package scala
-import annotation.target._
+import beans.meta._
@field
class volatile extends annotation.StaticAnnotation