Don't activate Kotlin async stack trace provider in Java sources (KT-30318)

This commit is contained in:
Yan Zhulanow
2019-03-06 19:57:27 +03:00
parent 754a7bc554
commit a1e5ce2c8b
3 changed files with 14 additions and 5 deletions
@@ -65,6 +65,9 @@ class KotlinCoroutinesAsyncStackTraceProvider : KotlinCoroutinesAsyncStackTraceP
fun getAsyncStackTrace(frameProxy: StackFrameProxyImpl, suspendContext: SuspendContextImpl): List<StackFrameItem>? {
val location = frameProxy.location()
if (!location.isInKotlinSources()) {
return null
}
val method = location.safeMethod() ?: return null
val currentThread = frameProxy.threadProxy().threadReference
if (currentThread == null || !currentThread.isSuspended || !currentThread.isAtBreakpoint) {
@@ -91,9 +91,7 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq
}
override fun createStackFrame(frame: StackFrameProxyImpl, debugProcess: DebugProcessImpl, location: Location): XStackFrame? {
val declaringType = location.declaringType()
val fileExtension = declaringType.safeSourceName()?.toLowerCase()?.substringAfterLast('.') ?: ""
if (fileExtension in KotlinFileTypeFactory.KOTLIN_EXTENSIONS || declaringType.containsKotlinStrata()) {
if (location.isInKotlinSources()) {
return KotlinStackFrame(frame)
}
return null
@@ -354,8 +352,6 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq
}
})
}
private fun ReferenceType.containsKotlinStrata() = availableStrata().contains(KOTLIN_STRATA_NAME)
}
inline fun <U, V> U.readAction(crossinline f: (U) -> V): V {
@@ -17,6 +17,8 @@ import org.jetbrains.kotlin.codegen.binding.CodegenBinding.asmTypeForAnonymousCl
import org.jetbrains.kotlin.codegen.coroutines.DO_RESUME_METHOD_NAME
import org.jetbrains.kotlin.codegen.coroutines.INVOKE_SUSPEND_METHOD_NAME
import org.jetbrains.kotlin.codegen.coroutines.continuationAsmTypes
import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME
import org.jetbrains.kotlin.idea.KotlinFileTypeFactory
import org.jetbrains.kotlin.idea.codeInsight.CodeInsightUtils
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
import org.jetbrains.kotlin.idea.refactoring.getLineEndOffset
@@ -30,6 +32,14 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
import org.jetbrains.org.objectweb.asm.Type as AsmType
import java.util.*
fun Location.isInKotlinSources(): Boolean {
val declaringType = declaringType()
val fileExtension = declaringType.safeSourceName()?.substringAfterLast('.')?.toLowerCase() ?: ""
return fileExtension in KotlinFileTypeFactory.KOTLIN_EXTENSIONS || declaringType.containsKotlinStrata()
}
fun ReferenceType.containsKotlinStrata() = availableStrata().contains(KOTLIN_STRATA_NAME)
fun isInsideInlineArgument(
inlineArgument: KtFunction,
location: Location,