kotlin

package
v0.29.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKotlinIndices

func BuildKotlinIndices(
	kotlinFiles []string,
	contentReader vcs.ContentReader,
) (map[string][]string, map[string]map[string][]string, map[string]string)

func ExtractCalledFunctionNames added in v0.27.0

func ExtractCalledFunctionNames(sourceCode []byte) []string

ExtractCalledFunctionNames returns the callee names of unqualified call expressions (e.g. `foo()` but not `x.foo()`). Used to resolve same-package top-level function calls, which ExtractTypeIdentifiers deliberately ignores (it captures only type references). Resolution stays precise: a name only produces an edge when the package index holds exactly one declaring file.

func ExtractPackageDeclaration

func ExtractPackageDeclaration(sourceCode []byte) string

ExtractPackageDeclaration extracts the package declaration from Kotlin source code

func ExtractTopLevelFunctionNames added in v0.27.0

func ExtractTopLevelFunctionNames(sourceCode []byte) []string

ExtractTopLevelFunctionNames returns the names of functions declared at the top level of the file. Kotlin same-package free-function calls carry no import, so these must be indexed for an unqualified call to resolve to its defining file.

func ExtractTopLevelTypeNames

func ExtractTopLevelTypeNames(sourceCode []byte) []string

ExtractTopLevelTypeNames returns the class/object/interface/typealias names declared at the top level of the file

func ExtractTypeIdentifiers

func ExtractTypeIdentifiers(sourceCode []byte) []string

ExtractTypeIdentifiers returns all type identifiers referenced within the file

func IsTestFile

func IsTestFile(filePath string) bool

IsTestFile reports whether the given Kotlin file path is a test file.

func ResolveKotlinProjectImports

func ResolveKotlinProjectImports(
	absPath string,
	filePath string,
	kotlinPackageIndex map[string][]string,
	kotlinPackageTypes map[string]map[string][]string,
	kotlinFilePackages map[string]string,
	suppliedFiles map[string]bool,
	contentReader vcs.ContentReader,
) ([]string, error)

Types

type ExternalImport

type ExternalImport struct {
	// contains filtered or unexported fields
}

ExternalImport represents an external library import

func (ExternalImport) IsWildcard

func (e ExternalImport) IsWildcard() bool

func (ExternalImport) Package

func (e ExternalImport) Package() string

func (ExternalImport) Path

func (e ExternalImport) Path() string

type InternalImport

type InternalImport struct {
	// contains filtered or unexported fields
}

InternalImport represents an internal project import

func (InternalImport) IsWildcard

func (i InternalImport) IsWildcard() bool

func (InternalImport) Package

func (i InternalImport) Package() string

func (InternalImport) Path

func (i InternalImport) Path() string

type KotlinImport

type KotlinImport interface {
	Path() string
	IsWildcard() bool
	Package() string
}

KotlinImport represents an import in a Kotlin file

func ClassifyWithProjectPackages

func ClassifyWithProjectPackages(imports []KotlinImport, projectPackages map[string]bool) []KotlinImport

ClassifyWithProjectPackages reclassifies imports with knowledge of project packages This is used during graph building when we know all project packages

func KotlinImports

func KotlinImports(filePath string) ([]KotlinImport, error)

KotlinImports parses a Kotlin file and returns its imports

func ParseKotlinImports

func ParseKotlinImports(sourceCode []byte) ([]KotlinImport, error)

ParseKotlinImports parses Kotlin source code and extracts imports

type Provider added in v0.27.0

type Provider struct{}

func (Provider) Extensions added in v0.27.0

func (Provider) Extensions() []string

func (Provider) IsTestFile added in v0.27.0

func (Provider) IsTestFile(filePath string, _ vcs.ContentReader) bool

func (Provider) Maturity added in v0.27.0

func (Provider) Maturity() moduleapi.MaturityLevel

func (Provider) Name added in v0.27.0

func (Provider) Name() string

func (Provider) NewResolver added in v0.27.0

func (Provider) NewResolver(ctx *moduleapi.Context, contentReader vcs.ContentReader) moduleapi.Resolver

type StandardLibraryImport

type StandardLibraryImport struct {
	// contains filtered or unexported fields
}

StandardLibraryImport represents a Kotlin/Java/Android standard library import

func (StandardLibraryImport) IsWildcard

func (s StandardLibraryImport) IsWildcard() bool

func (StandardLibraryImport) Package

func (s StandardLibraryImport) Package() string

func (StandardLibraryImport) Path

func (s StandardLibraryImport) Path() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL