Перейти к содержимому

Эта страница ещё не переведена и показана на английском.

JVM APIs

What Java and Kotlin programs run by Elide can use: the bundled JDK 25 and Kotlin 2.5 standard library, the libraries Elide puts on each classpath, and what is not available.

На этой странице
Open in ChatGPTOpen in Claude

Elide compiles Java and Kotlin with its bundled javac and kotlinc and runs the program on the bundled JDK in a separate process. The program can use the JDK, the Kotlin standard library, the libraries listed below and its own Maven dependencies.

// Versions.kt
fun main() {
  println("JDK ${Runtime.version().feature()}, Kotlin ${KotlinVersion.CURRENT}")
}
elide run Versions.kt
JDK 25, Kotlin 2.5.0
ComponentVersion
JDK25
Kotlin compiler and standard library2.5.0-Beta1
Elide annotations (dev.elide:elide-api)1.0.0

Single-file runs

elide run Main.java or elide run Main.kt outside a project compiles against this classpath:

LanguageClasspath besides the JDK
JavaElide annotations
KotlinElide annotations, Standard library, kotlin-reflect, kotlinx coroutines, serialization (core and JSON), datetime, io, collections-immutable, html and atomicfu

Kotlin files compile with the kotlinx.serialization and atomicfu compiler plugins. A Kotlin file cannot import Metro; use a project for that.

Inside a project directory (one with an elide.pkl, or below one), a single file also gets that project’s dependencies.

Projects

elide build, elide run and elide test add these libraries to Kotlin source sets. Java source sets get only the JUnit libraries on test sets. The switches go in kotlin.features, except JUnit’s: jvm.features.testing, which removes the bundled JUnit compile APIs and runtime when false; JVM test runs then need junit-platform-console in testPackages.

LibraryVersionMainTestsTurn off with
Elide annotations (dev.elide:elide-api)1.0.0Compile, runInherited—
kotlin-stdlib2.5.0-Beta1Compile, runInherited—
kotlin-reflect2.5.0-Beta1Compile, runInheritedreflection = false
kotlinx-coroutines-core1.11.0Compile, runInheritedcoroutines = false or kotlinx = false
kotlinx-serialization-core, -json1.11.0Compile, runInheritedserialization = false or kotlinx = false
Metro runtime (dev.zacsweers.metro:runtime)1.4.5Compile, runInheritedmetro = false
kotlin-test, kotlin-test-junit52.5.0-Beta1—Compile, runtesting = false
kotlinx-coroutines-test1.11.0—Compile, runcoroutines = false
JUnit Jupiter API and params6.1.3—Compile, runjvm.features.testing
JUnit Jupiter engine and Platform6.1.3—Runjvm.features.testing

A Java project adds Elide annotations as a compileOnly dependency; see Elide annotations. Other bundled libraries are linked from the binary, without a download, when a project declares them at the bundled version; see Bundled libraries.

elide classpath prints the main classpath; elide classpath test:compile prints what a test set adds.

Not available

Not availableDetail
Elide runtime APIJVM programs have no Elide global or other runtime object; dev.elide.annotations is the only Elide package.
Calls to or from JavaScript and PythonThe program runs in its own process, and --interop does not apply. See Languages.
OpenTelemetryElide injects no OpenTelemetry API, agent or trace context into JVM programs. See OpenTelemetry.

Reference

PageCovers
Elide annotationsEvery annotation in dev.elide.annotations: targets, retention and effect.
Bundled librarieskotlinx coroutines and serialization, other kotlinx libraries, Metro, JUnit and kotlin.test.
Insight for JVM programs--insights scripts and classes on a JVM project run.

Samples

Была ли эта страница полезной?