There are also 2 more examples that come from Kotlin stdlib:
1. Kotlin provides ability for
creating your own DSLs. To make the DSL work consistently there are means to prevent some initial bad behaviour by declaring your own DSL marker and using it for your DSL. For example,
HtmlTagMarker in kotlinx.html.
2. There are cases when you have to show users of your library (code) that there are some issues in working with particular entities. Like in case when you deprecate something or in case when something is very delicate and should be used with caution. Then
opt-in requirements can help you. To use them you need to declare your own annotation and mark all the particular entities with it. For example,
DelicateCoroutineApi in kotlinx.coroutines.