Interface KotlinMethodElement

All Superinterfaces:
AnnotatedElement, AnnotationMetadata, AnnotationMetadataDelegate, AnnotationMetadataProvider, AnnotationSource, Described, Element, MemberElement, MethodElement, MutableAnnotationMetadataDelegate<Element>, Named

public interface KotlinMethodElement extends MethodElement
Represents a Kotlin method or constructor.

Implementing this interface signals that defaulted parameters follow Kotlin's calling convention, and tells generated code where to find the synthetic $default overload that convention relies on. It is the method-level companion of KotlinParameterElement, which marks that same convention on a parameter.

This is not a way to describe a default value: a Kotlin default is computed by the callee, inside the $default body, and cannot be materialised by the caller. Languages evaluating their defaults in the caller supply an expression through io.micronaut.inject.writer.ParameterDefaultValueProvider instead, and need neither this interface nor the overload it locates.

Since:
5.2.0
Author:
Denis Stepanov
  • Method Details

    • getKotlinDefaultsTypeName

      @NonNull @NonNull String getKotlinDefaultsTypeName()
      The name of the type declaring the synthetic $default method that applies this method's Kotlin default arguments.

      For a method declared by a class this is the declaring class itself, but a method declared by an interface has its $default overload emitted either on the interface or on the interface's DefaultImpls class, depending on the -jvm-default mode the interface was compiled with.

      Returns:
      The type name, in the binary form Element.getName() is in, with nested types separated by $