scala.annotation

Members list

Packages

Type members

Classlikes

A base trait for annotations that yield proper subtypes of the types they annotate. Refining annotations are more "sticky" than normal ones. They are conceptually kept around when normal refinements would also not be stripped away.

A base trait for annotations that yield proper subtypes of the types they annotate. Refining annotations are more "sticky" than normal ones. They are conceptually kept around when normal refinements would also not be stripped away.

Attributes

Source
RefiningAnnotation.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any

An annotation that goes on parameters of classes or traits. It asserts that the parameter is used only for initialization and is not kept in the class as a field. Violations of this assertion are flagged as compile errors. The annotation is particularly useful for implicit parameters since for these a textual scan is not sufficient to know where they are used. Note: the annotation is copied from constructor parameters to corresponding class fields. But it is checked that the field is eliminated before code is generated.

An annotation that goes on parameters of classes or traits. It asserts that the parameter is used only for initialization and is not kept in the class as a field. Violations of this assertion are flagged as compile errors. The annotation is particularly useful for implicit parameters since for these a textual scan is not sufficient to know where they are used. Note: the annotation is copied from constructor parameters to corresponding class fields. But it is checked that the field is eliminated before code is generated.

Attributes

Source
constructorOnly.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any

An annotation that can be used to mark a definition as experimental.

An annotation that can be used to mark a definition as experimental.

Attributes

See also
Source
experimental.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class static extends StaticAnnotation

https://github.com/scala/scala.github.com/pull/491

Attributes

Source
static.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class targetName(name: String) extends StaticAnnotation

An annotation that defines an external name for a definition. If an targetName(extname) annotation is given for a method or some other definition, its implementation will use the name extname instead of the regular name.

An annotation that defines an external name for a definition. If an targetName(extname) annotation is given for a method or some other definition, its implementation will use the name extname instead of the regular name.

Attributes

Source
targetName.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class threadUnsafe extends StaticAnnotation

This annotation can only be used on a field which defines a lazy val. When this annotation is used, the initialization of the lazy val will use a faster mechanism which is not thread-safe.

This annotation can only be used on a field which defines a lazy val. When this annotation is used, the initialization of the lazy val will use a faster mechanism which is not thread-safe.

Attributes

Source
threadUnsafe.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class transparentTrait extends StaticAnnotation

An annotation that can be used from Scala 2 to mark a trait as transparent. Scala 3 code would use the modifier transparent instead. Transparent traits are not inferred when combined with other types in an intersection. See reference/other-new-features/transparent-traits.html for details.

An annotation that can be used from Scala 2 to mark a trait as transparent. Scala 3 code would use the modifier transparent instead. Transparent traits are not inferred when combined with other types in an intersection. See reference/other-new-features/transparent-traits.html for details.

Attributes

Source
transparentTrait.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any

Deprecated classlikes

final class alpha(externalName: String) extends StaticAnnotation

An annotation that defines an external name for a definition. If an alpha(extname) annotation is given for a method or some other definition, its implementation will use the name extname instead of the regular name. An alpha annotation is mandatory for definitions with symbolic names.

An annotation that defines an external name for a definition. If an alpha(extname) annotation is given for a method or some other definition, its implementation will use the name extname instead of the regular name. An alpha annotation is mandatory for definitions with symbolic names.

Attributes

Deprecated
true
Source
alpha.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any

Experimental classlikes

Base trait for macro annotation implementation. Macro annotations can transform definitions and add new definitions.

Base trait for macro annotation implementation. Macro annotations can transform definitions and add new definitions.

See: MacroAnnotation.transform

Attributes

Experimental
true
Source
MacroAnnotation.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class capability extends StaticAnnotation

Marks an annotated class as a capability. If the annotation is present and -Ycc is set, any (possibly aliased or refined) instance of the class type is implicitly augmented with the universal capture set. Example

Marks an annotated class as a capability. If the annotation is present and -Ycc is set, any (possibly aliased or refined) instance of the class type is implicitly augmented with the universal capture set. Example

Attributes

Experimental
true
Source
capability.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
object init

Annotations to control the behavior of the compiler check for safe initialization of static obects.

Annotations to control the behavior of the compiler check for safe initialization of static obects.

Programmers usually do not need to use any annotations. They are intended for complex initialization code in static objects.

Attributes

Experimental
true
Source
init.scala
Supertypes
class Object
trait Matchable
class Any
Self type
init.type
class into() extends StaticAnnotation

An annotation on (part of) a parameter type that allows implicit conversions for its arguments. The into modifier on parameter types in Scala 3 is mapped to this annotation. The annotation is intended to be used directly in Scala 2 sources only. For Scala 3, the into modifier should be preferred.

An annotation on (part of) a parameter type that allows implicit conversions for its arguments. The into modifier on parameter types in Scala 3 is mapped to this annotation. The annotation is intended to be used directly in Scala 2 sources only. For Scala 3, the into modifier should be preferred.

Attributes

Experimental
true
Source
into.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
final class publicInBinary extends StaticAnnotation

A binary API is a definition that is annotated with @publicInBinary. This annotation can be placed on def, val, lazy val, var, class constructors, object, and given definitions. A binary API will be publicly available in the bytecode. Tools like TASTy MiMa will take this into account to check compatibility.

A binary API is a definition that is annotated with @publicInBinary. This annotation can be placed on def, val, lazy val, var, class constructors, object, and given definitions. A binary API will be publicly available in the bytecode. Tools like TASTy MiMa will take this into account to check compatibility.

This annotation cannot be used on private/private[this] definitions.

@publicInBinary can be used to guarantee access to private[T]/protected definitions:

  • within inline definitions,
  • against previous binary where this definitions was public or less private,
  • or through JVM reflection.

Removing this annotation from a non-public definition is a binary incompatible change. Adding this annotation to a non-public definition can also cause binary incompatibilities if the definition is accessed in an inline definition (these can be checked using -WunstableInlineAccessors).

Attributes

Experimental
true
Source
publicInBinary.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
class retains(xs: Any*) extends StaticAnnotation

An annotation that indicates capture of a set of references under -Ycc.

An annotation that indicates capture of a set of references under -Ycc.

T @retains(x, y, z)

is the internal representation used for the capturing type

{x, y, z}  T

The annotation can also be written explicitly if one wants to avoid the non-standard capturing type syntax.

Attributes

Experimental
true
Source
retains.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
class retainsByName(xs: Any*) extends StaticAnnotation

An annotation that indicates capture of an enclosing by-name type

An annotation that indicates capture of an enclosing by-name type

Attributes

Experimental
true
Source
retainsByName.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any
class retainsCap() extends StaticAnnotation

Equivalent in meaning to @retains(cap), but consumes less bytecode.

Equivalent in meaning to @retains(cap), but consumes less bytecode.

Attributes

Experimental
true
Source
retains.scala
Supertypes
class Annotation
class Object
trait Matchable
class Any