Jetty annotation processing error

When I’m trying to compile the code below I’m getting org.eclipse.jetty.websocket.api.InvalidWebSocketException.

Exception in thread "Thread-1" org.eclipse.jetty.websocket.api.InvalidWebSocketException:
***.ws.impl.JettyWebSocketImpl$createSocket$1 is not a valid WebSocket object.  Object must obey one of the following rules: 
(1) class implements org.eclipse.jetty.websocket.api.WebSocketListener or 
(2) class is annotated with @org.eclipse.jetty.websocket.api.annotations.WebSocket
    at org.eclipse.jetty.websocket.common.events.EventDriverFactory.wrap(EventDriverFactory.java:147)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.<init>(WebSocketUpgradeRequest.java:413)
    at org.eclipse.jetty.websocket.client.WebSocketUpgradeRequest.<init>(WebSocketUpgradeRequest.java:372)
    at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:361)
    at org.eclipse.jetty.websocket.client.WebSocketClient.connect(WebSocketClient.java:299)
    ***.JettyWebSocketImpl.connect(JettyWebSocketImpl.kt:22)
    ***
    at java.lang.Thread.run(Thread.java:745)

import org.eclipse.jetty.websocket.api.Session
import org.eclipse.jetty.websocket.api.annotations.*
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest
import org.eclipse.jetty.websocket.client.WebSocketClient

@WebSocket
abstract class JettyWebSocket { ... }

class JettyWebSocketImpl {
    private var socket: JettyWebSocket? = null
    private var client: WebSocketClient? = null

    fun connect(server: URI) {
        socket = object : JettyWebSocket() { ... }
        client = WebSocketClient()
        val request = ClientUpgradeRequest()
        client?.start()
        client?.connect(socket, server, request)
    }
}