Fix state conversion, fix tests

This commit is contained in:
Ilya Chernikov
2017-02-06 17:18:42 +01:00
parent c5bc58ad32
commit 7b2ea001c1
12 changed files with 83 additions and 91 deletions
@@ -26,7 +26,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock
// TODO: reduce number of ports used then SOCKET_ANY_FREE_PORT is passed (same problem with other calls)
open class KotlinRemoteReplClient(
open class KotlinRemoteReplCompilerClient(
protected val compileService: CompileService,
clientAliveFlagFile: File?,
targetPlatform: CompileService.TargetPlatform,
@@ -68,8 +68,8 @@ open class KotlinRemoteReplClient(
RemoteReplCompilerState(compileService.replCreateState(sessionId).get(), lock)
override fun check(state: IReplStageState<*>, codeLine: ReplCodeLine): ReplCheckResult =
compileService.replCheck(sessionId, state.asState<RemoteReplCompilerState>().replStateFacade.id, codeLine).get()
compileService.replCheck(sessionId, state.asState(RemoteReplCompilerState::class.java).replStateFacade.id, codeLine).get()
override fun compile(state: IReplStageState<*>, codeLine: ReplCodeLine): ReplCompileResult =
compileService.replCompile(sessionId, state.asState<RemoteReplCompilerState>().replStateFacade.id, codeLine).get()
compileService.replCompile(sessionId, state.asState(RemoteReplCompilerState::class.java).replStateFacade.id, codeLine).get()
}
@@ -151,7 +151,7 @@ open class KotlinJvmReplService(
fun createRemoteState(port: Int = portForServers): RemoteReplStateFacadeServer = statesLock.write {
val id = getValidId(stateIdCounter) { id -> states.none { it.key.id == id} }
val stateFacade = RemoteReplStateFacadeServer(id, createState().asState<GenericReplCompilerState>(), port)
val stateFacade = RemoteReplStateFacadeServer(id, createState().asState(GenericReplCompilerState::class.java), port)
states.put(stateFacade, true)
stateFacade
}