Minor: Clean up jvm-debugger-core module
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ class InlineCallableUsagesSearcher(private val myDebugProcess: DebugProcess) {
|
||||
try {
|
||||
ProgressManager.getInstance().runProcess(task, EmptyProgressIndicator())
|
||||
} catch (e: InterruptedException) {
|
||||
isSuccess = false;
|
||||
isSuccess = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+17
-14
@@ -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<KtFile>,
|
||||
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<ComboBoxFileElement>(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
|
||||
|
||||
+5
-5
@@ -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<KotlinDebuggerSettings>("kotlin_debugger"), Getter<KotlinDebuggerSettings> {
|
||||
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 {
|
||||
|
||||
+6
-6
@@ -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
|
||||
|
||||
+1
@@ -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
|
||||
|
||||
+10
-10
@@ -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 <reified T : EventRequest> findRequest(
|
||||
private inline fun <reified T : EventRequest> findRequest(
|
||||
debugProcess: DebugProcessImpl,
|
||||
requestClass: Class<T>,
|
||||
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 {
|
||||
|
||||
+9
-9
@@ -57,20 +57,20 @@ class KotlinFieldBreakpointPropertiesPanel : XBreakpointCustomPropertiesPanel<XL
|
||||
}
|
||||
|
||||
override fun loadFrom(breakpoint: XLineBreakpoint<KotlinPropertyBreakpointProperties>) {
|
||||
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<KotlinPropertyBreakpointProperties>) {
|
||||
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()
|
||||
|
||||
+7
-5
@@ -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<XLineBreakpoint<KotlinPropertyBreakpointProperties>>? {
|
||||
return KotlinBreakpointFiltersPanel(project)
|
||||
|
||||
-2
@@ -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
|
||||
|
||||
+7
-6
@@ -12,18 +12,19 @@ class KotlinPropertyBreakpointProperties(
|
||||
@Attribute var myFieldName: String = "",
|
||||
@Attribute var myClassName: String = ""
|
||||
) : JavaBreakpointProperties<KotlinPropertyBreakpointProperties>() {
|
||||
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
|
||||
}
|
||||
|
||||
+20
-19
@@ -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<PsiElement>()
|
||||
|
||||
XDebuggerUtil.getInstance().iterateLine(project, document, line, fun(element: PsiElement): Boolean {
|
||||
if (element is PsiWhiteSpace || element.getParentOfType<PsiComment>(false) != null || !element.isValid) {
|
||||
return true
|
||||
}
|
||||
XDebuggerUtil.getInstance().iterateLine(
|
||||
project, document, line,
|
||||
fun(element: PsiElement): Boolean {
|
||||
if (element is PsiWhiteSpace || element.getParentOfType<PsiComment>(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<JavaLineBreakpointType.JavaBreakpointVariant> {
|
||||
val file = PsiManager.getInstance(project).findFile(position.file) as? KtFile ?: return emptyList()
|
||||
|
||||
|
||||
+1
-9
@@ -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()
|
||||
|
||||
+2
-2
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -21,6 +21,6 @@ class KotlinDebuggerInternalClassesFilterProvider : DebuggerClassFilterProvider
|
||||
}
|
||||
|
||||
override fun getFilters(): List<ClassFilter>? {
|
||||
return if (KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES) FILTERS else listOf()
|
||||
return if (KotlinDebuggerSettings.getInstance().disableKotlinInternalClasses) FILTERS else listOf()
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -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))
|
||||
}
|
||||
|
||||
-4
@@ -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
|
||||
|
||||
-1
@@ -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<ValueDescriptorImpl>() {
|
||||
override fun createDescriptorImpl(project: Project): ValueDescriptorImpl {
|
||||
|
||||
-3
@@ -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,
|
||||
|
||||
+3
-3
@@ -29,18 +29,18 @@ public class KotlinSteppingConfigurableUi implements ConfigurableUi<KotlinDebugg
|
||||
|
||||
@Override
|
||||
public void reset(@NotNull KotlinDebuggerSettings settings) {
|
||||
boolean flag = settings.getDEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES();
|
||||
boolean flag = settings.getDisableKotlinInternalClasses();
|
||||
ignoreKotlinMethods.setSelected(flag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified(@NotNull KotlinDebuggerSettings settings) {
|
||||
return settings.getDEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES() != ignoreKotlinMethods.isSelected();
|
||||
return settings.getDisableKotlinInternalClasses() != ignoreKotlinMethods.isSelected();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(@NotNull KotlinDebuggerSettings settings) {
|
||||
settings.setDEBUG_DISABLE_KOTLIN_INTERNAL_CLASSES(ignoreKotlinMethods.isSelected());
|
||||
settings.setDisableKotlinInternalClasses(ignoreKotlinMethods.isSelected());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class KotlinStepOverParamDefaultImplsMethodFilter(
|
||||
|
||||
val method = location.safeMethod() ?: return null
|
||||
val name = method.name()
|
||||
assert(name.endsWith(JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX));
|
||||
assert(name.endsWith(JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX))
|
||||
val originalName = name.dropLast(JvmAbi.DEFAULT_PARAMS_IMPL_SUFFIX.length)
|
||||
val signature = method.signature()
|
||||
val containingTypeName = location.declaringType().name()
|
||||
|
||||
-1
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.renderer.ParameterNameRenderingPolicy
|
||||
import org.jetbrains.kotlin.renderer.PropertyAccessorRenderingPolicy
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.isExtension
|
||||
import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import javax.swing.Icon
|
||||
|
||||
class KotlinMethodSmartStepTarget(
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ class CoroutineDebuggerListener(val project: Project) : DebuggerListener {
|
||||
): DebuggerConnection? {
|
||||
val isExternalSystemRunConfiguration = configuration is ExternalSystemRunConfiguration
|
||||
val isGradleConfiguration = gradleConfiguration(configuration.type.id)
|
||||
val disableCoroutineAgent = KotlinDebuggerSettings.getInstance().DEBUG_DISABLE_COROUTINE_AGENT
|
||||
val disableCoroutineAgent = KotlinDebuggerSettings.getInstance().debugDisableCoroutineAgent
|
||||
if (!disableCoroutineAgent && runnerSettings is DebuggingRunnerData && !isExternalSystemRunConfiguration && !isGradleConfiguration)
|
||||
return DebuggerConnection(project, configuration, params, runnerSettings)
|
||||
return null
|
||||
|
||||
+3
-3
@@ -27,9 +27,9 @@ internal val SettingsMutators: List<SettingsMutator<*>> = 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
|
||||
|
||||
Reference in New Issue
Block a user