File tree Expand file tree Collapse file tree 3 files changed +10
-4
lines changed
utbot-framework/src/main/kotlin/org/utbot/framework/concrete
utbot-instrumentation/src/main/kotlin/org/utbot/instrumentation/instrumentation/mock Expand file tree Collapse file tree 3 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 11package org.utbot.framework.concrete
22
3- import org.utbot.framework.plugin.api.util.signature
43import java.lang.reflect.Method
54import java.util.IdentityHashMap
5+ import org.objectweb.asm.Type
6+ import org.utbot.framework.plugin.api.util.signature
67
78/* *
89 * Some information, which is computed after classes instrumentation.
@@ -66,7 +67,9 @@ class InstrumentationContext {
6667 }
6768
6869 fun updateMocks (obj : Any? , method : Method , values : List <* >) {
69- updateMocks(obj, method.signature, values)
70+ val type = Type .getInternalName(method.declaringClass)
71+ val signature = method.signature
72+ updateMocks(obj, " $type @$signature " , values)
7073 }
7174 }
7275}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import org.utbot.instrumentation.instrumentation.mock.MockConfig
66import java.lang.reflect.Field
77import java.lang.reflect.Method
88import java.lang.reflect.Modifier
9+ import org.objectweb.asm.Type
910
1011
1112/* *
@@ -31,7 +32,9 @@ class MethodMockController(
3132 error(" $method is an instance method, but instance is null!" )
3233 }
3334
34- val id = instrumentationContext.methodSignatureToId[method.signature]
35+ val type = Type .getInternalName(method.declaringClass)
36+ val computedSignature = " $type @${method.signature} "
37+ val id = instrumentationContext.methodSignatureToId[computedSignature]
3538
3639 isMockField = clazz.declaredFields.firstOrNull { it.name == MockConfig .IS_MOCK_FIELD + id }
3740 ? : error(" No field ${MockConfig .IS_MOCK_FIELD + id} in $clazz " )
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ class MockClassVisitor(
7373 val isStatic = access and Opcodes .ACC_STATIC != 0
7474 val isVoidMethod = Type .getReturnType(descriptor) == Type .VOID_TYPE
7575
76- val computedSignature = name + descriptor
76+ val computedSignature = " $internalClassName @ $ name$ descriptor"
7777 val id = signatureToId.size
7878 signatureToId[computedSignature] = id
7979
You can’t perform that action at this time.
0 commit comments