Class JandexKotlin

java.lang.Object
org.jboss.jandex.JandexKotlin

public class JandexKotlin extends Object
Utilities to simplify handling Kotlin classes with Jandex.
  • Field Details

    • METADATA

      public static final DotName METADATA
      The name of kotlin.Metadata. This is an annotation that is present on all classes emitted by the Kotlin compiler.
    • UNIT

      public static final DotName UNIT
      The name of kotlin.Unit. This is a unit type (type that is inhabited by exactly one value). When used as a return type, the Kotlin compiler usually emits void for compatibility with Java, but if a Kotlin suspend function has a return type of Unit, the type is retained in the CONTINUATION parameter.
    • CONTINUATION

      public static final DotName CONTINUATION
      The name of kotlin.coroutines.Continuation. A synthetic parameter of this type is added by the Kotlin compiler to generated suspend functions and may be used to signal completion. A suspend function may complete synchronously, in which case completion is signaled directly by the return value, or asynchronously, in which case the return value is the COROUTINE_SUSPENDED sentinel and completion is signaled through the continuation argument.
  • Constructor Details

    • JandexKotlin

      public JandexKotlin()
  • Method Details

    • isKotlinClass

      public static boolean isKotlinClass(ClassInfo clazz)
      Returns whether the given clazz is a Kotlin class.
      Parameters:
      clazz - the class to inspect, must not be null
      Returns:
      whether the given clazz is a Kotlin class
    • isKotlinMethod

      public static boolean isKotlinMethod(MethodInfo method)
      Returns whether the given method is a Kotlin function.
      Parameters:
      method - the method to inspect, must not be null
      Returns:
      whether the given method is a Kotlin function
    • isKotlinSuspendMethod

      public static boolean isKotlinSuspendMethod(MethodInfo method)
      Returns whether the given method is a Kotlin suspend function.
      Parameters:
      method - the method to inspect, must not be null
      Returns:
      whether the given method is a Kotlin suspend function
    • isKotlinContinuationParameter

      public static boolean isKotlinContinuationParameter(MethodParameterInfo parameter)
      Returns whether the given parameter is a CONTINUATION parameter of a Kotlin suspend function.
      Parameters:
      parameter - the method parameter to inspect, must not be null
      Returns:
      whether the given parameter is a CONTINUATION parameter of a Kotlin suspend function
    • getKotlinSuspendMethodResult

      public static Type getKotlinSuspendMethodResult(MethodInfo method)
      Returns the return type of the given Kotlin suspend function. If the given method is not a Kotlin suspend function or if the CONTINUATION parameter has an unexpected type signature, an IllegalArgumentException is thrown.
      Parameters:
      method - the Kotlin suspend function, must not be null
      Returns:
      the return type of the given Kotlin suspend function