You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/md/kotlin.core/annotations.md
+50-50Lines changed: 50 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Values of annotation types cannot be created directly, but can be operated on wh
7
7
### Annotation values
8
8
9
9
An annotation value is a value of a special [annotation type][Annotation declarations].
10
-
An annotation type is a special kind of class type which is allowed to include properties of the following types:
10
+
An annotation type is a special kind of class type which is allowed to include read-only properties of the following types:
11
11
12
12
-[Integer types][Built-in integer types];
13
13
-[Enum types][Enum class declaration];
@@ -16,24 +16,24 @@ An annotation type is a special kind of class type which is allowed to include p
16
16
-[Arrays][Array types] of any type listed above.
17
17
18
18
Annotation classes are not allowed to have any member functions, constructors or mutable properties.
19
-
They are also not allowed to have base classes and are considered to be implicitly derived from `kotlin.Annotation`.
19
+
They are also not allowed to have declared supertypes and are considered to be implicitly derived from `kotlin.Annotation`.
20
20
21
21
### Annotation retention
22
22
23
-
The retention level of an annotation declares which compilation artifacts a particular compiler on a particular platform *retain* this kind of annotation.
23
+
The retention level of an annotation declares which compilation artifacts (for a particular compiler on a particular platform)*retain* this kind of annotation.
24
24
There are the following types of retention available:
25
25
26
26
- Source retention (accessible by source-processing tools);
27
27
- Binary retention (retained in compilation artifacts);
28
28
- Runtime retention (accessible at runtime).
29
29
30
-
Each subsequent level inherits what is accessible on the previous levels.
30
+
>Each subsequent level inherits what is accessible on the previous levels.
31
31
32
-
For availability and particular ways of accessing the metadata specified by these annotations please refer to the corresponding platforms' documentation.
32
+
For availability and particular ways of accessing the metadata specified by these annotations please refer to the corresponding platform-specific documentation.
33
33
34
34
### Annotation targets
35
35
36
-
The *targets* of a particular type of annotations is the kind of program entity which this annotations may be placed on.
36
+
The *target* of a particular type of annotations is the kind of program entity which this annotations may be placed on.
37
37
There are the following targets available:
38
38
39
39
- A [class declaration][Class declaration] (including annotation classes);
@@ -65,27 +65,33 @@ TODO(Anything else?)
65
65
66
66
*`kotlin.annotation.Retention`
67
67
68
-
`kotlin.annotation.Retention` is an annotation that is only used in annotation classes to specify annotation retention.
68
+
`kotlin.annotation.Retention` is an annotation which is only used on annotation classes to specify their annotation retention level.
69
69
It has the following single field:
70
-
```kotlin
71
-
val value:AnnotationRetention=AnnotationRetention.RUNTIME
72
-
```
70
+
71
+
*```kotlin
72
+
val value:AnnotationRetention=AnnotationRetention.RUNTIME
73
+
```
74
+
75
+
The retention level of the annotated annotation.
73
76
74
-
`kotlin.annotation.AnnotationRetention` is an enum class with the following values (see [annotation targets section][Annotation targets] for details):
77
+
`kotlin.annotation.AnnotationRetention` is an enumclasswith the following values (see [Annotation retention section][Annotationretention] for details):
75
78
76
79
* `SOURCE`;
77
80
* `BINARY`;
78
81
* `RUNTIME`.
79
82
80
83
* `kotlin.annotation.Target`
81
84
82
-
`kotlin.annotation.Target` is an annotation that is only used in annotation classes to specify targets this annotation is valid for.
85
+
`kotlin.annotation.Target` is an annotationwhichis only used onannotation classes to specify targets those annotations are valid for.
83
86
It has the following single field:
84
-
```kotlin
85
-
vararg val allowedTargets:AnnotationTarget
86
-
```
87
87
88
-
`kotlin.annotation.AnnotationTarget` is an enum class with the following values (see [annotation retention section][Annotation retention] for details):
88
+
* ```kotlin
89
+
vararg val allowedTargets:AnnotationTarget
90
+
```
91
+
92
+
The allowed annotation targets of the annotated annotation.
93
+
94
+
`kotlin.annotation.AnnotationTarget` is an enumclasswith the following values (see [Annotation targets section][Annotation targets] for details):
89
95
90
96
* `CLASS`;
91
97
* `ANNOTATION_CLASS`;
@@ -105,7 +111,7 @@ TODO(Anything else?)
105
111
106
112
* `kotlin.annotation.Repeatable`
107
113
108
-
`kotlin.annotation.Repeatable` is an annotation that is only used in annotation classes to specify whether this particular annotation is repeatable.
114
+
`kotlin.annotation.Repeatable` is an annotationwhichis only used onannotation classes to specify whether this particular annotationis repeatable.
The severity level of the experimental status with two values: `Level.WARNING` and `Level.ERROR`
125
+
The severity level of the experimental status with two possible values: `Level.WARNING` and `Level.ERROR`.
120
126
121
127
Thisannotationis used to introduce implementation-defined experimental language or standard library features.
128
+
122
129
`kotlin.UseExperimental` is an annotationclasswith a single field:
123
130
124
131
* ```kotlin
125
132
vararg val markerClass:KClass<outAnnotation>
126
133
```
127
134
128
-
The classes thisannotationis allowing to use
135
+
The classes which thisannotationallows to use.
129
136
130
-
Thisannotationis used to explicitly mark declarations that use experimental features marked by `kotlin.Experimental`.
137
+
Thisannotationis used to explicitly mark declarations which use experimental features marked by `kotlin.Experimental`.
131
138
132
-
Itis implementation-defined on how these annotations are processed.
139
+
Itis implementation-defined how thisannotationis processed.
133
140
134
-
TODO(experimental status is still experimental itself)
141
+
TODO(Experimental status is still experimental itself)
135
142
136
143
* `kotlin.Deprecated` / `kotlin.ReplaceWith`
137
144
@@ -141,19 +148,19 @@ TODO(Anything else?)
141
148
val message:String
142
149
```
143
150
144
-
The message supporting the deprecation
151
+
A message supporting the deprecation.
145
152
146
153
* ```kotlin
147
154
val replaceWith:ReplaceWith=ReplaceWith("")
148
155
```
149
156
150
-
An optional replacement for deprecated code
157
+
An optional replacement forthe deprecated code.
151
158
152
159
* ```kotlin
153
160
val level:DeprecationLevel=DeprecationLevel.WARNING
154
161
```
155
162
156
-
The deprecation level
163
+
The deprecation level with three possible values: `DeprecationLevel.WARNING`, `DeprecationLevel.ERROR` and `DeprecationLevel.HIDDEN`.
157
164
158
165
`kotlin.ReplaceWith` is itself an annotationclasscontaining the information on how to perform the replacement in case it is provided.
159
166
It has the following fields:
@@ -162,21 +169,19 @@ TODO(Anything else?)
162
169
val expression:String
163
170
```
164
171
165
-
The replacement code
172
+
The replacement code.
166
173
167
174
* ```kotlin
168
175
vararg val imports:String
169
176
```
170
177
171
-
The array of imports needed for the replacement code to work correctly
178
+
An array of imports needed for the replacement code to work correctly.
172
179
173
-
`kotlin.DeprecationLevel` is an enumclasswith three values: `WARNING`, `ERROR` and `HIDDEN`.
180
+
`kotlin.Deprecated` is a built-inannotation supporting the deprecation cycle for declarations: marking some declarations as outdated, soon to be replaced with other declarations, ornot recommended for use.
181
+
Itis implementation-defined how thisannotationis processed, with the following recommendations:
174
182
175
-
`kotlin.Deprecated` is a builtin annotation supporting the deprecation cycle for declarations: marking that some declarations are outdated, soon to be replaced with other declarations ornot recommended.
176
-
Itis implementation-defined how thisannotationis handled, with the following recommendations:
177
-
178
-
*Attempting to use a declaration with deprecation level of `kotlin.DeprecationLevel.WARNING` should produce a compile-time warning;
179
-
*Attempting to use a declaration with deprecation level of `kotlin.DeprecationLevel.ERROR` should produce a compile-time error.
183
+
*Attempting to use a declaration with deprecation level of `DeprecationLevel.WARNING` should produce a compile-time warning;
184
+
*Attempting to use a declaration with deprecation level of `DeprecationLevel.ERROR` should produce a compile-time error.
180
185
181
186
* `kotlin.Suppress`
182
187
@@ -186,10 +191,10 @@ TODO(Anything else?)
186
191
vararg val names:String
187
192
```
188
193
189
-
The names of features thisannotationis suppressing
194
+
The names of features thisannotationis suppressing.
190
195
191
196
`kotlin.Suppress` is used to optionally mark any piece of code as suppressing some language feature, such as a compiler warning, an IDE mechanism or a language feature.
192
-
The names of features that one can suppress with thisannotationis implementation-defined, asis the processing of thisannotation itself.
197
+
The names of features which one can suppress with thisannotationare implementation-defined, asis the processing of thisannotation itself.
193
198
194
199
* `kotlin.SinceKotlin`
195
200
@@ -199,32 +204,27 @@ TODO(Anything else?)
199
204
val version:String
200
205
```
201
206
202
-
The version of Kotlin language
207
+
The version of Kotlin language.
203
208
204
-
`kotlin.SinceKotlin` is used to mark that a specific declaration is only available since some particular version of the languageand above it.
209
+
`kotlin.SinceKotlin` is used to mark a declaration which is only available since a particular version of the language.
205
210
These mostly refer to standard library declarations.
206
-
Itis implementation-defined how thisannotations are processed.
211
+
Itis implementation-defined how thisannotationis processed.
207
212
208
213
* `kotlin.UnsafeVariance`
209
214
210
-
`kotlin.UnsafeVariance` is an annotationclasswith no fields that is only applicable to types.
211
-
Anydeclaration marked by thisannotation explicitly states that the [variance][Type parameter variance] errors arising forthis particular type are to be ignored by the compiler.
215
+
`kotlin.UnsafeVariance` is an annotationclasswith no fields which is only applicable to types.
216
+
Anytype instance marked by thisannotation explicitly states that the [variance][Type parameter variance] errors arising forthis particular type instance are to be ignored by the compiler.
212
217
213
218
* `kotlin.DslMarker`
214
219
215
-
`kotlin.DslMarker` is an annotationclasswith no fields that is applicable only to other annotation classes.
220
+
`kotlin.DslMarker` is an annotationclasswith no fields which is applicable only to other annotation classes.
216
221
Anannotationclassannotated with `kotlin.DslMarker` is marked as a marker of a specific DSL (domain-specific language).
217
222
Any type annotated with such a marker is said to belong to that specific DSL.
218
223
This affects [overload resolution][Overload resolution] in the following way: no two implicit receivers with types belonging to the same DSL are available in the same scope.
219
-
See [overload resolution section][Overload resolution] for details.
220
-
221
-
TODO(sync with receivers???)
224
+
See [Overload resolution section][Receivers] for details.
222
225
223
226
* `kotlin.PublishedApi`
224
227
225
-
`kotlin.PublishedApi` is an annotationclasswith no fields that is applicable to any declarations.
226
-
This may be applied to any declarations with `internal` visibility to be visible to `public` `inline` declarations.
227
-
See [the visibility section][Declaration visibility] for details.
228
-
229
-
230
-
228
+
`kotlin.PublishedApi` is an annotationclasswith no fields which is applicable to any declaration.
229
+
It may be applied to any declaration with `internal` visibility to make it available to `public` `inline` declarations.
230
+
See [Declaration visibility section][Declaration visibility] for details.
Copy file name to clipboardExpand all lines: docs/src/md/kotlin.core/overload-resolution.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,8 @@ The available receivers are prioritized in the following way:
40
40
41
41
> Important: these rules mean implicit receivers are always totally ordered w.r.t. their priority, as no two implicit receivers can have the same priority.
42
42
43
+
> Important: DSL-specific annotations (marked with [`kotlin.DslMarker`][Built-in annotations] annotation) change the availability of implicit receivers in the following way: for all types marked with a particular DSL-specific annotation, only the highest priority implicit receiver is available in a given scope.
44
+
43
45
The implicit receiver having the highest priority is also called the _default implicit receiver_.
44
46
The default implicit receiver is available in a scope as `this`.
45
47
Other available receivers may be accessed using [labeled this-expressions][This-expressions].
0 commit comments