Skip to content

BuiltinsVirtualFileProvider

Provides the .kotlin_builtins files that back the fallback built-ins of the analysis.

Built-ins normally resolve from the Kotlin stdlib among the analyzed module's dependencies, which ships .kotlin_builtins files of its own. The fallback built-ins are a second source, ordered behind every real dependency, so they answer only what the stdlib did not: a module with no stdlib on its dependency path, or a declaration its stdlib variant does not publish — kotlin-stdlib-common, for one, leaves built-in declarations out of its .kotlin_metadata files.

They therefore have to be there even when the analyzed project has no stdlib at all, which is why they are read from the classpath of the analysis implementation rather than from the project: resources of the Kotlin plugin in the IDE, entries of a JAR on the classpath in Standalone mode. Turning such a resource into a VirtualFile is what a platform supplies here.

A platform is expected to implement BuiltinsVirtualFileProviderBaseImpl instead of this class directly and register the result as an application service.

Inheritors

Constructors

BuiltinsVirtualFileProvider

constructor()

Types

Companion

object Companion

Functions

createBuiltinsScope

abstract fun createBuiltinsScope(project: Project): GlobalSearchScope

Creates a search scope covering exactly the files of getBuiltinVirtualFiles.

The scope is not a part of any module content, as built-ins do not belong to the analyzed project.

getBuiltinVirtualFiles

abstract fun getBuiltinVirtualFiles(): Set<VirtualFile>

Returns the virtual files of all built-in declaration files.