1. XenForo 1.5.14 中文版——支持中文搜索!现已发布!查看详情
  2. Xenforo 爱好者讨论群:215909318 XenForo专区

新闻 Kotlin 1.2 发布,实现平台间共享代码 下载

本帖由 漂亮的石头2017-11-29 发布。版面名称:软件资讯

  1. 漂亮的石头

    漂亮的石头 版主 管理成员

    注册:
    2012-02-10
    帖子:
    488,069
    赞:
    47
    [​IMG]

    Kotlin 1.2 发布了。多平台项目允许您从相同的代码库构建应用程序的多个层 - 后端,前端和 Android 应用程序。 这样的项目包含了独立于平台的代码的通用模块,以及特定平台(JVM 或 JS)的代码的特定模块,并且可以使用平台特定的库。 要从通用模块中调用特定于平台的代码,您可以指定预期的声明 - 所有平台特定模块需要提供实际实现的声明。

    [​IMG]

    如前所述,开发团队也在研究一系列通用库,以便将更多的逻辑转移到通用代码中:


    • kotlin.test, 在Kotlin 1.2开箱即用,只要编写一次测试就能在 JVM 和 JS 下运行;


    • kotlinx.html 支持同构渲染 - 使用相同的代码在后端和前端渲染 HTML;


    • kotlinx.serialization 允许您使用 JSON 或 ProtoBuf 作为序列化格式,轻松地将 Kotlin 对象封装在应用程序的不同层之间。

    编译性能提升 25%,下图显示了使用 Kotlin 构建的两个大型 JetBrains 项目的编译时间差异:

    [​IMG]

    其他改进:


    • A more concise syntax for passing multiple arguments to an annotation (array literals);


    • Support for the lateinit modifier on top-level properties and local variables, as well as checking whether a lateinit variable is initialized;


    • Smarter smart casts and improved type inference in certain cases;


    • Compatibility of the standard library with the split package restrictions introduced in Java 9;


    • New kotlin.math package in the standard library;


    • New standard library functions for working with sequences and collections, including a set of functions for breaking a collection or sequence into potentially overlapping groups of a fixed size.

    下载地址:

    Kotlin 1.2 发布,实现平台间共享代码下载地址
     
正在加载...