From 2608521462f8233ef0dfcbd5b20efb2df1db823a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 28 Sep 2015 12:52:38 +0200 Subject: [PATCH] cleanup --- .../jetbrains/debugger/DebugProcessImpl.kt | 27 +++++++++---------- .../debugger/LineBreakpointManager.kt | 14 +++++----- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt index 00a9764f3f96..1fa8d95505e9 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/DebugProcessImpl.kt @@ -35,7 +35,6 @@ import org.jetbrains.debugger.connection.VmConnection import org.jetbrains.debugger.frame.SuspendContextImpl import java.util.concurrent.ConcurrentMap import java.util.concurrent.atomic.AtomicBoolean -import kotlin.properties.Delegates public abstract class DebugProcessImpl>(session: XDebugSession, public val connection: C, @@ -52,7 +51,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi public var processBreakpointConditionsAtIdeSide: Boolean = false - private val _breakpointHandlers: Array> by Delegates.lazy { createBreakpointHandlers() } + private val _breakpointHandlers: Array> by lazy(LazyThreadSafetyMode.NONE) { createBreakpointHandlers() } init { connection.addListener(object : SocketConnectionListener { @@ -62,13 +61,13 @@ public abstract class DebugProcessImpl>(session: XDebugSessi if (status == ConnectionStatus.DETACHED) { if (realProcessHandler != null) { // here must we must use effective process handler - getProcessHandler().detachProcess() + processHandler.detachProcess() } } getSession().stop() } ConnectionStatus.CONNECTION_FAILED -> { - getSession().reportError(status.getStatusText()) + getSession().reportError(status.statusText) getSession().stop() } else -> { @@ -80,7 +79,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi } protected final val realProcessHandler: ProcessHandler? - get() = executionResult?.getProcessHandler() + get() = executionResult?.processHandler override final fun getSmartStepIntoHandler() = smartStepIntoHandler @@ -94,7 +93,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi protected abstract fun createBreakpointHandlers(): Array> private fun updateLastCallFrame() { - lastCallFrame = vm?.getSuspendContextManager()?.getContext()?.getTopFrame() + lastCallFrame = vm?.getSuspendContextManager()?.context?.topFrame } override final fun checkCanPerformCommands() = vm != null @@ -136,7 +135,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi protected final fun continueVm(stepAction: StepAction) { val suspendContextManager = vm!!.getSuspendContextManager() if (stepAction === StepAction.CONTINUE) { - if (suspendContextManager.getContext() == null) { + if (suspendContextManager.context == null) { // on resumed we ask session to resume, and session then call our "resume", but we have already resumed, so, we don't need to send "continue" message return } @@ -157,7 +156,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi } protected final fun processBreakpoint(suspendContext: SuspendContext, breakpoint: XBreakpoint<*>, xSuspendContext: SuspendContextImpl) { - val condition = breakpoint.getConditionExpression()?.getExpression() + val condition = breakpoint.conditionExpression?.expression if (!processBreakpointConditionsAtIdeSide || condition == null) { processBreakpointLogExpressionAndSuspend(breakpoint, xSuspendContext, suspendContext) } @@ -182,7 +181,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi } private fun processBreakpointLogExpressionAndSuspend(breakpoint: XBreakpoint<*>, xSuspendContext: SuspendContextImpl, suspendContext: SuspendContext) { - val logExpression = breakpoint.getLogExpressionObject()?.getExpression() + val logExpression = breakpoint.logExpressionObject?.expression if (logExpression == null) { breakpointReached(breakpoint, null, xSuspendContext) } @@ -202,7 +201,7 @@ public abstract class DebugProcessImpl>(session: XDebugSessi } private fun breakpointReached(breakpoint: XBreakpoint<*>, evaluatedLogExpression: String?, suspendContext: XSuspendContext) { - if (getSession().breakpointReached(breakpoint, evaluatedLogExpression, suspendContext)) { + if (session.breakpointReached(breakpoint, evaluatedLogExpression, suspendContext)) { setOverlay() } else { @@ -211,14 +210,14 @@ public abstract class DebugProcessImpl>(session: XDebugSessi } override final fun startPausing() { - connection.vm.getSuspendContextManager().suspend().rejected(RejectErrorReporter(getSession(), "Cannot pause")) + connection.vm.getSuspendContextManager().suspend().rejected(RejectErrorReporter(session, "Cannot pause")) } - override final fun getCurrentStateMessage() = connection.getState().getMessage() + override final fun getCurrentStateMessage() = connection.state.message - override final fun getCurrentStateHyperlinkListener() = connection.getState().getMessageLinkListener() + override final fun getCurrentStateHyperlinkListener() = connection.state.messageLinkListener - override fun doGetProcessHandler() = executionResult?.getProcessHandler() ?: object : DefaultDebugProcessHandler() { override fun isSilentlyDestroyOnClose() = true } + override fun doGetProcessHandler() = executionResult?.processHandler ?: object : DefaultDebugProcessHandler() { override fun isSilentlyDestroyOnClose() = true } public fun saveResolvedFile(url: Url, file: VirtualFile) { urlToFileCache.putIfAbsent(url, file) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/LineBreakpointManager.kt b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/LineBreakpointManager.kt index 0a37e2d83b79..ef1e0601d79c 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/LineBreakpointManager.kt +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/LineBreakpointManager.kt @@ -37,7 +37,7 @@ public abstract class LineBreakpointManager(private val vm: Vm, private val debu override fun resolved(breakpoint: Breakpoint) { var breakpoints = synchronized (lock) { vmToIdeBreakpoint.get(breakpoint) } for (ideBreakpoint in breakpoints) { - debugProcess.getSession().updateBreakpointPresentation(ideBreakpoint, AllIcons.Debugger.Db_verified_breakpoint, null) + debugProcess.session.updateBreakpointPresentation(ideBreakpoint, AllIcons.Debugger.Db_verified_breakpoint, null) } } @@ -47,13 +47,13 @@ public abstract class LineBreakpointManager(private val vm: Vm, private val debu } if (synchronized (lock) { runToLocationBreakpoints.remove(breakpoint) }) { - debugProcess.getSession().reportError("Cannot run to cursor: ${errorMessage!!}") + debugProcess.session.reportError("Cannot run to cursor: ${errorMessage!!}") return } var breakpoints = synchronized (lock) { vmToIdeBreakpoint.get(breakpoint) } for (ideBreakpoint in breakpoints) { - debugProcess.getSession().updateBreakpointPresentation(ideBreakpoint, AllIcons.Debugger.Db_invalid_breakpoint, errorMessage) + debugProcess.session.updateBreakpointPresentation(ideBreakpoint, AllIcons.Debugger.Db_invalid_breakpoint, errorMessage) } } }) @@ -71,7 +71,7 @@ public abstract class LineBreakpointManager(private val vm: Vm, private val debu for (vmBreakpoint in target) { if (!vmBreakpoint.enabled) { vmBreakpoint.enabled = true - breakpointManager.flush(vmBreakpoint).rejected { debugProcess.getSession().updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, it.getMessage()) } + breakpointManager.flush(vmBreakpoint).rejected { debugProcess.session.updateBreakpointPresentation(breakpoint, AllIcons.Debugger.Db_invalid_breakpoint, it.getMessage()) } } } } @@ -155,8 +155,8 @@ public abstract class LineBreakpointManager(private val vm: Vm, private val debu protected fun doSetBreakpoint(breakpoint: XLineBreakpoint<*>?, location: Location, isTemporary: Boolean): Breakpoint { val breakpointManager = vm.getBreakpointManager() val target = createTarget(breakpoint, breakpointManager, location, isTemporary) - val condition = breakpoint?.getConditionExpression() - return breakpointManager.setBreakpoint(target, location.getLine(), location.getColumn(), condition?.getExpression(), Breakpoint.EMPTY_VALUE, true) + val condition = breakpoint?.conditionExpression + return breakpointManager.setBreakpoint(target, location.line, location.column, condition?.expression, Breakpoint.EMPTY_VALUE, true) } protected abstract fun createTarget(breakpoint: XLineBreakpoint<*>?, breakpointManager: BreakpointManager, location: Location, isTemporary: Boolean): BreakpointTarget @@ -200,7 +200,7 @@ public abstract class LineBreakpointManager(private val vm: Vm, private val debu public fun clearRunToLocationBreakpoints() { var breakpoints = synchronized (lock) { - if (runToLocationBreakpoints.isEmpty()) { + if (runToLocationBreakpoints.isEmpty) { return@clearRunToLocationBreakpoints } var breakpoints = runToLocationBreakpoints.toArray(arrayOfNulls(runToLocationBreakpoints.size()))