JetBrains has officially announced the release of Kotlin 1.8, after the current release of the programming language was published on GitHub in December. New features include a new compiler parameter that disables optimizations to make debugging cleaner. There are also two experimental functions to recursively delete or copy directories.

Kotlin 1.8 also gets rid of two legacy issues. On the one hand, the old backend, which has been deprecated since version 1.5, is no longer available. At the time, JetBrains had stabilized a new common middle layer for all Kotlin’s multi-platform targets, i.e. the Java Virtual Machine (JVM), JavaScript and native applications, with the JVM IR (Intermediate Representation) backend.

On the other hand, Kotlin 1.8 no longer works with the outdated JVM targets 1.6 and 1.7, i.e. JDK 6 and 7 respectively. The standard libraries of the language are now compiled uniformly for JDK 8. so far were kotlin-stdlib, kotlin-reflectand kotlin-script-* compiled for JDK 6. If you needed the variants for a more up-to-date JDK, you had to explicitly use the Dependency kotlin-stdlib-jdk7 or kotlin-stdlib-jdk8 indicate. These entries should now be consistent through kotlin-stdlib be replaced.

The performance of the function has probably proved to be a positive side effect typeOf() in kotlin-reflect significantly improved, since caching is no longer internal, but via ClassValue he follows.

A new parameter causes the compiler to omit certain optimizations to make the code easier to debug. Deactivated in the first step -Xdebug only the so-called “Was Optimized Out” feature for coroutines, which uses variables in conjunction with potentially blocking functions (suspend Functions) optimized.

Currently still marked as experimental are the recursive deletion and copying of directories via deleteRecursively() respectively copyToRecursively() as extension functions for java.nio.file.Path. Details on enabling the experimental feature and error handling can be found in the Kotlin documentation.

Kotlin/Native for applications without a JVM brings a few additions that are primarily aimed at connecting to Swift and Objective-C. The newly introduced annotation @ObjCName allows you to define your own name for Swift or Objective-C beyond the Kotlin name for functions and methods, among other things, as the following example from the Kotlin documentation shows:

@ObjCName(swiftName = "MySwiftArray")
class MyKotlinArray {
    @ObjCName("index")
    fun indexOf(@ObjCName("of") element: String): Int = TODO()
}

// Usage with the ObjCName annotations
let array = MySwiftArray()
let index = array.index(of: "element")

The also new annotation @HiddenFromObjC completely hides a Kotlin declaration from the Objective-C API. Finally get oriented @ShouldRefineInSwift to Apple’s macro NS_REFINED_FOR_SWIFT for functions in which a wrapper in Swift should replace the original declaration. The Kotlin annotation ensures that a function as swift_private is marked.


JetBrains originally developed the Kotlin programming language for the Java Virtual Machine (JVM). It has been particularly successful on Android since Google officially included it in Android Studio as an alternative to Java in 2017 and declared it the first choice for the mobile operating system two years later. In the meantime, however, the programming language has been designed for various platforms: Kotlin/Native enables execution without a virtual machine, especially to cover platforms such as iOS, which do not have a JVM on board.

A connection to JavaScript is also available with Kotlin/JS, and since Kotlin 1.2 it is possible to create multiplatform projects that cover JVM and JavaScript with a code base. The name, which likes to attract trolls in forums in this country, owes the language to an island off St. Petersburg. The JetBrains team there initially developed Kotlin significantly. In March 2022, JetBrains closed all Russian branches and relocated employees to other countries in response to the Russian war of aggression in Ukraine.

In 2020, JetBrains started a unified release cycle for Kotlin: The company is scheduled to release a feature release with version 1.x every six months. Incremental releases with version number 1.x.y0 (1.8.10, 1.8.20, …) are scheduled to appear every two to three months, and bugfix releases with version number 1.x.yz (1.8.21 , 8/1/22, …).

Other innovations in Kotlin 1.8 can be found on the Kotlin blog. The full list of changes can be found in the GitHub repository.


(rm)

To home page

California18

Welcome to California18, your number one source for Breaking News from the World. We’re dedicated to giving you the very best of News.

Leave a Reply