diff --git a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt index c54a5a5098..c758bf9bbb 100644 --- a/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt +++ b/utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt @@ -14,6 +14,7 @@ import java.lang.reflect.Constructor import java.lang.reflect.Executable import java.lang.reflect.Field import java.lang.reflect.Method +import java.lang.reflect.ParameterizedType import java.lang.reflect.Type import java.util.concurrent.atomic.AtomicInteger import kotlin.contracts.ExperimentalContracts @@ -268,10 +269,11 @@ val Class<*>.id: ClassId } /** - * [java.lang.reflect.ParameterizedType.getRawType] now returns [Type] instead of [Class]. + * We should specially handle the case of a generic type that is a [Type] and not a [Class]. + * Returns a [ClassId] for the corresponding raw type. */ -val Type.id: ClassId - get() = TODO("Java 11 transition") +val ParameterizedType.id: ClassId + get() = ClassId(this.rawType.typeName) val KClass<*>.id: ClassId get() = java.id diff --git a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt index 56fe6caf80..1ab2f70fe7 100644 --- a/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt +++ b/utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt @@ -1292,7 +1292,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c val argumentType = when { paramType is Class<*> && paramType.isArray -> paramType.id - paramType is ParameterizedType -> paramType.rawType.id + paramType is ParameterizedType -> paramType.id else -> ClassId(paramType.typeName) }