Skip to content

KtImportInfo

interface KtImportInfo

A representation-agnostic view of a single import statement.

The same information is available whether the import is backed by a full KtImportDirective PSI element or by a lightweight stub, so consumers that only need the imported name, alias, or all-under flag can work uniformly against either representation.

Example:

import kotlin.collections.List as KList  // importedFqName = kotlin.collections.List, aliasName = "KList"
import kotlin.collections.*              // isAllUnder = true

Inheritors

Types

ImportContent

sealed class ImportContent

The imported reference, either as a resolved fully qualified name or as the raw reference expression.

Properties

aliasName

abstract val aliasName: String?

The alias assigned with as, or null if the import has no alias.

importContent

The imported reference, or null if it is missing in incomplete code.

importedFqName

abstract val importedFqName: FqName?

The fully qualified name being imported, or null if it cannot be determined.

importedName

open val importedName: Name?

The name under which the imported declaration becomes visible: the alias if present, otherwise the short name of the imported reference. null for an all-under import or when the name cannot be determined.

isAllUnder

abstract val isAllUnder: Boolean

true for an all-under import (import foo.*), which imports all members of the given scope.