Skip to content

Commit d9fe2ad

Browse files
Added the ClassId for ParametrizedType (#766)
1 parent 6acc38c commit d9fe2ad

File tree

2 files changed

+6
-4
lines changed
  • utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree
  • utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util

2 files changed

+6
-4
lines changed

utbot-framework-api/src/main/kotlin/org/utbot/framework/plugin/api/util/IdUtil.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import java.lang.reflect.Constructor
1414
import java.lang.reflect.Executable
1515
import java.lang.reflect.Field
1616
import java.lang.reflect.Method
17+
import java.lang.reflect.ParameterizedType
1718
import java.lang.reflect.Type
1819
import java.util.concurrent.atomic.AtomicInteger
1920
import kotlin.contracts.ExperimentalContracts
@@ -268,10 +269,11 @@ val Class<*>.id: ClassId
268269
}
269270

270271
/**
271-
* [java.lang.reflect.ParameterizedType.getRawType] now returns [Type] instead of [Class].
272+
* We should specially handle the case of a generic type that is a [Type] and not a [Class].
273+
* Returns a [ClassId] for the corresponding raw type.
272274
*/
273-
val Type.id: ClassId
274-
get() = TODO("Java 11 transition")
275+
val ParameterizedType.id: ClassId
276+
get() = ClassId(this.rawType.typeName)
275277

276278
val KClass<*>.id: ClassId
277279
get() = java.id

utbot-framework/src/main/kotlin/org/utbot/framework/codegen/model/constructor/tree/CgMethodConstructor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ internal class CgMethodConstructor(val context: CgContext) : CgContextOwner by c
12921292

12931293
val argumentType = when {
12941294
paramType is Class<*> && paramType.isArray -> paramType.id
1295-
paramType is ParameterizedType -> paramType.rawType.id
1295+
paramType is ParameterizedType -> paramType.id
12961296
else -> ClassId(paramType.typeName)
12971297
}
12981298

0 commit comments

Comments
 (0)