Skip to content

Commit

Permalink
Contract: improved documentation for mutates parameter; unmark it as …
Browse files Browse the repository at this point in the history
…experimental
  • Loading branch information
amaembo committed Oct 1, 2024
1 parent 3d7f14f commit 5a4e1b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/commonMain/kotlin/org/jetbrains/annotations/Contract.kt
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ expect annotation class Contract(
* <tr><td>"this,param1"</td><td>Method mutates the receiver and first argument and doesn't mutate any other arguments</td></tr>
</table> *
*
* **Warning: This annotation parameter is experimental and may be changed or removed without further notice!**
* @return a mutation specifier string
*/
@get:ApiStatus.Experimental @get:NonNls val mutates: String = ""
@get:NonNls val mutates: String = ""
)
9 changes: 5 additions & 4 deletions src/jvmMain/java/org/jetbrains/annotations/Contract.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,17 @@
* Contains a specifier which describes which method parameters can be mutated during the method call.
* <table>
* <caption>Possible values:</caption>
* <tr><td>"this"</td><td>Method mutates the receiver object, and doesn't mutates any objects passed as arguments (cannot be applied for static method or constructor)</td></tr>
* <tr><td>"param"</td><td>Method mutates the sole argument and doesn't mutate the receiver object (if applicable)</td></tr>
* <tr><td>"this"</td><td>Method mutates the receiver object, and doesn't mutate any objects passed as arguments (cannot be applied for static method or constructor)</td></tr>
* <tr><td>"param"</td><td>Method mutates the sole argument and doesn't mutate the receiver object (if applicable) or anything else</td></tr>
* <tr><td>"param1", "param2", ...</td><td>Method mutates the N-th argument</td></tr>
* <tr><td>"this,param1"</td><td>Method mutates the receiver and first argument and doesn't mutate any other arguments</td></tr>
* <tr><td>"io"</td><td>Method performs input/output changing the outer world but does not mutate any observable program state</td></tr>
* <tr><td>"this,param1"</td><td>Method mutates the receiver and first argument and doesn't mutate any other arguments or observable program state</td></tr>
* <tr><td>"io,this"</td><td>Method performs input/output changing the outer world and mutates the receiver, but doesn't mutate any arguments or observable program state</td></tr>
* </table>
*
* <strong>Warning: This annotation parameter is experimental and may be changed or removed without further notice!</strong>
* @return a mutation specifier string
*/
@ApiStatus.Experimental
@NonNls
String mutates() default "";
}
3 changes: 1 addition & 2 deletions src/nonJvmMain/kotlin/org/jetbrains/annotations/Contract.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ actual annotation class Contract(
* <tr><td>"this,param1"</td><td>Method mutates the receiver and first argument and doesn't mutate any other arguments</td></tr>
</table> *
*
* **Warning: This annotation parameter is experimental and may be changed or removed without further notice!**
* @return a mutation specifier string
*/
@get:ApiStatus.Experimental @get:NonNls actual val mutates: String = ""
@get:NonNls actual val mutates: String = ""
)

0 comments on commit 5a4e1b6

Please sign in to comment.