constructorOnly

scala.annotation.constructorOnly

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
Graph
Supertypes
class Annotation
class Object
trait Matchable
class Any
In this article
  翻译: