Skip to content

KaModulePlatformKind

The module platform kind classifies a KaModule's TargetPlatform into a single kind, determining how the Analysis API interprets the module.

It is either a single kind of concrete platform (JVM, JS, WASM, NATIVE), or METADATA when the module's TargetPlatform contains multiple kinds of concrete platforms.

This classification determines:

  • The kind of session built for the module and its platform-specific symbol loading.

    • For example, while we load Java symbols in a JVM session, we do not do the same in a JVM+Native metadata session. Java symbols cannot be accessed from Native, and so such symbols should not be loaded in a metadata context.
  • The module's expected layout (e.g., JAR vs. Klib library roots) and associated content scope restrictions for library modules.

Platform-specific, composable configurations are instead applied based on the TargetPlatform's component platforms.

There is an important difference to isMultiPlatform: A target platform with multiple JvmPlatforms can be multiplatform, while the module platform kind would still be JVM rather than METADATA. A METADATA module platform kind must always come from a target platform with multiple kinds of component platforms.

Entries

METADATA

Represents a metadata module.

JVM

JVM

Represents a JVM module.

JS

JS

Represents a JS module.

WASM

Represents a Wasm module.

NATIVE

Represents a Native module.

Companion properties

entries

Returns an immutable kotlin.enums.EnumEntries list containing the constants of this enum type, in the order they're declared.

Companion functions

valueOf

Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Throws

kotlin.IllegalArgumentException

if this enum type has no constant with the specified name

values

Returns an array containing the constants of this enum type, in the order they're declared.

This method may be used to iterate over the constants.

The function returns a new instance of the array on every call. The array could be mutated, so working with it may also require defensive copying. Consider using entries property as a more efficient alternative returning an immutable list of enum entries.

Properties

name

val name: String

ordinal

val ordinal: Int