Note: information on this page refers to Ceylon 1.0, not to the current release.
final
annotation
The final
annotation marks a class as not having subclasses.
Usage
final class Example() {
}
Description
Advice
Apart from annotation classes, most classes are not typically
annotated final
. The semantics of the formal
, default
and
actual
annotations are intended so that the author of a class
or interface decides which members may be refined. It shouldn't
be possible for it to be broken by a subclasses, because the
subclass can only refine those members it is explicitly permitted
to refine.
However, the final
annotation is occasionally useful to allow
the compiler to detect that two types are
disjoint.
See also
- API documentation for
final
- Reference for annotations in general
- Disjoint types in the Ceylon language spec