Paul Krill
Editor at Large

Kotlin 1.7.0 beta alters builder type inference

news
May 17, 20222 mins

A new memory manager is also featured in the planned language upgrade.

time / clock / history / coffee / java
Credit: Matthew Kerslake

Kotlin 1.7.0, a planned new version of JetBrains’ cross-platform, multipurpose programming language, has reached a beta release stage, featuring changes to the builder type inference and a new memory manager.

Builder inference, a special kind of type inference useful when calling generic builder functions, brings the platform closer to builder inference stabilization. With the 1.7.0 beta, builder inference is automatically activated if a regular type inference cannot get enough information about a type without specifying the –Xenable-builder-inference compiler option. Developers now can write their own builders that use builder type inference without applying additional annotations or options. Builder type inference helps the compiler infer the type arguments via type information about other calls inside a lambda argument.

Also in the beta, an alpha version of a new Kotlin/Native memory manager is featured, bringing performance improvements to better the developer experience. The manager eliminates differences between the JVM and Native platforms. Developers will have an easier time building cross-platform mobile applications that work on both Android and iOS, according to JetBrains. Also, restrictions are removed on object-sharing between threads, and leak-free concurrent programming primitives are provided that do not require special management or annotations. The new memory manager will become the default in future versions.

Instructions on installing Kotlin 1.7.0 beta can be found at blog.jetbrains.com. Other features in the beta include:

  • Stabilizing of definitely non-nullable types, introduced in Kotlin 1.6.20 last month and now enabled by default. This gives developers types for better interoperability when extending generic Java classes and interfaces.
  • Original function names are reintroduced for min() and max() collection functions. These had been renamed in Kotlin 1.4 to minOrNull() and maxOrNull(), to better reflect behavior returning null if the receiver collection is empty and to help align the functions’ behavior with naming conventions used in the Kotlin collections API. The new beta reintroduces the original function names but with a non-nullable return type.
  • Group names can be used when backreferencing groups.
  • Named group references can be used with replacement expressions.
  • Starting with the 1.7.0 beta, cadence terminology has been updated by changing “Milestone” to “Beta.”
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author