diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/InlineCallableUsagesSearcher.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/InlineCallableUsagesSearcher.kt index adeed70c71f..b6cfd60dbf0 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/InlineCallableUsagesSearcher.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/InlineCallableUsagesSearcher.kt @@ -62,7 +62,7 @@ class InlineCallableUsagesSearcher(private val myDebugProcess: DebugProcess) { try { ProgressManager.getInstance().runProcess(task, EmptyProgressIndicator()) } catch (e: InterruptedException) { - isSuccess = false; + isSuccess = false } } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinAlternativeSourceNotificationProvider.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinAlternativeSourceNotificationProvider.kt index b8a912fb55a..8bed6651012 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinAlternativeSourceNotificationProvider.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinAlternativeSourceNotificationProvider.kt @@ -62,7 +62,7 @@ class KotlinAlternativeSourceNotificationProvider(private val myProject: Project val alternativeKtFiles = findFilesWithExactPackage( packageFqName, GlobalSearchScope.allScope(myProject), - myProject + myProject, ).filterTo(HashSet()) { it.name == fileName } FILE_PROCESSED_KEY.set(file, true) @@ -88,7 +88,7 @@ class KotlinAlternativeSourceNotificationProvider(private val myProject: Project alternatives: Collection, project: Project, file: VirtualFile, - locationDeclName: String? + locationDeclName: String?, ) : EditorNotificationPanel() { private class ComboBoxFileElement(val ktFile: KtFile) { private val label: String by lazy(LazyThreadSafetyMode.NONE) { @@ -110,7 +110,7 @@ class KotlinAlternativeSourceNotificationProvider(private val myProject: Project val items = alternatives.map { ComboBoxFileElement(it) } myLinksPanel.add( - ComboBox(items.toTypedArray()).apply { + ComboBox(items.toTypedArray()).apply { addActionListener { val context = DebuggerManagerEx.getInstanceEx(project).context val session = context.debuggerSession @@ -119,25 +119,28 @@ class KotlinAlternativeSourceNotificationProvider(private val myProject: Project when { session != null && vFile != null -> - session.process.managerThread.schedule(object : DebuggerCommandImpl() { - override fun action() { - if (!StringUtil.isEmpty(locationDeclName)) { - DebuggerUtilsEx.setAlternativeSourceUrl(locationDeclName, vFile.url, project) - } + session.process.managerThread.schedule( + object : DebuggerCommandImpl() { + override fun action() { + if (!StringUtil.isEmpty(locationDeclName)) { + DebuggerUtilsEx.setAlternativeSourceUrl(locationDeclName, vFile.url, project) + } - DebuggerUIUtil.invokeLater { - FileEditorManager.getInstance(project).closeFile(file) - session.refresh(true) + DebuggerUIUtil.invokeLater { + FileEditorManager.getInstance(project).closeFile(file) + session.refresh(true) + } } - } - }) + }, + ) else -> { FileEditorManager.getInstance(project).closeFile(file) ktFile.navigate(true) } } } - }) + }, + ) createActionLabel(KotlinDebuggerCoreBundle.message("alternative.sources.notification.disable")) { DebuggerSettings.getInstance().SHOW_ALTERNATIVE_SOURCE = false diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerSettings.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerSettings.kt index 6a7bb565bb7..0bb74cb495b 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerSettings.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDebuggerSettings.kt @@ -17,12 +17,12 @@ import com.intellij.xdebugger.settings.DebuggerSettingsCategory import com.intellij.xdebugger.settings.XDebuggerSettings import org.jetbrains.kotlin.idea.debugger.stepping.KotlinSteppingConfigurableUi -@State(name = "KotlinDebuggerSettings", storages = arrayOf(Storage("kotlin_debug.xml"))) +@State(name = "KotlinDebuggerSettings", storages = [Storage("kotlin_debug.xml")]) class KotlinDebuggerSettings : XDebuggerSettings("kotlin_debugger"), Getter { - var DEBUG_RENDER_DELEGATED_PROPERTIES: Boolean = false - var DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES: Boolean = true - var DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED: Boolean = false - var DEBUG_DISABLE_COROUTINE_AGENT: Boolean = false + var renderDelegatedProperties: Boolean = false + var disableKotlinInternalClasses: Boolean = true + var isFilterForStdlibAlreadyAdded: Boolean = false + var debugDisableCoroutineAgent: Boolean = false companion object { fun getInstance(): KotlinDebuggerSettings { diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDelegatedPropertyRendererConfigurableUi.java b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDelegatedPropertyRendererConfigurableUi.java index a51f3ec68b7..8e7da62df5b 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDelegatedPropertyRendererConfigurableUi.java +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinDelegatedPropertyRendererConfigurableUi.java @@ -29,21 +29,21 @@ public class KotlinDelegatedPropertyRendererConfigurableUi implements Configurab @Override public void reset(@NotNull KotlinDebuggerSettings settings) { - boolean flag = settings.getDEBUG_RENDER_DELEGATED_PROPERTIES(); + boolean flag = settings.getRenderDelegatedProperties(); renderDelegatedProperties.setSelected(flag); - disableCoroutineAgent.setSelected(settings.getDEBUG_DISABLE_COROUTINE_AGENT()); + disableCoroutineAgent.setSelected(settings.getDebugDisableCoroutineAgent()); } @Override public boolean isModified(@NotNull KotlinDebuggerSettings settings) { - return settings.getDEBUG_RENDER_DELEGATED_PROPERTIES() != renderDelegatedProperties.isSelected() - || settings.getDEBUG_DISABLE_COROUTINE_AGENT() != disableCoroutineAgent.isSelected(); + return settings.getRenderDelegatedProperties() != renderDelegatedProperties.isSelected() + || settings.getDebugDisableCoroutineAgent() != disableCoroutineAgent.isSelected(); } @Override public void apply(@NotNull KotlinDebuggerSettings settings) { - settings.setDEBUG_RENDER_DELEGATED_PROPERTIES(renderDelegatedProperties.isSelected()); - settings.setDEBUG_DISABLE_COROUTINE_AGENT(disableCoroutineAgent.isSelected()); + settings.setRenderDelegatedProperties(renderDelegatedProperties.isSelected()); + settings.setDebugDisableCoroutineAgent(disableCoroutineAgent.isSelected()); } @NotNull diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/InspectBreakpointApplicabilityAction.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/InspectBreakpointApplicabilityAction.kt index 25992c9e989..64ff71099a6 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/InspectBreakpointApplicabilityAction.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/InspectBreakpointApplicabilityAction.kt @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.psi.KtFile import java.awt.Color import java.util.* +@Suppress("ComponentNotRegistered") class InspectBreakpointApplicabilityAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { val data = e.getData() ?: return diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt index 3f547bb2fc5..846647ff4da 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpoint.kt @@ -68,7 +68,7 @@ class KotlinFieldBreakpoint( } } - fun getField(): KtCallableDeclaration? { + private fun getField(): KtCallableDeclaration? { val sourcePosition = sourcePosition return getProperty(sourcePosition) } @@ -115,7 +115,7 @@ class KotlinFieldBreakpoint( val vm = debugProcess.virtualMachineProxy try { - if (properties.WATCH_INITIALIZATION) { + if (properties.watchInitialization) { val sourcePosition = sourcePosition if (sourcePosition != null) { debugProcess.positionManager @@ -136,14 +136,14 @@ class KotlinFieldBreakpoint( val field = refType.fieldByName(getFieldName()) if (field != null) { val manager = debugProcess.requestsManager - if (properties.WATCH_MODIFICATION && vm.canWatchFieldModification()) { + if (properties.watchModification && vm.canWatchFieldModification()) { val request = manager.createModificationWatchpointRequest(this, field) debugProcess.requestsManager.enableRequest(request) if (LOG.isDebugEnabled) { LOG.debug("Modification request added") } } - if (properties.WATCH_ACCESS && vm.canWatchFieldAccess()) { + if (properties.watchAccess && vm.canWatchFieldAccess()) { val request = manager.createAccessWatchpointRequest(this, field) debugProcess.requestsManager.enableRequest(request) if (LOG.isDebugEnabled) { @@ -155,14 +155,14 @@ class KotlinFieldBreakpoint( BreakpointType.METHOD -> { val fieldName = getFieldName() - if (properties.WATCH_ACCESS) { + if (properties.watchAccess) { val getter = refType.methodsByName(JvmAbi.getterName(fieldName)).firstOrNull() if (getter != null) { createMethodBreakpoint(debugProcess, refType, getter) } } - if (properties.WATCH_MODIFICATION) { + if (properties.watchModification) { val setter = refType.methodsByName(JvmAbi.setterName(fieldName)).firstOrNull() if (setter != null) { createMethodBreakpoint(debugProcess, refType, setter) @@ -219,7 +219,7 @@ class KotlinFieldBreakpoint( } } - inline private fun findRequest( + private inline fun findRequest( debugProcess: DebugProcessImpl, requestClass: Class, requestor: Requestor @@ -321,17 +321,17 @@ class KotlinFieldBreakpoint( @TestOnly fun setWatchAccess(value: Boolean) { - properties.WATCH_ACCESS = value + properties.watchAccess = value } @TestOnly fun setWatchModification(value: Boolean) { - properties.WATCH_MODIFICATION = value + properties.watchModification = value } @TestOnly fun setWatchInitialization(value: Boolean) { - properties.WATCH_INITIALIZATION = value + properties.watchInitialization = value } override fun getDisabledIcon(isMuted: Boolean): Icon { diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointPropertiesPanel.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointPropertiesPanel.kt index c1189a36329..aabd5e50935 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointPropertiesPanel.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointPropertiesPanel.kt @@ -57,20 +57,20 @@ class KotlinFieldBreakpointPropertiesPanel : XBreakpointCustomPropertiesPanel) { - myWatchInitializationCheckBox.isSelected = breakpoint.properties.WATCH_INITIALIZATION - myWatchAccessCheckBox.isSelected = breakpoint.properties.WATCH_ACCESS - myWatchModificationCheckBox.isSelected = breakpoint.properties.WATCH_MODIFICATION + myWatchInitializationCheckBox.isSelected = breakpoint.properties.watchInitialization + myWatchAccessCheckBox.isSelected = breakpoint.properties.watchAccess + myWatchModificationCheckBox.isSelected = breakpoint.properties.watchModification } override fun saveTo(breakpoint: XLineBreakpoint) { - var changed = breakpoint.properties.WATCH_ACCESS != myWatchAccessCheckBox.isSelected - breakpoint.properties.WATCH_ACCESS = myWatchAccessCheckBox.isSelected + var changed = breakpoint.properties.watchAccess != myWatchAccessCheckBox.isSelected + breakpoint.properties.watchAccess = myWatchAccessCheckBox.isSelected - changed = breakpoint.properties.WATCH_MODIFICATION != myWatchModificationCheckBox.isSelected || changed - breakpoint.properties.WATCH_MODIFICATION = myWatchModificationCheckBox.isSelected + changed = breakpoint.properties.watchModification != myWatchModificationCheckBox.isSelected || changed + breakpoint.properties.watchModification = myWatchModificationCheckBox.isSelected - changed = breakpoint.properties.WATCH_INITIALIZATION != myWatchInitializationCheckBox.isSelected || changed - breakpoint.properties.WATCH_INITIALIZATION = myWatchInitializationCheckBox.isSelected + changed = breakpoint.properties.watchInitialization != myWatchInitializationCheckBox.isSelected || changed + breakpoint.properties.watchInitialization = myWatchInitializationCheckBox.isSelected if (changed) { (breakpoint as XBreakpointBase<*, *, *>).fireBreakpointChanged() diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt index 3018b14dcaf..079e8717679 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinFieldBreakpointType.kt @@ -22,6 +22,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint import com.intellij.xdebugger.breakpoints.XLineBreakpoint import com.intellij.xdebugger.breakpoints.XLineBreakpointType import com.intellij.xdebugger.breakpoints.ui.XBreakpointCustomPropertiesPanel +import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider import org.jetbrains.kotlin.asJava.classes.KtLightClass import org.jetbrains.kotlin.asJava.classes.KtLightClassForFacade import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration @@ -32,6 +33,7 @@ import org.jetbrains.kotlin.psi.KtDeclarationContainer import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtParameter import org.jetbrains.kotlin.psi.KtProperty +import javax.swing.Icon import javax.swing.JComponent class KotlinFieldBreakpointType : @@ -137,13 +139,13 @@ class KotlinFieldBreakpointType : override fun isAddBreakpointButtonVisible() = true - override fun getMutedEnabledIcon() = AllIcons.Debugger.Db_muted_field_breakpoint + override fun getMutedEnabledIcon(): Icon = AllIcons.Debugger.Db_muted_field_breakpoint - override fun getDisabledIcon() = AllIcons.Debugger.Db_disabled_field_breakpoint + override fun getDisabledIcon(): Icon = AllIcons.Debugger.Db_disabled_field_breakpoint - override fun getEnabledIcon() = AllIcons.Debugger.Db_field_breakpoint + override fun getEnabledIcon(): Icon = AllIcons.Debugger.Db_field_breakpoint - override fun getMutedDisabledIcon() = AllIcons.Debugger.Db_muted_disabled_field_breakpoint + override fun getMutedDisabledIcon(): Icon = AllIcons.Debugger.Db_muted_disabled_field_breakpoint override fun canBeHitInOtherPlaces() = true @@ -166,7 +168,7 @@ class KotlinFieldBreakpointType : return kotlinBreakpoint?.description ?: super.getDisplayText(breakpoint) } - override fun getEditorsProvider() = null + override fun getEditorsProvider(): XDebuggerEditorsProvider? = null override fun createCustomRightPropertiesPanel(project: Project): XBreakpointCustomPropertiesPanel>? { return KotlinBreakpointFiltersPanel(project) diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt index c69901940c7..e5baf92b7a6 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinLineBreakpoint.kt @@ -8,11 +8,9 @@ package org.jetbrains.kotlin.idea.debugger.breakpoints import com.intellij.debugger.engine.DebugProcess import com.intellij.debugger.impl.DebuggerUtilsEx import com.intellij.openapi.project.Project -import com.intellij.psi.util.PsiTreeUtil import com.intellij.xdebugger.XSourcePosition import com.intellij.xdebugger.breakpoints.XBreakpoint import com.intellij.xdebugger.breakpoints.XBreakpointProperties -import com.sun.jdi.AbsentInformationException import com.sun.jdi.ReferenceType import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME import org.jetbrains.kotlin.idea.debugger.isDexDebug diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinPropertyBreakpointProperties.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinPropertyBreakpointProperties.kt index c10ad4408f2..2c32760e4ab 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinPropertyBreakpointProperties.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/KotlinPropertyBreakpointProperties.kt @@ -12,18 +12,19 @@ class KotlinPropertyBreakpointProperties( @Attribute var myFieldName: String = "", @Attribute var myClassName: String = "" ) : JavaBreakpointProperties() { - var WATCH_MODIFICATION: Boolean = true - var WATCH_ACCESS: Boolean = false - var WATCH_INITIALIZATION: Boolean = false + var watchModification: Boolean = true + var watchAccess: Boolean = false + var watchInitialization: Boolean = false override fun getState() = this override fun loadState(state: KotlinPropertyBreakpointProperties) { super.loadState(state) - WATCH_MODIFICATION = state.WATCH_MODIFICATION - WATCH_ACCESS = state.WATCH_ACCESS - WATCH_INITIALIZATION = state.WATCH_INITIALIZATION + watchModification = state.watchModification + watchAccess = state.watchAccess + watchInitialization = state.watchInitialization + myFieldName = state.myFieldName myClassName = state.myClassName } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt index db976f21432..5693c4fc85a 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/breakpoints/breakpointTypeUtils.kt @@ -37,8 +37,6 @@ import java.util.* interface KotlinBreakpointType -private val LOG = Logger.getInstance("BreakpointTypeUtilsKt") - class ApplicabilityResult(val isApplicable: Boolean, val shouldStop: Boolean) { companion object { @JvmStatic @@ -74,26 +72,29 @@ fun isBreakpointApplicable(file: VirtualFile, line: Int, project: Project, check var isApplicable = false val checked = HashSet() - XDebuggerUtil.getInstance().iterateLine(project, document, line, fun(element: PsiElement): Boolean { - if (element is PsiWhiteSpace || element.getParentOfType(false) != null || !element.isValid) { - return true - } + XDebuggerUtil.getInstance().iterateLine( + project, document, line, + fun(element: PsiElement): Boolean { + if (element is PsiWhiteSpace || element.getParentOfType(false) != null || !element.isValid) { + return true + } - val parent = getTopmostParentOnLineOrSelf(element, document, line) - if (!checked.add(parent)) { - return true - } + val parent = getTopmostParentOnLineOrSelf(element, document, line) + if (!checked.add(parent)) { + return true + } - val result = checker(parent) + val result = checker(parent) - if (result.shouldStop && !result.isApplicable) { - isApplicable = false - return false - } + if (result.shouldStop && !result.isApplicable) { + isApplicable = false + return false + } - isApplicable = isApplicable or result.isApplicable - return !result.shouldStop - }) + isApplicable = isApplicable or result.isApplicable + return !result.shouldStop + }, + ) return@runReadAction isApplicable } @@ -117,7 +118,7 @@ private fun getTopmostParentOnLineOrSelf(element: PsiElement, document: Document fun computeLineBreakpointVariants( project: Project, position: XSourcePosition, - kotlinBreakpointType: KotlinLineBreakpointType + kotlinBreakpointType: KotlinLineBreakpointType, ): List { val file = PsiManager.getInstance(project).findFile(position.file) as? KtFile ?: return emptyList() diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt index f74982226e5..ef00de31d80 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/debuggerUtil.kt @@ -31,6 +31,7 @@ import org.jetbrains.kotlin.load.java.JvmAbi import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.inline.InlineUtil +import org.jetbrains.org.objectweb.asm.Type import java.util.* fun Location.isInKotlinSources(): Boolean { @@ -221,15 +222,6 @@ fun isOnSuspendReturnOrReenter(location: Location): Boolean { return firstLocation.safeLineNumber() == location.safeLineNumber() } -fun isLastLineLocationInMethod(location: Location): Boolean { - val knownLines = location.method().safeAllLineLocations().map { it.lineNumber() }.filter { it != -1 } - if (knownLines.isEmpty()) { - return false - } - - return knownLines.max() == location.lineNumber() -} - fun isOneLineMethod(location: Location): Boolean { val allLineLocations = location.method().safeAllLineLocations() val firstLine = allLineLocations.firstOrNull()?.lineNumber() diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/DebuggerFiltersUtil.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/DebuggerFiltersUtil.kt index 6fdd47d822b..6e280f93ec2 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/DebuggerFiltersUtil.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/DebuggerFiltersUtil.kt @@ -23,13 +23,13 @@ import org.jetbrains.kotlin.idea.debugger.KotlinDebuggerSettings private const val KOTLIN_STDLIB_FILTER = "kotlin.*" fun addKotlinStdlibDebugFilterIfNeeded() { - if (!KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED) { + if (!KotlinDebuggerSettings.getInstance().isFilterForStdlibAlreadyAdded) { val settings = DebuggerSettings.getInstance()!! val newFilters = (settings.steppingFilters + ClassFilter(KOTLIN_STDLIB_FILTER)) settings.steppingFilters = newFilters - KotlinDebuggerSettings.getInstance().DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED = true + KotlinDebuggerSettings.getInstance().isFilterForStdlibAlreadyAdded = true } } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinDebuggerInternalClassesFilterProvider.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinDebuggerInternalClassesFilterProvider.kt index df878b7d3fd..6727eea50f4 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinDebuggerInternalClassesFilterProvider.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinDebuggerInternalClassesFilterProvider.kt @@ -21,6 +21,6 @@ class KotlinDebuggerInternalClassesFilterProvider : DebuggerClassFilterProvider } override fun getFilters(): List? { - return if (KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES) FILTERS else listOf() + return if (KotlinDebuggerSettings.getInstance().disableKotlinInternalClasses) FILTERS else listOf() } } \ No newline at end of file diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt index 3f71afb6bc5..d5ad19d6bdc 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/filter/KotlinSyntheticTypeComponentProvider.kt @@ -91,36 +91,36 @@ class KotlinSyntheticTypeComponentProvider : SyntheticTypeComponentProvider { return hasInterfaceWithImplementation(this) } - private val LOAD_INSTRUCTIONS_WITH_INDEX = Opcodes.ILOAD.toByte()..Opcodes.ALOAD.toByte() - private val LOAD_INSTRUCTIONS = (Opcodes.ALOAD + 1).toByte()..(Opcodes.IALOAD - 1).toByte() - - private val RETURN_INSTRUCTIONS = Opcodes.IRETURN.toByte()..Opcodes.RETURN.toByte() + private companion object { + private val LOAD_INSTRUCTIONS_WITH_INDEX = Opcodes.ILOAD.toByte()..Opcodes.ALOAD.toByte() + private val LOAD_INSTRUCTIONS = (Opcodes.ALOAD + 1).toByte()..(Opcodes.IALOAD - 1).toByte() + private val RETURN_INSTRUCTIONS = Opcodes.IRETURN.toByte()..Opcodes.RETURN.toByte() + } // Check that method contains only load and invokeStatic instructions. Note that if after load goes ldc instruction it could be checkParametersNotNull method invocation private fun hasOnlyInvokeStatic(m: Method): Boolean { - val bytecodes = m.bytecodes() + val instructions = m.bytecodes() var i = 0 var isALoad0BeforeStaticCall = false - while (i < bytecodes.size) { - val instr = bytecodes[i] - when { - instr == 42.toByte() /* ALOAD_0 */ -> { + while (i < instructions.size) { + when (val instr = instructions[i]) { + 42.toByte() /* ALOAD_0 */ -> { i += 1 isALoad0BeforeStaticCall = true } - instr in LOAD_INSTRUCTIONS_WITH_INDEX || instr in LOAD_INSTRUCTIONS -> { + in LOAD_INSTRUCTIONS_WITH_INDEX, in LOAD_INSTRUCTIONS -> { i += 1 if (instr in LOAD_INSTRUCTIONS_WITH_INDEX) i += 1 - val nextInstr = bytecodes[i] + val nextInstr = instructions[i] if (nextInstr == Opcodes.LDC.toByte()) { i += 2 isALoad0BeforeStaticCall = false } } - instr == Opcodes.INVOKESTATIC.toByte() -> { + Opcodes.INVOKESTATIC.toByte() -> { i += 3 - if (isALoad0BeforeStaticCall && i == (bytecodes.size - 1)) { - val nextInstr = bytecodes[i] + if (isALoad0BeforeStaticCall && i == (instructions.size - 1)) { + val nextInstr = instructions[i] return nextInstr in RETURN_INSTRUCTIONS } } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt index f2dc862dbb9..45902d36701 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/render/KotlinClassWithDelegatedPropertyRenderer.kt @@ -93,7 +93,7 @@ class KotlinClassWithDelegatedPropertyRenderer : ClassRenderer() { val fieldDescriptor = nodeDescriptorFactory.getFieldDescriptor(builder.parentDescriptor, value, field) if (field.name().endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX)) { - val shouldRenderDelegatedProperty = KotlinDebuggerSettings.getInstance().DEBUG_RENDER_DELEGATED_PROPERTIES + val shouldRenderDelegatedProperty = KotlinDebuggerSettings.getInstance().renderDelegatedProperties if (shouldRenderDelegatedProperty && !ToggleKotlinVariablesState.getService().kotlinVariableView) { children.add(nodeManager.createNode(fieldDescriptor, context)) } diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/KotlinStackFrame.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/KotlinStackFrame.kt index 5b6b336e77b..7c5c8c9ebed 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/KotlinStackFrame.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/KotlinStackFrame.kt @@ -225,10 +225,6 @@ open class KotlinStackFrame(stackFrameDescriptorImpl: StackFrameDescriptorImpl) return name().startsWith(AsmUtil.LABELED_THIS_PARAMETER) } - override fun hashCode(): Int { - return super.hashCode() - } - override fun equals(other: Any?) : Boolean { val eq = super.equals(other) return other is KotlinStackFrame && eq diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/LabeledThisData.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/LabeledThisData.kt index d147eed1a2a..f3f2587d758 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/LabeledThisData.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stackFrame/LabeledThisData.kt @@ -17,7 +17,6 @@ import com.intellij.psi.JavaPsiFacade import com.intellij.psi.PsiExpression import com.intellij.util.IncorrectOperationException import com.sun.jdi.* -import org.jetbrains.org.objectweb.asm.Type as AsmType class LabeledThisData(val label: String, val name: String, val value: Value?) : DescriptorData() { override fun createDescriptorImpl(project: Project): ValueDescriptorImpl { diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java index 8ca8ac0623a..47effd44509 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/DebuggerSteppingHelper.java @@ -25,7 +25,6 @@ import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.jdi.StackFrameProxyImpl; import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.debugger.settings.DebuggerSettings; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.ui.classFilter.ClassFilter; import com.intellij.ui.classFilter.DebuggerClassFilterProvider; import com.sun.jdi.Location; @@ -44,8 +43,6 @@ import org.jetbrains.kotlin.idea.debugger.SafeUtilKt; import java.util.List; public class DebuggerSteppingHelper { - private static final Logger LOG = Logger.getInstance(DebuggerSteppingHelper.class); - public static DebugProcessImpl.ResumeCommand createStepOverCommand( SuspendContextImpl suspendContext, boolean ignoreBreakpoints, diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingConfigurableUi.java b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingConfigurableUi.java index 2d0b162da86..001e2e3fbb5 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingConfigurableUi.java +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingConfigurableUi.java @@ -29,18 +29,18 @@ public class KotlinSteppingConfigurableUi implements ConfigurableUi> = listOf( DebuggerSettingsMutator(SKIP_CLASSLOADERS, DebuggerSettings::SKIP_CLASSLOADERS), DebuggerSettingsMutator(TRACING_FILTERS_ENABLED, DebuggerSettings::TRACING_FILTERS_ENABLED), DebuggerSettingsMutator(SKIP_GETTERS, DebuggerSettings::SKIP_GETTERS), - KotlinSettingsMutator(DISABLE_KOTLIN_INTERNAL_CLASSES, KotlinDebuggerSettings::DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES), - KotlinSettingsMutator(RENDER_DELEGATED_PROPERTIES, KotlinDebuggerSettings::DEBUG_RENDER_DELEGATED_PROPERTIES), - KotlinSettingsMutator(IS_FILTER_FOR_STDLIB_ALREADY_ADDED, KotlinDebuggerSettings::DEBUG_IS_FILTER_FOR_STDLIB_ALREADY_ADDED), + KotlinSettingsMutator(DISABLE_KOTLIN_INTERNAL_CLASSES, KotlinDebuggerSettings::disableKotlinInternalClasses), + KotlinSettingsMutator(RENDER_DELEGATED_PROPERTIES, KotlinDebuggerSettings::renderDelegatedProperties), + KotlinSettingsMutator(IS_FILTER_FOR_STDLIB_ALREADY_ADDED, KotlinDebuggerSettings::isFilterForStdlibAlreadyAdded), KotlinVariablesModeSettingsMutator, JvmTargetSettingsMutator, ForceRankingSettingsMutator