跳到主要内容

Kotlin 语言特性和提案

JetBrains 遵循 Kotlin 语言演进原则,以务实的设计为指导,不断发展 Kotlin 语言。

备注

语言特性提案从 Kotlin 1.7.0 开始列出。

有关语言特性状态的说明,请参阅 Kotlin 演进原则文档

探索与设计 (Exploration and design)

Kotlin 静态成员和静态扩展 (Kotlin statics and static extensions)

探索与设计 (Exploration and design)

集合字面量 (Collection literals)

  • KEEP 提案:未定义
  • YouTrack 问题:KT-43871

探索与设计 (Exploration and design)

用于错误和异常的联合类型 (Union types for errors and exceptions)

  • KEEP 提案:未定义
  • YouTrack 问题:KT-68296

探索与设计 (Exploration and design)

基于名称的解构 (Name-based destructuring)

  • KEEP 提案:未定义
  • YouTrack 问题:KT-19627

探索与设计 (Exploration and design)

支持不变性 (Support immutability)

KEEP 讨论 (KEEP discussion)

KMP Kotlin 到 Java 的直接实现 (KMP Kotlin-to-Java direct actualization)

KEEP 讨论 (KEEP discussion)

kotlin.time.Instant

KEEP 讨论 (KEEP discussion)

Common Atomics 和 Atomic Arrays

KEEP 讨论 (KEEP discussion)

改进属性上的注解使用位置目标 (Improvements to annotation use-site targets on properties)

KEEP 讨论 (KEEP discussion)

嵌套的(非捕获)类型别名 (Nested (non-capturing) type aliases)

KEEP 讨论 (KEEP discussion)

简化 KDoc 歧义链接 (Streamline KDoc ambiguity links)

KEEP 讨论 (KEEP discussion)

解析 KDoc 中扩展的链接 (Resolution of links to extensions in KDoc)

KEEP 讨论 (KEEP discussion)

Uuid

KEEP 讨论 (KEEP discussion)

使用预期类型改进解析 (Improve resolution using expected type)

KEEP 讨论 (KEEP discussion)

在 JVM 中公开装箱的内联值类 (Expose boxed inline value classes in JVM)

KEEP 讨论 (KEEP discussion)

显式 backing fields:同一属性的 publicprivate 类型 (Explicit backing fields: both public and private type for the same property)

KEEP 讨论 (KEEP discussion)

上下文参数:支持上下文相关的声明 (Context parameters: support for context-dependent declarations)

KEEP 讨论 (KEEP discussion)

Java 合成属性引用 (Java synthetic property references)

预览中 (In preview)

when-with-subject 中的守卫条件 (Guard conditions in when-with-subject)

  • KEEP 提案:guards.md
  • YouTrack 问题:KT-13626
  • 可用版本 (Available since): 2.1.0

稳定 (Stable)

稳定 @SubclassOptInRequired

预览中 (In preview)

Multidollar interpolation:改进了字符串字面量中 $ 的处理 (Multidollar interpolation: improved handling of $ in string literals)

预览中 (In preview)

非本地 breakcontinue (Non-local break and continue)

稳定 (Stable)

Enum.entriesEnum.values() 的高性能替代品 ( Enum.entries: performant replacement of the Enum.values())

稳定 (Stable)

Data objects

稳定 (Stable)

RangeUntil 运算符 ..< (RangeUntil operator ..<)

稳定 (Stable)

Definitely non-nullable types

已撤销 (Revoked)

上下文接收者 (Context receivers)