From c470f8cca0fc646ba2f950302b9a2dfc515bff74 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Fri, 9 Feb 2007 19:09:06 +0000 Subject: renamed attributes to annotations; added @syntax. --- src/library/scala/Annotation.scala | 25 +++++++++++++++++++++++++ src/library/scala/Attribute.scala | 1 + src/library/scala/ClassfileAnnotation.scala | 22 ++++++++++++++++++++++ src/library/scala/SerialVersionUID.scala | 4 ++-- src/library/scala/StaticAnnotation.scala | 22 ++++++++++++++++++++++ src/library/scala/cloneable.scala | 4 ++-- src/library/scala/deprecated.scala | 4 ++-- src/library/scala/remote.scala | 4 ++-- src/library/scala/serializable.scala | 4 ++-- src/library/scala/throws.scala | 4 ++-- src/library/scala/transient.scala | 2 +- src/library/scala/unsealed.scala | 4 ++-- src/library/scala/volatile.scala | 2 +- 13 files changed, 86 insertions(+), 16 deletions(-) create mode 100644 src/library/scala/Annotation.scala create mode 100644 src/library/scala/ClassfileAnnotation.scala create mode 100644 src/library/scala/StaticAnnotation.scala (limited to 'src/library') diff --git a/src/library/scala/Annotation.scala b/src/library/scala/Annotation.scala new file mode 100644 index 0000000000..1618e6aed7 --- /dev/null +++ b/src/library/scala/Annotation.scala @@ -0,0 +1,25 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: Annotation.scala 9916 2007-02-07 13:07:33 +0000 (Wed, 07 Feb 2007) michelou $ + + +package scala + +/**

+ * A base class for annotations. Annotations extending this class directly + * are not preserved for the Scala type checker and are also not stored + * as Java annotations in classfiles. To enable either or both of these, + * one needs to inherit from StaticAnnotation or/and + * ClassfileAnnotation. + *

+ * + * @author Martin Odersky + * @version 1.1, 2/02/2007 + */ +abstract class Annotation extends Attribute /* for now, to enable bootstrapping */ {} diff --git a/src/library/scala/Attribute.scala b/src/library/scala/Attribute.scala index 4762e2cdf4..2542cc99e8 100644 --- a/src/library/scala/Attribute.scala +++ b/src/library/scala/Attribute.scala @@ -19,6 +19,7 @@ package scala * ClassfileAttribute. *

* + * @deprecated use Annotation instead * @author Martin Odersky * @version 1.1, 2/02/2007 */ diff --git a/src/library/scala/ClassfileAnnotation.scala b/src/library/scala/ClassfileAnnotation.scala new file mode 100644 index 0000000000..f3032c186c --- /dev/null +++ b/src/library/scala/ClassfileAnnotation.scala @@ -0,0 +1,22 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: ClassfileAnnotation.scala 9916 2007-02-07 13:07:33 +0000 (Wed, 07 Feb 2007) michelou $ + + +package scala + +/**

+ * A base class for classfile annotations. These are stored as + * Java annotations in classfiles. + *

+ * + * @author Martin Odersky + * @version 1.1, 2/02/2007 + */ +trait ClassfileAnnotation extends Annotation {} diff --git a/src/library/scala/SerialVersionUID.scala b/src/library/scala/SerialVersionUID.scala index 4467303067..d75a65a065 100644 --- a/src/library/scala/SerialVersionUID.scala +++ b/src/library/scala/SerialVersionUID.scala @@ -13,7 +13,7 @@ package scala /** - * Attribute for specifying the static SerialVersionUID field + * Annotation for specifying the static SerialVersionUID field * of a serializable class */ -class SerialVersionUID(uid: Long) extends Attribute +class SerialVersionUID(uid: Long) extends Annotation diff --git a/src/library/scala/StaticAnnotation.scala b/src/library/scala/StaticAnnotation.scala new file mode 100644 index 0000000000..5e39c2d689 --- /dev/null +++ b/src/library/scala/StaticAnnotation.scala @@ -0,0 +1,22 @@ +/* __ *\ +** ________ ___ / / ___ Scala API ** +** / __/ __// _ | / / / _ | (c) 2006-2007, LAMP/EPFL ** +** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** +** /____/\___/_/ |_/____/_/ | | ** +** |/ ** +\* */ + +// $Id: StaticAnnotation.scala 9916 2007-02-07 13:07:33 +0000 (Wed, 07 Feb 2007) michelou $ + + +package scala + +/**

+ * A base class for static annotations. These are available + * to the Scala type checker, even across different compilation units. + *

+ * + * @author Martin Odersky + * @version 1.1, 2/02/2007 + */ +trait StaticAnnotation extends Annotation {} diff --git a/src/library/scala/cloneable.scala b/src/library/scala/cloneable.scala index 5db2713132..aba6f72a33 100644 --- a/src/library/scala/cloneable.scala +++ b/src/library/scala/cloneable.scala @@ -13,6 +13,6 @@ package scala; /** - * An attribute that designates the class to which it is applied as cloneable + * An annotation that designates the class to which it is applied as cloneable */ -class cloneable extends Attribute {} +class cloneable extends Annotation {} diff --git a/src/library/scala/deprecated.scala b/src/library/scala/deprecated.scala index b642d92f8d..8006e90466 100755 --- a/src/library/scala/deprecated.scala +++ b/src/library/scala/deprecated.scala @@ -12,7 +12,7 @@ package scala /** - * An attribute that designates the definition to which it is applied as deprecated. + * An annotation that designates the definition to which it is applied as deprecated. * Access to the member then generates a deprecated warning. */ -class deprecated extends StaticAttribute {} +class deprecated extends StaticAnnotation {} diff --git a/src/library/scala/remote.scala b/src/library/scala/remote.scala index 590cce82a2..441eb45131 100644 --- a/src/library/scala/remote.scala +++ b/src/library/scala/remote.scala @@ -12,9 +12,9 @@ package scala /** - * An attribute that designates the class to which it is applied as remotable. + * An annotation that designates the class to which it is applied as remotable. * * @see Method $tag in trait * scala.ScalaObject. */ -class remote extends Attribute {} +class remote extends Annotation {} diff --git a/src/library/scala/serializable.scala b/src/library/scala/serializable.scala index ba6c1dd45b..f96c36a155 100644 --- a/src/library/scala/serializable.scala +++ b/src/library/scala/serializable.scala @@ -13,6 +13,6 @@ package scala /** - * An attribute that designates the class to which it is applied as serializable + * An annotation that designates the class to which it is applied as serializable */ -class serializable extends Attribute {} +class serializable extends Annotation {} diff --git a/src/library/scala/throws.scala b/src/library/scala/throws.scala index b9c23b6a5f..d8c6348920 100644 --- a/src/library/scala/throws.scala +++ b/src/library/scala/throws.scala @@ -12,7 +12,7 @@ package scala /** - * Attribute for specifying the exceptions thrown by a method. + * Annotation for specifying the exceptions thrown by a method. *

* Example: *

@@ -27,4 +27,4 @@ package scala * @author Nikolay Mihaylov * @version 1.0, 19/05/2006 */ -class throws(clazz: java.lang.Class) extends Attribute +class throws(clazz: java.lang.Class) extends Annotation diff --git a/src/library/scala/transient.scala b/src/library/scala/transient.scala index 024dccbf01..f3d03fd1d9 100644 --- a/src/library/scala/transient.scala +++ b/src/library/scala/transient.scala @@ -12,4 +12,4 @@ package scala; -class transient extends Attribute {} +class transient extends Annotation {} diff --git a/src/library/scala/unsealed.scala b/src/library/scala/unsealed.scala index 5ea51ae144..4379ea7971 100755 --- a/src/library/scala/unsealed.scala +++ b/src/library/scala/unsealed.scala @@ -12,7 +12,7 @@ package scala /** - * An attribute that gets applied to a selector in a match expression. + * An annotation that gets applied to a selector in a match expression. * If it is present, exhaustiveness warnings for that expression will be suppressed. */ -class unsealed extends Attribute {} +class unsealed extends Annotation {} diff --git a/src/library/scala/volatile.scala b/src/library/scala/volatile.scala index 3d40f25756..d8a1afcb68 100644 --- a/src/library/scala/volatile.scala +++ b/src/library/scala/volatile.scala @@ -12,4 +12,4 @@ package scala -class volatile extends Attribute +class volatile extends Annotation -- cgit v1.2.3