1. 程式人生 > >Kotlin 1.2.40 is out!

Kotlin 1.2.40 is out!

We’re happy to announce the release of Kotlin 1.2.40, a new bugfix and tooling update for Kotlin 1.2! This update:

  • Allows platform modules in experimental multiplatform projects to have more than one expectedBy dependency;
  • Enables support for crossinline suspend parameters in inline functions;
  • @JvmDefault
    annotation that makes interface methods default in Java (experimental);
  • Adds new inspections and intentions to the Kotlin IntelliJ plugin;
  • Deprecates using short names of types brought into the scope through subtyping of companion objects, without qualifying or importing them;
  • Fixes a lot of known issues in the compiler and the IDE plugin and provides performance improvements.

The update is compatible with all versions of IntelliJ IDEA from 2017.1 until 2018.1, as well as with Android Studio 3.0, 3.1, and 3.2 Canary.

The complete list of changes in this release can be found in the changelog.

Improvements for multiplatform projects

This update brings several improvements for the experimental multiplatform projects feature.

Platform modules are now allowed to reuse the code and provide actual platform-specific implementations for declarations from more than one common module. This is done by adding multiple expectedBy dependencies to the platform module, for example:

123456789 apply plugin:'kotlin-platform-jvm'// ...dependencies{expectedBy project(":io-common")expectedBy project(":data-common")// ...}

Note that expectedBy dependencies are still non-transitive, so if a common module, say, app-common, depends on another one, lib-common, then, in a platform module, you can either provide actual implementations for both, manually specifying the two as expectedBy dependencies, or add an expectedBy dependency on just app-common and a compile dependency on an existing platform module for lib-common.

Another improvement is the support for default parameters in expect functions and constructors:

Note that default parameter values are only allowed in expect declarations. Do not specify them for the actual counterparts.

Crossinline suspend function parameters

The update enables support for inline function crossinline parameters of suspend function types, which can then be called inside nested suspending functions and lambdas:

Support declaring Java default interface methods

This release brings experimental support for generating default interface methods for the JVM target 1.8 and above. This feature is disabled by default, you can enable it by passing a compiler flag -Xenable-jvm-default. Then an interface member with a body can be marked with the @JvmDefault annotation (from the kotlin.jvm package):

Since this functionality is experimental in Kotlin 1.2.x, its design and implementation may change in future updates, including the compiler flag name.

Visibility restrictions for types brought into scope through companion objects subtyping

To provide smooth migration with respect to potentially breaking changes in Kotlin 1.3 regarding classifiers visible through companion objects, this update introduces deprecation warnings and migration tools in the IDE plugin.

Now, whenever a body of a type Foo uses a short (non-qualified) type name that is declared in a supertype of Foo‘s own companion object, or in the companion objects of Foo‘s supertypes, as well as in the supertypes of these companion objects, without a proper import statement, a warning is issued with a quick-fix that adds the import. One example is:

In Kotlin 1.3, these short names are going to become invisible unless they are qualified or imported. The planned change has been tested on real projects with more than 1.5 million lines of Kotlin code in total, and the impact is expected to be minimal.

For detailed description and motivation of the change, see KT-21515.

IntelliJ IDEA plugin improvements

Intentions for adding and removing explicit return in a lambda

There’s a new intention for adding and removing explicit labeled return for the result expressions in lambdas:

Other changes in the IDE plugin

  • New intentions for adding and removing annotation use-site targets;
  • An inspection to highlight and remove unnecessary explicit companion object references;
  • A lot of stability and performance improvements.

Changes in the compiler

The Kotlin 1.2.40 update fixes several known issues in the Kotlin compiler and includes performance improvements.

The code that the compiler generates is now more efficient in several cases, such as accessing private properties of companion objects, checking enum entries for equality, and comparing Long numbers, thanks to our contributor Mikaël Peltier.

How to update

To update the plugin, use ToolsKotlinConfigure Kotlin Plugin Updates and press the Check for updates now button. Also, don’t forget to update the compiler and standard library version in your Maven and Gradle build scripts.

As usual, if you run into any problems with the new release, you’re welcome to ask for help on the forums, on Slack (get an invite here), or to report issues in the issue tracker.

Let’s Kotlin!

相關推薦

Kotlin 1.2.40 is out!

We’re happy to announce the release of Kotlin 1.2.40, a new bugfix and tooling update for Kotlin 1.2! This update: Allows platform modules in

Kotlin 1.2.30 is out

We’re happy to announce the release of Kotlin 1.2.30, a new bugfix and tooling update for Kotlin 1.2. This update: Adds a new declaration in

Kotlin 1.2.60 is out!

We’re happy to announce the release of Kotlin 1.2.60, a new bugfix and tooling update for Kotlin 1.2. This release: Adds optional expected an

Kotlin 1.2.50 is out!

We’re happy to announce the release of Kotlin 1.2.50, a new bugfix and tooling update for Kotlin 1.2. This release: Updates Kotlin support in

Kotlin 1.2.70 is Out!

We’re happy to announce the release of Kotlin 1.2.70, a new bugfix and tooling update for Kotlin 1.2. This release: Significantly improves in

springboot 1.5.10 +kotlin 1.2.20 解決 java.lang.ClassNotFoundException: kotlin.reflect.KotlinReflectionInternalError

exceptio pri pla nbsp http art fas cep start.s 使用http://start.spring.io/ 下載的 項目 跑單元測試 報 java.lang.ClassNotFoundException: kotlin.reflect.

Kotlin 1.2 新特性

Kotlin JavaScript JVM 點擊關註異步圖書,置頂公眾號每天與你分享IT好書 技術幹貨 職場知識在Kotlin 1.1中,團隊正式發布了JavaScript目標,允許開發者將Kotlin代碼編譯為JS並在瀏覽器中運行。在Kotlin 1.2中,團隊增加了在JVM和JavaScrip

Kotlin 1.3 RC is Here: Migrate Your Coroutines!

We’re proud to introduce Kotlin 1.3-RC, the latest preview and release candidate for 1.3.0. This release mostly contains critical bug-fixes re

index 2 is out of bounds for axis 1 with size 2

在使用類似  keras.np_utils.to_categorical 的函式,對標籤轉換成one-hot編碼的時候,要使標籤從0開始。即如果是兩類,設標籤裡面的內容為0和1,不能設定為1和2或其他數字。 比如: from keras.utils import np_util

Python實現groupBy函數。grpby = groupBy(lambda x: x%2 is 1),grpby([1, 2, 3])的結果為{True: [1, 3], False: [2]}

結果 false n) pen als 不存在 def lam nbsp def groupBy(fn): def go(lst): m = {} for v in lst: m[fn(v)].append(v) if m.get(fn(v

Error:Minimum supported Gradle version is 2.14.1. Current version is 2.10.原因分析和解決。

圖片 幫助 url err ... tle IT .net fcm 最近和主管一起開發項目一直出現這個問題: Error:Minimum supported Gradle version is 2.14.1. Current version is 12.10. If usi

解決 You are using pip version 7.1.2, however version 18.0 is available.報錯

完美 bsp -- 安裝目錄 方法 exe win .exe 嘗試 Windows下安裝 Pyhton的mysql庫時 命令行一直報 You are using pip version 7.1.2, however version 18.0 is available

用正則表達式實現 運算 express = '1 -2* ((60-30 +(-40/5) *(9-2*5/3 +7 /3*99 /4*2998 +10 *568 /14))-(-4*3)/(16-3*2))'

repl bsp val 實現 strip expr 運算 lac spl #!/usr/bin/env python # coding:utf-8 import re def dealwith(express): express.replace(‘+-‘,‘

[python問題] You are using pip version 7.1.2, however version 18.1 is available

 在windows環境下在安裝paramiko的時候 ,使用命令python -m pip install paramiko 一直報錯  You are using pip version 7.1.2, however version 18.1 is available  解決辦法,pip版本升級。在Py

ubuntu18.04安裝pip3 Depends: python-pip-whl (= 8.1.1-2) but 8.1.1-2ubuntu0.4 is to be installed

下了個ubuntu18.04,更新源後安裝pip3 apt install python3-pip 結果居然報錯了 Reading package lists... Done Building dependency tree Reading state inf

解決MySQL_python-1.2.5-cp27-none-win_amd64.whl is not a supported wheel on this platform.(win10)

一、問題情境 本想用django搭建個小部落格,但是在Windows10的DOS下安裝mysql驅動時, 總是報錯:MySQL_python-1.2.5-cp27-none-win_amd64.whl is not a supported wheel on this platform.

python報錯 ValueError: dictionary update sequence element #0 has length 1; 2 is require

原文連結地址: https://blog.csdn.net/weixin_40894428/article/details/80683137 字串轉字典要用eval(),這個方法很多書上都沒有介紹, 有關eval()的用法,傳送門: http://www.runoob.com/python/

安裝MySQL_python-1.2.5-cp27-none-win_amd64.whl is not a supported wheel on this platform.

安裝了python,想用python來連線資料庫,需要安裝mysql-python包。 在https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python

【C++深度剖析教程40】使用數值型模板技術計算1+2+3+...+N的值

上一篇文章學習了數值型模板技術,並利用相關技術,實現了C++的陣列類模板。點選文章檢視上一篇文章:點選連結檢視 本篇文章,繼續利用模板技術來解決一個問題。 如果想求1+2+3+…+N的結果,有很多種方法。可以迴圈遍歷,可以直接使用公式求解。但是他們都不是最快的方法,我們今天使用模

Spring Boot - An incompatible version [1.2.12] of the APR based Apache Tomcat Native library is...

Spring Boot在目前的專案開發中已經逐步火熱起來,既然是一種技術在使用的過程中出現問題在所難免,在一次初始化Spring Boot專案啟動時,我遇到了一個啟動失敗的問題,日誌給出的資訊An incompatible version [1.1.14] of the APR ba