With the August 6 production debut of the Android 9 Pie mobile OS, Google has released an Android SDK with special capabilities for development with the Kotlin language.

The SDK has nullability annotations for frequently used APIs, preserving null-safety guarantees when Kotlin code is calling into annotated APIs in the SDK. To ensure that newly annotated APIs are compatible with existing code, an internal mechanism provided by the Kotlin compiler team marks APIs as recently annotated. These APIs result in warnings instead of errors from the Kotlin compiler. Developers need to use Kotlin 1.2.60 or later.

The intention is for newly added nullability annotations to only produce warnings, with the severity level increased to errors starting in a subsequent SDK. Google wants to give developers time to update their code by this stepped error messaging.

Google has endorsed Kotlin for use in building Android applications. But nullability annotations also can benefit developers using Java, the traditional language of Android development, if they use the Android Studio IDE to find nullability contract violations. Plans call for adding more nullability annotations to existing Android APIs in future versions of the SDK as well as ensuring new APIs are annotated.



READ SOURCE

LEAVE A REPLY

Please enter your comment!
Please enter your name here