KaJavaInteroperabilityComponent¶
@SubclassOptInRequired(markerClass = [KaSessionComponentImplementationDetail::class])
interface KaJavaInteroperabilityComponent : KaSessionComponent
Inheritors¶
Properties¶
callableSymbol¶
abstract val PsiMember.callableSymbol: KaCallableSymbol?
A KaCallableSymbol for the given PsiMember method or field, or null for local declarations and Kotlin light classes.
containingJvmClassName¶
abstract val KaCallableSymbol.containingJvmClassName: String?
The containing JVM class name for the given KaCallableSymbol.
The property works for both source and library declarations. The JVM class name is a fully qualified name separated by dots, such as foo.bar.Baz.Companion.
Applicable only to JVM modules, and common modules with JVM targets. containingJvmClassName is always null all other kinds of modules.
isPrimitiveBacked¶
abstract val KaType.isPrimitiveBacked: Boolean
Whether the given KaType is backed by a single JVM primitive type.
This is true for non-nullable primitive types and for non-nullable inline value class types whose single underlying property is primitive-backed, recursively. It is false for nullable types, regular reference types, and types without a single primitive-backed representation.
Only the inline representation counts. A full value class is compiled as a regular class on the JVM, so it is never primitive-backed, even with exactly one primary property; see org.jetbrains.kotlin.analysis.api.symbols.KaNamedClassSymbol.isInline.
This property describes the type's underlying representation. It does not imply that every use of the type is emitted as a JVM primitive, as boxing can still be required by the use-site context.
For non-JVM modules, the result describes the equivalent JVM representation inferred from the Kotlin declaration.
namedClassSymbol¶
abstract val PsiClass.namedClassSymbol: KaNamedClassSymbol?
A KaNamedClassSymbol for the given PsiClass, or null for anonymous classes, local classes, type parameters (which are also PsiClasses), and Kotlin light classes.
token¶
abstract val token: KaLifetimeToken
The KaLifetimeToken which determines the lifetime of the lifetime owner.
Functions¶
asKaType¶
Converts the given PsiType to a KaType in the context of the useSitePosition.
useSitePosition clarifies how to resolve some parts of the PsiType. For instance, it can be used to collect type parameters and apply them during the conversion.
Receiver
The PsiType to be converted.
Return
The converted KaType, or null if conversion is not possible. For example, PsiType might not be resolvable.
asPsiType¶
Converts the given KaType to a PsiType in the context of the useSitePosition.
PsiType is JVM conception, so this method will return null for non-JVM platforms, unless allowNonJvmPlatforms is set.
Receiver
The KaType to convert.
Parameters
-
useSitePosition: Determines whether the given
KaTypeneeds to be approximated. For instance, if the given type is local but the use site is in the same local scope, we do not need to approximate the local type. However, when exposed to the public as a return type, the resulting type must be approximated accordingly. -
allowErrorTypes: Determines whether the
KaTypeshould still be converted if it contains an error type. When this option isfalse, the result will benullif theKaTypecontains an error type. Whentrue, erroneous types will be replaced with theerror.NonExistentClasstype. -
suppressWildcards: Indicates whether wildcards in type arguments should be suppressed. This option works similar to adding a
JvmSuppressWildcardsannotation to the containing declaration. -
truemeans they should be suppressed. -
falsemeans they should appear. -
nullmeans that the default applies, where wildcard suppression/appearance is determined by type annotations. -
preserveAnnotations: Whether annotations from the original
KaTypeshould be included in the resulting PsiType with an appropriate conversion. -
allowNonJvmPlatforms: Whether the PsiType should be computed even for non-JVM modules. The flag provides no validity guarantees – the returned type may be unresolvable from Java, or
null.
assertIsValidAndAccessible¶
inline fun KaLifetimeOwner.assertIsValidAndAccessible()
isValid¶
fun KaLifetimeOwner.isValid(): Boolean
Whether the lifetime owner is still valid, i.e. we are still in the scope of the lifetime owner's regular lifetime.
mapToJvmTypeDescriptor¶
abstract fun KaType.mapToJvmTypeDescriptor(): String
Convert the given KaType to a JVM type descriptor with the KaTypeMappingMode.DEFAULT. To learn more about JVM descriptors, check out the JVM specification.
withValidityAssertion¶
inline fun <R> KaLifetimeOwner.withValidityAssertion(action: () -> R): R
Executes action only if the KaLifetimeOwner is still valid and accessible. Otherwise, throws a validity exception based on the concrete violation.