Debugger: Display async stack trace elements for suspend callers (KT-28728)

This commit is contained in:
Yan Zhulanow
2018-12-10 16:32:19 +09:00
parent e8c066605b
commit f6b2e673f7
15 changed files with 681 additions and 20 deletions
@@ -5,8 +5,8 @@
package org.jetbrains.kotlin.utils.kapt
import org.jetbrains.kotlin.utils.getSafe
import java.lang.ref.WeakReference
import java.lang.reflect.Field
import java.lang.reflect.Modifier
import java.util.*
import javax.annotation.processing.*
@@ -139,19 +139,4 @@ private fun ClassLoader.loadedClasses(): Vector<Class<*>> {
} catch (e: Throwable) {
return Vector()
}
}
private fun Field.getSafe(obj: Any?): Any? {
return try {
val oldIsAccessible = isAccessible
try {
isAccessible = true
get(obj)
} finally {
isAccessible = oldIsAccessible
}
} catch (e: Throwable) {
null
}
}
@@ -0,0 +1,23 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.utils
import java.lang.reflect.Field
fun Field.getSafe(obj: Any?): Any? {
return try {
val oldIsAccessible = isAccessible
try {
isAccessible = true
get(obj)
} finally {
isAccessible = oldIsAccessible
}
} catch (e: Throwable) {
null
}
}