Plankalkül
Plankalkül

Reputation: 843

Scala Annotation List?

I wanted to ask if there is a list of annotations for Scala 2.8.0? I stumbled upon @inline and @specialized but it would be nice if there is a complete list which also explains what they do exactly.

If such a list doesn't exist: Are there some annotations one should be familiar with?

Upvotes: 8

Views: 1227

Answers (4)

cayhorstmann
cayhorstmann

Reputation: 3371

It's easy enough to get a list of all Scala annotations. Just go to http://www.scala-lang.org/api/current/scala/annotation/Annotation.html and click on "Known subclasses". Today, I get

BeanDescription, BeanDisplayName, BeanInfo, BeanInfoSkip, BeanProperty, BooleanBeanProperty, ClassfileAnnotation, SerialVersionUID, StaticAnnotation, TypeConstraint, beanGetter, beanSetter, cloneable, cpsParam, deprecated, deprecatedName, elidable, field, getter, implicitNotFound, inline, native, noinline, param, remote, serializable, setter, specialized, strictfp, switch, tailrec, throws, transient, unchecked, uncheckedStable, uncheckedVariance, varargs, volatile

Upvotes: 3

Alain O'Dea
Alain O'Dea

Reputation: 21686

Tour of Scala Annotations: http://www.scala-lang.org/node/106

Internals of Scala Annotations: http://www.scala-lang.org/sid/5

The tour is out of date now. There are several more annotations built into Scala now.

The Known Subclasses section of the Scaladoc for scala.annotation.Annotation provides a fairly significant list (below is as of 2.12.1):

SerialVersionUID, ClassfileAnnotation, StaticAnnotation, TypeConstraint, compileTimeOnly, elidable, implicitAmbiguous, implicitNotFound, beanGetter, beanSetter, companionClass, companionMethod, companionObject, field, getter, languageFeature, param, setter, strictfp, switch, tailrec, uncheckedStable, uncheckedVariance, unspecialized, varargs, BeanDescription, BeanDisplayName, BeanInfoSkip, BeanProperty, BooleanBeanProperty, deprecated, deprecatedInheritance, deprecatedName, deprecatedOverriding, inline, native, noinline, specialized, throws, transient, unchecked, volatile, BeanInfo, remote

SOURCE: http://www.scala-lang.org/api/current/scala/annotation/Annotation.html

Upvotes: 7

Joseph Lust
Joseph Lust

Reputation: 19985

See exhaustive annotation list for Scala 2.12+. Head link, will stay up to date.

Upvotes: 1

Plankalkül
Plankalkül

Reputation: 843

To answer my own question:

The official "The Scala Language Specification Version 2.8" actually also has a nice list of annotations in it with some explanation. (Chapter 11, page 133ff.)

Although for example @inline isn't listed there. So it seems not to be complete either.

Upvotes: 1

Related Questions