Google releases alpha version of the Kotlin Symbol Processing
Google wants to help make building lightweight compiler plugins in Kotlin easier as well as address some of the challenges developers face with the programming language. For instance, developers have struggled with the language’s lack of a native annotation processing system. To address these issues, the company has announced the alpha version of Kotlin Symbol Processing (KSP).
KSP features similar functionality to Kotlin’s KAPT compiler plugin, but is up to 2x faster and offers direct access to Kotlin compiler features. It is being developed with multi platform compatibility in mind, according to Ting-Yuan Huang, a software engineer and David Winer, a product manager at Android.
“This is the goal of KSP: most Android app developers don’t need to worry about its internals; other than this one line change, a library that supports KSP looks just like a normal annotation processor, only it’s up to 2x faster,” the Android development team wrote in a blog post.
The KSP playground project is available on GitHub and it contains a toy test-processor library that implements the builder pattern as a KSP processor and a workload directory that shows how to use the builder processor in a real-world Kotlin project.
Additionally, JetBrains released Kotlin 1.4.3 this month with a new JVM backend as well as new language and multi-platform features.
The new JVM backend reached beta and it now produces stable binaries, which means it’s safe for use, according to JetBrains.
The new version also previews language features that are planned for release in Kotlin 1.5.0.
Inline classes have now become a specific JVM optimization for a value class with one parameter, whereas they were a separate language feature before.
Another addition is Java records, which is analogous to Kotlin data classes and mainly used as simple holders of data. Interfaces can also be declared and sealed as well as classes.
In the Kotlin update, the Kotlin Gradle plugin is compatible with the Gradle configuration cache, which helps to speed up the build process, according to Alina Grebenkina, the marketing communications lead at JetBrains, in a blog post.
When running a command, Gradle executes the configuration phase and calculates the task graph. However, this feature is still in alpha for multiplatform.
The compilation time taken to rebuild the KMM Networking and data storage sample framework was reduced from 9.5 seconds to 4.5, the team explained. Kotlin also now offers 64-bit watchOS simulator and Xcode 12.2 SDK support.
When it comes to standard library changes, Kotlin 1.43.0 includes an experimental locale-agnostic API for changing the case of strings and characters. The update also separates Char conversions into two sets of clearly named functions including functions that get the integer code of Char and to construct Char, and functions to convert Char to the numeric value of the digit it represents.
Credit: Source link