Refactor if to when in dsl.kt

[no changelog]
This commit is contained in:
Walker Selby
2023-10-26 16:49:09 +01:00
committed by nea
parent fb59b2afed
commit 710d9ec3f7

View File

@@ -37,14 +37,11 @@ fun literal(
private fun normalizeGeneric(argument: Type): Class<*> {
return if (argument is Class<*>) {
argument
} else if (argument is TypeVariable<*>) {
normalizeGeneric(argument.bounds[0])
} else if (argument is ParameterizedType) {
normalizeGeneric(argument.rawType)
} else {
Any::class.java
return when (argument) {
is Class<*> -> argument
is TypeVariable<*> -> normalizeGeneric(argument.bounds[0])
is ParameterizedType -> normalizeGeneric(argument.rawType)
else -> Any::class.java
}
}