Fix bad cast on absent descriptor in field breakpoint (EA-101988)

This commit is contained in:
Nikolay Krasko
2017-07-31 16:42:26 +03:00
parent 45ec0e364a
commit 2ba89b9e68
@@ -122,7 +122,7 @@ class KotlinFieldBreakpoint(
val property = getProperty(sourcePosition) ?: return val property = getProperty(sourcePosition) ?: return
breakpointType = computeBreakpointType(property) breakpointType = (computeBreakpointType(property) ?: return)
val vm = debugProcess.virtualMachineProxy val vm = debugProcess.virtualMachineProxy
try { try {
@@ -187,7 +187,7 @@ class KotlinFieldBreakpoint(
} }
} }
private fun computeBreakpointType(property: KtCallableDeclaration): BreakpointType { private fun computeBreakpointType(property: KtCallableDeclaration): BreakpointType? {
return runReadAction { return runReadAction {
val bindingContext = property.analyze() val bindingContext = property.analyze()
var descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, property) var descriptor = bindingContext.get(BindingContext.DECLARATION_TO_DESCRIPTOR, property)
@@ -195,6 +195,7 @@ class KotlinFieldBreakpoint(
descriptor = bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, descriptor) descriptor = bindingContext.get(BindingContext.VALUE_PARAMETER_AS_PROPERTY, descriptor)
} }
if (descriptor != null) {
if (bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor as PropertyDescriptor)!!) { if (bindingContext.get(BindingContext.BACKING_FIELD_REQUIRED, descriptor as PropertyDescriptor)!!) {
BreakpointType.FIELD BreakpointType.FIELD
} }
@@ -202,6 +203,10 @@ class KotlinFieldBreakpoint(
BreakpointType.METHOD BreakpointType.METHOD
} }
} }
else {
null
}
}
} }
private fun createMethodBreakpoint(debugProcess: DebugProcessImpl, refType: ReferenceType, accessor: Method) { private fun createMethodBreakpoint(debugProcess: DebugProcessImpl, refType: ReferenceType, accessor: Method) {