Skip to content

Expected annotation target before ':' #2607

@JordanLongstaff

Description

@JordanLongstaff

I've got a number of classes with annotations on constructor parameters like this:

sealed class ConnectionStatus(
    @all:StringRes val stringId: Int,
    @all:ColorRes val color: Int,
    val spinnerVisibility: Int = View.GONE,
) {
    data object NotConnected : ConnectionStatus(R.string.not_connected, R.color.notConnected)

    data object Connecting :
        ConnectionStatus(R.string.connecting, R.color.connecting, View.VISIBLE)

    data object Connected : ConnectionStatus(R.string.connected, R.color.connected)

    data object Failed : ConnectionStatus(R.string.failed_to_connect, R.color.failedToConnect)

    data object HeartbeatLost : ConnectionStatus(R.string.connection_lost, R.color.heartbeatLost)
}

They're causing false errors in the ktlint and ktfmt formatters:

  src/main/kotlin/artemis/agent/ConnectionStatus.kt:L8 ktlint(ktlint) Expected annotation target before ':'
  src/main/kotlin/artemis/agent/ConnectionStatus.kt:L8 ktfmt(ktfmt) error: Expected annotation target before ':'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions