Kotlin 1.2 M2 released

Milestone release 2 of official supported Android language is out now 
10 August 2017   1195

Jet Brains works hard to make Kotlin coders happy. Recently, Kotlin 1.2 M2 was released.

This released is focused on stability and bugfixes to Kotlin compiler and tooling. Also, there are some improvements of Kotlin standart library.  It also includes many of the tooling features available in the upcoming release of Kotlin 1.1.4.

Let's see what's inside!

Revised windowed/pairwise operations

Changes to hunked, windowed, pairwise functions:

  • windowed function now has its step parameter defaulting to 1.
    It also gets an additional optional parameter partialWindows, which controls what to do with incomplete windows in the end. By default it is false, which means incomplete windows are dropped.
  • pairwise function name was too confusing, it was unclear how it paired the elements together. Now it is called zipWithNext, so it is more clear that each element is zipped with the next element in a collection.

Common math operations in the standard library

kotlin.math package now released:

  • constants: PI and E;
  • trigonometric: cossintan and inverse of them: acosasinatanatan2;
  • hyperbolic: coshsinhtanh;
  • exponentation: pow (an extension function), sqrthypotexpexpm1;
  • logarithms: loglog2log10lnln1p;
  • rounding:
    • ceilfloortruncateround (half to even) functions;
    • roundToIntroundToLong (half to integer) extension functions;
  • sign and absolute value:
    • abs and sign functions;
    • absoluteValue and sign extension properties;
    • withSign extension function;
  • max and min of two values;
  • binary representation:
    • ulp extension property;
    • nextUpnextDownnextTowards extension functions;
    • toBitstoRawBitsDouble.fromBits (these are in the kotlin package).

The same set of functions (but without constants) is also available for Float arguments.
Most of these functions (except the binary representation group) are also available in JS, thus solving the problem of writing the same calculations for both platforms.

Full release notes:

Android

  • Android Extensions fails to compile when importing synthetic properties for layouts in other modules

Compiler

  • Switch warning to error for java-default method calls within 1.6 target
  • Do not use non-existing class for suspend markers
  • Exception on building gradle project with collection literals
  • Fix collection literals resolve in gradle-based projects

IDE. Inspections and Intentions

  • Circular autofix actions between redundant modality and non-final variable with allopen plugin 
  • "Protected in final" inspection works incorrectly with all-open
  • "Redundant modality" is not reported with all-open
  • Redundant "make open" for abstract class member with all-open

Standard Library

  • windowed function: make default step equals to 1, add partialWindows parameter
  • rename pairwise function to zipWithNext
  • Support math operations in stdlib
  • Provide Double and Float bit conversion functions as extensions

Tools. kapt

  • Kapt3, IC: Kapt does not generate annotation value for constant values in documented types

 

JetBrains to Roll Out Ktor Framework

Framework is suitable for writing back-end projects and microservices in the Kotlin language
20 November 2018   437

JetBrains developers told about the release of the stable version of the Ktor 1.0 framework. It helps to create asynchronous servers and clients in related systems. According to the creators, the framework is suitable for writing back-end projects and microservices in the Kotlin language. Documentation and project generator are published on the official website.

First of all, it is worth noting that this is an open source project that is distributed under the Apache 2 license. The main components are:

  • HTTP server running on a virtual machine. It works on Netty, Jetty, and server-side Java programs. It can be placed in a container, embedded in desktop or Android applications, as well as run on Tomcat. Moreover, it corresponds to the paradigm of the application of twelve factors.
  • Multiplatform HTTP client. Although asynchronous, it uses the same coroutines and I / O elements that control the server.

Tools will help the developer to customize the main components of the application.

The Kotlin / Native project supports Ktor, starting with version 0.8. In this case, the working version of Kotlin / Native 0.9 was released in early September 2018. In it, developers added support for unsigned types and interoperability with C, Objective-C / Swift.