Nicolas Zozol
Nicolas Zozol

Reputation: 7038

Expecting a top-level declaration with Kotlin 1.3

I have a problem with some Kotlin code. The compiler 1.3 gives three errors :

But the intellij editor does not highlight it. In fact there is no code on the faulty lines !

enter image description here

package io.robusta.nikotor.core

import java.util.*
import java.util.concurrent.CompletableFuture

interface PersistedEvent<E, P> where E : Event<P> {
    val event: E
    val sequenceId: Long
    val technicalDate: Long
}


typealias Persisted = PersistedEvent<*,*>
typealias Events = List<Event<*>>
typealias PersistedEvents = List<PersistedEvent<*,*>>
​
abstract class AbstractPersistedEvent<E, P>(override val event: E)
    : PersistedEvent<E, P> where E : Event<P> {
    ​
    override val technicalDate = Date().time
}
​
object LocalSequence{
    private var localSequenceId = 0L
    fun next(): Long {
        localSequenceId++
        return localSequenceId
    }
}


class SequencePersisted<E, P>(event: E) : AbstractPersistedEvent<E, P>(event) where E : Event<P> {
    override val sequenceId = LocalSequence.next()
}


interface EventStore {
    fun <P> persist(event: Event<P>): CompletableFuture<PersistedEvent<*,*>>

    fun persistAll(events: Events): CompletableFuture<PersistedEvents>

    fun loadInitialEvents(): CompletableFuture<PersistedEvents>

    fun resetWith(events: Events): CompletableFuture<PersistedEvents>
}

Any idea ? The whole code can be seen at this commit : https://github.com/nicolas-zozol/nikotor/commit/45bc9747f9ff2d1c0e08d95aaea3f3fd682a7519#diff-41897c89e00b2524fa66d59b846776d3

Upvotes: 0

Views: 10512

Answers (1)

vanyochek
vanyochek

Reputation: 905

You have \u200b signs in your code. You have to delete them. enter image description here

Upvotes: 5

Related Questions