Kotlin 1.2 M2 Released

JetBrains has released a new version of its most popular programming language, Kotlin. The new version, Kotlin 1.2 M2 focuses on the stability and bugfixes in Kotlin compiler and has some breaking changes including improvements in Kotlin standard library.
 
In the official announcement, the company has listed the following major changes,
 
Compiler
Breaking change: Java-default method calls

Up to now, Kotlin interface members overriding Java-default methods while targeting JVM 1.6 produced a warning on super calls: Super calls to Java default methods are deprecated in JVM target 1.6. Recompile with '-jvm-target 1.8'. In 1.2-M2 release we’ve replaced the warning with error, thus requiring any such code to be compiled with -jvm-target 1.8 option

Standard library
Revised windowed/pairwise operations

We have been listening to your feedback about chunked/windowed/pairwise functions KEEP-11, which were released to preview in the previous milestone 1.2-M1, and based on it, we decided to make some changes to these 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.”
 
Source: blog.jetbrains.com
 
Also, the company has introduced several groups of Math API in the kotlin.math package, as mentioned below -
  • constants: PI and E;
  • trigonometric: cos, sin, tan and inverse of them: acos, asin, atan, atan2;
  • hyperbolic: cosh, sinh, tanh;
  • exponentation: pow (an extension function), sqrt, hypot, exp, expm1;
  • logarithms: log, log2, log10, ln, ln1p;
  • rounding:
  • ceil, floor, truncate, round (half to even) functions;
  • roundToInt, roundToLong (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;
  • nextUp, nextDown, nextTowards extension functions;
  • toBits, toRawBits, Double.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.
 
You can read the changelog or download Kotlin 1.2 M2 from GitHub.