W3cubDocs

/Kotlin

javaType

Platform and version requirements: JVM (1.4)
@ExperimentalStdlibApi val KType.javaType: Type

Returns a Java Type instance corresponding to the given Kotlin type.

This function is experimental because not all the features are supported yet, and behavior might change in corner cases. In particular, the following is not supported correctly or at all:

  • declaration-site variance
  • variance of types annotated with JvmSuppressWildcards
  • obtaining the containing declaration of a type parameter (TypeVariable.getGenericDeclaration)
  • annotations of type parameters and their bounds (TypeVariable.getAnnotation, TypeVariable.getAnnotations, TypeVariable.getDeclaredAnnotations, TypeVariable.getAnnotatedBounds)

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.reflect/java-type.html