Understanding the Functionality of Kotlin Jupyter API Annotations in Java Class Libraries
kotlin
import kotlin.jupyter.api.*
@JvmName("helloWorld")
fun helloWorld() {
println("Hello, world!")
}
@JvmName("sum")
fun sum(a: Int, b: Int): Int {
return a + b
}
val metadata = KotlinKernelMetadata {
kernelString("kotlin")
languageVersion(1, 4)
autoCompletion {
addStaticImport("kotlin.completions.CompletionClass", "COMPLETION_CONSTANT")
}
kernelDeprecation {
replaceMethods("kotlin.deprecations.DeprecatedClass", "oldMethod", "newMethod")
}
}
val api = kotlinKernelApi {
publish {
classSignature(klass<SomeClass>()) {
methods {
method<SomeClass, String>("someMethod") {
defaultValue("default value")
}
}
}
}
}
fun main() {
HelloWorldProvider().register(host.runtime)
}