Skip to content

Commit a727ddb

Browse files
committed
fix unwrapGenericType to properly find generic type in arguments Map
1 parent 55066de commit a727ddb

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/kotlin/graphql/kickstart/tools/GenericType.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ internal open class GenericType(protected val mostSpecificType: JavaType, protec
121121
}
122122
}
123123

124-
private fun unwrapGenericType(declaringType: ParameterizedType, type: TypeVariable<*>) =
125-
unwrapGenericType(TypeUtils.determineTypeArguments(getRawClass(mostSpecificType), declaringType)[type]
126-
?: error("No type variable found for: ${TypeUtils.toLongString(type)}"))
124+
private fun unwrapGenericType(declaringType: ParameterizedType, type: TypeVariable<*>): JavaType {
125+
val rawClass = getRawClass(mostSpecificType)
126+
val arguments = TypeUtils.determineTypeArguments(rawClass, declaringType)
127+
val t = arguments.filter { it.key.name == type.name }.values.firstOrNull()
128+
?: error("No type variable found for: ${TypeUtils.toLongString(type)}")
129+
return unwrapGenericType(t)
130+
}
127131

128132
private fun replaceTypeVariable(type: JavaType): JavaType {
129133
return when (type) {

0 commit comments

Comments
 (0)