Kotlin 1.5.0 stabilizes unsigned integer types
Kotlin 1.5.0, an upgrade to JetBrains’ statically typed language, has moved to a release candidate stage and is now feature-complete. Highlights include unsigned integer types and an improved testing library.
With Kotlin 1.5.0, unsigned integer types, available in beta since Kotlin 1.3, are classified as stable, making them safe to use in real projects and available without opt-in. Unsigned integer types include
UShort, and related functions. The standard library’s unsigned integer API is useful for dealing with non-negative integer operations. The newly stable APIs include unsigned integers, ranges and progressions of unsigned integer types, and functions that operate with unsigned integer types. Arrays of unsigned integers are still in beta.
Installation instructions for the release candidate, which was introduced April 13, can be found at kotlinlang.org. Also in the Kotlin 1.5.0 release candidate:
- Kotlin now has a way to use the modern non-blocking Java IO in Kotlin-idiomatic style via extension functions for
java.nio.file.Path. These extensions are now available without opt-in.
- A locale-agnostic API is offered for changing the case of strings and characters.
- A set of new functions is offered for conversion between characters and their integer codes and numeric values.
- For the test library, a single
kotlin-testdependency is offered for multiplatform projects. Also, developers have an automatic choice of a testing framework for Kotlin/JVM source sets. There also are assertion function updates.
- Kotlin’s builders continue to extend the multiplatform part of the standard library to provide all capabilities to the multiplatform project. Now, they have made a number of
Charfunctions available on all platforms and in common code.
- Case-sensitive strict versions of the
String?.toBolean()are enabled to prevent errors pertaining to Booleans and strings.
Durationclass in the duration and time measurement API, for measuring time intervals, has been changed significantly in both the API and internal representation. For example,
Durationnow uses a
Longvalue for the internal representation instead of
Double. There also are new factory functions for creating
Durationinstances from integer values.
floordiv()function performs floored division on integers. Also a
()modefunction returns the modulus that is the remainder of the floored division.