Skip to content

Commit 652c630

Browse files
oryan-blockclaude
andcommitted
Use when for list type matching
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
1 parent c8a7fb9 commit 652c630

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎src/main/kotlin/graphql/kickstart/tools/TypeClassMatcher.kt‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@ internal class TypeClassMatcher(private val definitionsByName: Map<String, TypeD
6565
match(potentialMatch, graphQLType.type, realType)
6666
}
6767

68-
is ListType -> {
69-
if (realType is ParameterizedType && isListType(realType, potentialMatch)) {
68+
is ListType -> when {
69+
realType is ParameterizedType && isListType(realType, potentialMatch) ->
7070
match(potentialMatch, graphQLType.type, realType.actualTypeArguments.first())
71-
} else if (realType is Class<*> && realType.isArray) {
71+
realType is Class<*> && realType.isArray ->
7272
match(potentialMatch, graphQLType.type, realType.componentType)
73-
} else if (realType == Object::class.java) {
74-
// e.g. a property map value: the element type is unknown, so match it as Object too
73+
// e.g. a property map value: the element type is unknown, so match it as Object too
74+
realType == Object::class.java ->
7575
match(potentialMatch, graphQLType.type, realType)
76-
} else {
76+
else ->
7777
throw error(potentialMatch, "Java class is not a List or generic type information was lost: $realType")
78-
}
7978
}
8079

8180
is TypeName -> {

0 commit comments

Comments
 (0)