https://kotlinlang.org logo
#ktlint
Title
# ktlint
z

zak.taccardi

03/01/2023, 3:10 AM
Is reformatting:
Copy code
import kotlinx.coroutines.CoroutineScope

internal abstract class MyParentClass(
    string: String
)

internal class MyChildClass(
    scope: CoroutineScope
) : MyParentClass(
    "hello"
), CoroutineScope by scope
to be:
Copy code
import kotlinx.coroutines.CoroutineScope

internal abstract class MyParentClass(
    string: String
)

internal class MyChildClass(
    scope: CoroutineScope
) : MyParentClass(
    "hello"
),
    CoroutineScope by scope
a bug? the error is
Missing newline after ","
and violates the
wrapping
rule
p

Paul Dingemans

03/01/2023, 6:54 PM
Tnx for filing the bug. Will have a look in coming days.
What is your opinion about formatting generic types having multiple annotations? Please provide your input in https://github.com/pinterest/ktlint/issues/1725. The remark of the issuer was that code below:
Copy code
data class FooRequestDto(
    val data: List<@Valid @NotNull FooDto>,
)
is formatted by ktlint as:
Copy code
data class FooRequestDto(
    val data: List<@Valid @NotNull
    FooDto,>,
)
Of course it should be clear that I totally agree with that. In the issue, I have proposed to format this like:
Copy code
data class FooRequestDto(
    val data: List<
        @Valid
        @NotNull
        FooDto,
    >,
)
Please, add your remarks or counter proposals in the issue. Thanks!
28 Views