summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Definitions.scala12
-rw-r--r--src/compiler/scala/reflect/internal/StdNames.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala12
-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
23 files changed, 150 insertions, 107 deletions
diff --git a/src/compiler/scala/reflect/internal/Definitions.scala b/src/compiler/scala/reflect/internal/Definitions.scala
index 1f918d0df1..a46b7d6bc7 100644
--- a/src/compiler/scala/reflect/internal/Definitions.scala
+++ b/src/compiler/scala/reflect/internal/Definitions.scala
@@ -209,12 +209,12 @@ trait Definitions extends reflect.api.StandardDefinitions {
lazy val ElidableMethodClass = getClass("scala.annotation.elidable")
lazy val ImplicitNotFoundClass = getClass("scala.annotation.implicitNotFound")
lazy val VarargsClass = getClass("scala.annotation.varargs")
- lazy val FieldTargetClass = getClass("scala.annotation.target.field")
- lazy val GetterTargetClass = getClass("scala.annotation.target.getter")
- lazy val SetterTargetClass = getClass("scala.annotation.target.setter")
- lazy val BeanGetterTargetClass = getClass("scala.annotation.target.beanGetter")
- lazy val BeanSetterTargetClass = getClass("scala.annotation.target.beanSetter")
- lazy val ParamTargetClass = getClass("scala.annotation.target.param")
+ lazy val FieldTargetClass = getClass("scala.beans.meta.field")
+ lazy val GetterTargetClass = getClass("scala.beans.meta.getter")
+ lazy val SetterTargetClass = getClass("scala.beans.meta.setter")
+ lazy val BeanGetterTargetClass = getClass("scala.beans.meta.beanGetter")
+ lazy val BeanSetterTargetClass = getClass("scala.beans.meta.beanSetter")
+ lazy val ParamTargetClass = getClass("scala.beans.meta.param")
lazy val ScalaInlineClass = getClass("scala.inline")
lazy val ScalaNoInlineClass = getClass("scala.noinline")
lazy val SpecializedClass = getClass("scala.specialized")
diff --git a/src/compiler/scala/reflect/internal/StdNames.scala b/src/compiler/scala/reflect/internal/StdNames.scala
index 4947334c1e..eb17a13dd4 100644
--- a/src/compiler/scala/reflect/internal/StdNames.scala
+++ b/src/compiler/scala/reflect/internal/StdNames.scala
@@ -606,8 +606,8 @@ trait StdNames extends /*reflect.generic.StdNames with*/ NameManglers { self: Sy
}
private class J2SENames extends JavaNames {
- final val BeanProperty: TypeName = "scala.reflect.BeanProperty"
- final val BooleanBeanProperty: TypeName = "scala.reflect.BooleanBeanProperty"
+ final val BeanProperty: TypeName = "scala.beans.BeanProperty"
+ final val BooleanBeanProperty: TypeName = "scala.beans.BooleanBeanProperty"
final val Code: TypeName = "scala.reflect.Code"
final val JavaSerializable: TypeName = "java.io.Serializable"
}
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
index d7e2d92837..7f1dc1fbcd 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala
@@ -180,10 +180,10 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
val MethodHandleType = new JObjectType("java.dyn.MethodHandle")
// Scala attributes
- val BeanInfoAttr = definitions.getClass("scala.reflect.BeanInfo")
- val BeanInfoSkipAttr = definitions.getClass("scala.reflect.BeanInfoSkip")
- val BeanDisplayNameAttr = definitions.getClass("scala.reflect.BeanDisplayName")
- val BeanDescriptionAttr = definitions.getClass("scala.reflect.BeanDescription")
+ val BeanInfoAttr = definitions.getClass("scala.beans.BeanInfo")
+ val BeanInfoSkipAttr = definitions.getClass("scala.beans.BeanInfoSkip")
+ val BeanDisplayNameAttr = definitions.getClass("scala.beans.BeanDisplayName")
+ val BeanDescriptionAttr = definitions.getClass("scala.beans.BeanDescription")
lazy val CloneableClass = definitions.getClass("java.lang.Cloneable")
lazy val RemoteInterface = definitions.getClass("java.rmi.Remote")
@@ -443,7 +443,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
val beanInfoClass = fjbgContext.JClass(javaFlags(c.symbol),
javaName(c.symbol) + "BeanInfo",
- "scala/reflect/ScalaBeanInfo",
+ "scala/beans/ScalaBeanInfo",
JClass.NO_INTERFACES,
c.cunit.source.toString)
@@ -497,7 +497,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
// invoke the superclass constructor, which will do the
// necessary java reflection and create Method objects.
- jcode.emitINVOKESPECIAL("scala/reflect/ScalaBeanInfo", "<init>", conType)
+ jcode.emitINVOKESPECIAL("scala/beans/ScalaBeanInfo", "<init>", conType)
jcode.emitRETURN()
// write the bean information class file.
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