This page is not yet available in Spanish. We are working on its translation.
If you have any questions or feedback about our current translation project, feel free to reach out to us!

Metadata

ID: kotlin-code-style/double-colon-spacing

Language: Kotlin

Severity: Notice

Category: Code Style

Description

In callable references, there should be no spaces separating the class, instance, method, or property from the double colons (::).

An expression like List::filter is correct, while List :: filter is not.

Non-Compliant Code Examples

val clz1 = Foo ::class
val clz2 = Foo:: class
val clz3 = Foo :: class

val filter1 = List ::filter
val filter2 = List:: filter
val filter3 = List :: filter

val constr = :: Regex

Compliant Code Examples

val filter = List::filter
val clz = Foo::class
val constr = ::Regex
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Integraciones sin problemas. Prueba Datadog Code Security

PREVIEWING: guillaume.barrier/ERRORT-5095-general-doc-update