Fix accessing nullable location() method

This commit is contained in:
Nikolay Krasko
2017-10-25 19:12:48 +03:00
parent 3fe2298855
commit 6420f50f2e
3 changed files with 4 additions and 4 deletions
@@ -253,7 +253,7 @@ class KotlinFieldBreakpoint(
}
fun matchesEvent(event: LocatableEvent): Boolean {
val method = event.location().method()
val method = event.location()?.method()
// TODO check property type
return method != null && method.name() in getMethodsName()
}
@@ -264,7 +264,7 @@ class KotlinFieldBreakpoint(
}
override fun getEventMessage(event: LocatableEvent): String {
val location = event.location()
val location = event.location()!!
val locationQName = location.declaringType().name() + "." + location.method().name()
val locationFileName = try {
location.sourceName()
@@ -169,7 +169,7 @@ fun suspendFunctionFirstLineLocation(location: Location): Int? {
return null
}
val lineNumber = location.method().location().lineNumber()
val lineNumber = location.method().location()?.lineNumber()
if (lineNumber == -1) {
return null
}
@@ -39,7 +39,7 @@ class KotlinSyntheticTypeComponentProvider: SyntheticTypeComponentProvider {
try {
if (typeComponent.isDelegateToDefaultInterfaceImpl()) return true
if (typeComponent.location().lineNumber() != 1) return false
if (typeComponent.location()?.lineNumber() != 1) return false
if (typeComponent.allLineLocations().any { it.lineNumber() != 1 }) {
return false