Minor: fix warnings

This commit is contained in:
Natalia Ukhorskaya
2015-11-30 13:58:13 +03:00
parent a1f3c5381e
commit cd5e406876
@@ -33,8 +33,8 @@ import org.jetbrains.kotlin.resolve.jvm.AsmTypes
import org.jetbrains.org.objectweb.asm.Type import org.jetbrains.org.objectweb.asm.Type
class FrameVisitor(context: EvaluationContextImpl) { class FrameVisitor(context: EvaluationContextImpl) {
private val project = context.getDebugProcess().getProject() private val project = context.debugProcess.project
private val frame = context.getFrameProxy()?.getStackFrame() private val frame = context.frameProxy?.stackFrame
public fun findValue(name: String, asmType: Type?, checkType: Boolean, failIfNotFound: Boolean): Value? { public fun findValue(name: String, asmType: Type?, checkType: Boolean, failIfNotFound: Boolean): Value? {
if (frame == null) return null if (frame == null) return null
@@ -100,13 +100,12 @@ class FrameVisitor(context: EvaluationContextImpl) {
} }
private fun isFunctionType(type: Type?): Boolean { private fun isFunctionType(type: Type?): Boolean {
return type?.getSort() == Type.OBJECT && return type?.sort == Type.OBJECT &&
type!!.getInternalName().startsWith(InlineCodegenUtil.NUMBERED_FUNCTION_PREFIX) type!!.internalName.startsWith(InlineCodegenUtil.NUMBERED_FUNCTION_PREFIX)
} }
private fun findLocalVariable(name: String, asmType: Type?, checkType: Boolean): Value? { private fun findLocalVariable(name: String, asmType: Type?, checkType: Boolean): Value? {
val localVariable = frame!!.visibleVariableByName(name) val localVariable = frame!!.visibleVariableByName(name) ?: return null
if (localVariable == null) return null
val eval4jValue = frame.getValue(localVariable).asValue() val eval4jValue = frame.getValue(localVariable).asValue()
val sharedVarValue = getValueIfSharedVar(eval4jValue, asmType, checkType) val sharedVarValue = getValueIfSharedVar(eval4jValue, asmType, checkType)
@@ -148,7 +147,7 @@ class FrameVisitor(context: EvaluationContextImpl) {
if (!shouldCheckType || asmType == null || value.asmType == asmType) return true if (!shouldCheckType || asmType == null || value.asmType == asmType) return true
if (project == null) return false if (project == null) return false
if ((value.obj() as? com.sun.jdi.ObjectReference)?.referenceType().isSubclass(asmType.getClassName())) { if ((value.obj() as? com.sun.jdi.ObjectReference)?.referenceType().isSubclass(asmType.className)) {
return true return true
} }
@@ -163,8 +162,7 @@ class FrameVisitor(context: EvaluationContextImpl) {
if (obj !is ObjectReference) return null if (obj !is ObjectReference) return null
val _class = obj.referenceType() val _class = obj.referenceType()
val field = _class.fieldByName(name) val field = _class.fieldByName(name) ?: return null
if (field == null) return null
val fieldValue = obj.getValue(field).asValue() val fieldValue = obj.getValue(field).asValue()
if (isValueOfCorrectType(fieldValue, asmType, checkType)) return fieldValue if (isValueOfCorrectType(fieldValue, asmType, checkType)) return fieldValue
@@ -176,7 +174,7 @@ class FrameVisitor(context: EvaluationContextImpl) {
} }
private fun Value.isSharedVar(): Boolean { private fun Value.isSharedVar(): Boolean {
return this.asmType.getSort() == Type.OBJECT && this.asmType.getInternalName().startsWith(AsmTypes.REF_TYPE_PREFIX) return this.asmType.sort == Type.OBJECT && this.asmType.internalName.startsWith(AsmTypes.REF_TYPE_PREFIX)
} }
fun getValueIfSharedVar(value: Value, expectedType: Type?, checkType: Boolean): Value? { fun getValueIfSharedVar(value: Value, expectedType: Type?, checkType: Boolean): Value? {