1
1
package org.utbot.contest.usvm
2
2
3
3
import org.jacodb.analysis.library.analyzers.thisInstance
4
+ import org.jacodb.api.JcArrayType
4
5
import org.jacodb.api.JcClassOrInterface
5
6
import org.jacodb.api.JcClasspath
6
7
import org.jacodb.api.JcField
7
8
import org.jacodb.api.JcMethod
8
9
import org.jacodb.api.JcPrimitiveType
10
+ import org.jacodb.api.JcRefType
9
11
import org.jacodb.api.JcType
10
12
import org.jacodb.api.TypeName
11
13
import org.jacodb.api.ext.boolean
12
14
import org.jacodb.api.ext.byte
13
15
import org.jacodb.api.ext.char
14
16
import org.jacodb.api.ext.double
15
- import org.jacodb.api.ext.findClassOrNull
16
17
import org.jacodb.api.ext.float
17
18
import org.jacodb.api.ext.int
18
19
import org.jacodb.api.ext.long
19
20
import org.jacodb.api.ext.short
20
21
import org.jacodb.api.ext.void
22
+ import org.jacodb.api.ext.toType
21
23
import org.usvm.instrumentation.testcase.api.UTestInst
22
24
import org.usvm.instrumentation.testcase.descriptor.UTestObjectDescriptor
23
25
import org.usvm.instrumentation.testcase.descriptor.UTestValueDescriptor
@@ -37,7 +39,6 @@ import org.utbot.framework.plugin.api.util.floatClassId
37
39
import org.utbot.framework.plugin.api.util.id
38
40
import org.utbot.framework.plugin.api.util.intClassId
39
41
import org.utbot.framework.plugin.api.util.longClassId
40
- import org.utbot.framework.plugin.api.util.objectClassId
41
42
import org.utbot.framework.plugin.api.util.shortClassId
42
43
import org.utbot.framework.plugin.api.util.utContext
43
44
import org.utbot.framework.plugin.api.util.voidClassId
@@ -55,10 +56,18 @@ fun JcMethod.toExecutableId(classpath: JcClasspath): ExecutableId {
55
56
return MethodId (type, this .name, returnClassId, parameters)
56
57
}
57
58
59
+ private fun JcType.replaceToBoundIfGeneric (): JcType {
60
+ return when (this ) {
61
+ is JcArrayType -> this .classpath.arrayTypeOf(elementType.replaceToBoundIfGeneric())
62
+ is JcRefType -> this .jcClass.toType()
63
+ else -> this
64
+ }
65
+ }
66
+
58
67
val JcType ?.classId: ClassId
59
68
get() {
60
69
if (this !is JcPrimitiveType ) {
61
- return this ?.toJavaClass(utContext.classLoader)?.id
70
+ return this ?.replaceToBoundIfGeneric()?. toJavaClass(utContext.classLoader)?.id
62
71
? : error(" Can not construct classId for $this " )
63
72
}
64
73
0 commit comments