immutable top-level constant
Immutable
const immutable
Used to annotate a class C
. Indicates that C
and all subtypes of C
must be immutable.
A class is immutable if all of the instance fields of the class, whether
defined directly or inherited, are final
.
Tools, such as the analyzer, can provide feedback if
- the annotation is associated with anything other than a class, or
- a class that has this annotation or extends, implements or mixes in a class that has this annotation is not immutable.
Implementation
const Immutable immutable = Immutable();