diff --git a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt index 9a894098c..4539a1ee3 100644 --- a/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt +++ b/src/main/kotlin/org/openrewrite/kotlin/KotlinTypeMapping.kt @@ -1083,11 +1083,9 @@ class KotlinTypeMapping(typeCache: JavaTypeCache, firSession: FirSession) : Java for (bound: FirTypeRef in typeParameter.bounds) { bounds.add(type(bound)) } - if ("out" == typeParameter.variance.label) { - variance = JavaType.GenericTypeVariable.Variance.COVARIANT - } else if ("in" == typeParameter.variance.label) { + if (typeParameter.variance == Variance.IN_VARIANCE) { variance = JavaType.GenericTypeVariable.Variance.CONTRAVARIANT - } else { + } else if (bounds.isNotEmpty()) { variance = JavaType.GenericTypeVariable.Variance.COVARIANT } }