发布于 2016-02-05 00:27:30 | 348 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的精品教程,程序狗速度看过来!

Kotlin 基于JVM的编程语言

Kotlin 是一个基于 JVM 的新的编程语言,由 JetBrains 开发。


Kotlin 1.0 RC 发布,更新如下:

  • Language

    • new @delegate: use-site target for annotation (e.g. @delegate:Transient)

    • private top-level Kotlin classes should be compiled to package private java classes

    • unfinished multiline comment is an error

    • previously deprecated language constructs are now errors

    • type ckecking for use-site variance fixed

    • generic functions are compared for specificity through solving a constraint system

    • having multiple vararg parameters for one function is prohibited

    • super-calls to functions with default parameters are prohibited (pass all arguments explicitly)

    • implicit receiver behavior fixed

    • as-import removes original names if they were imported before

    • user code is not allowed in kotlin.** packages

    • type parameters of extension properties allowed to be indirectly used by the receiver type

    • members of private classes can-not be accessed from non-private inline functions

  • Java interop

    • forEach from Kotlin's library is preferred to forEach from java.lang.Iterable

    • synthesized declarations (like JavaBeans properties and SAM-converted methods) are now resolved on par with members

    • support added for Java setters that return values

    • previously depreacted Java declarations removed from generated code

    • private setters allowed for lateinit properties

    • wildcards are not generated for redundant type projections (use List<@JvmWildcard Foo> instead of List<out Foo>)

    • @Nullable/@NotNull annotations from different standard Java packages recognized (javax.annotations, Guava, Android, etc)

  • Standard Library

    • diagnostics for multiple conflicting Kotlin runtime versions in classpath

    • some functions have been made inline

    • many inline functions (most of them one-liners) can no longer be called from Java code. This will help us reduce the size of the runtime library in the future.

    • library code rearranged into more granular packages (no source changes should be required)

    • associate and associateBy are added to aid construction of maps associate and associateBy (instead of toMap/toMapBy)

    • groupBy with key- and value-selector functions

    • Map.getOrElse() and Map.getOrPut() now treat keys associated with null values as missing.

    • Map.getOrImplicitDefault() has been made internal

    • mutableListOf, mutableSetOf, mutableMapOf added to construct mutable collections. linkedListOf is deprecated

    • toMutableList added instead of toArrayList. The latter is deprecated

    • kotlin.system.exitProcess instead of System.exit

    • File.deleteRecursively only returns false in case of incomplete deletion

    • File.copyRecursively allows overwriting by specifying argument overwrite=true

    • changed File.copyTo behavior to be like Files.copy from JDK8.

    • more specific return type for File.inputStream, File.outputStream, String.byteInputStream.

    • IO utility functions taking charset name as a string are deprecated, use ones with Charset parameter.

    • File.useLines and Reader.readLines are introduced

    • File.(buffered)reader/writer now return less specific InputStreamReader/OutputStreamWriter and use UTF-8 encoding by default

    • Sequence and Iterable SAM constructor-like functions

    • Comparator- and comparison-related functions are moved to kotlin.comparisons package (not imported by default)

    • new properties in MatchResult: groupValues and destructured — provided for easier handling of regular expression match results

    • Lazy is now an interface open for implementation

    • kotlin.system.measureTimeNano renamed to measureNanoTime.

    • plusElement and minusElement functions as a synonyms for list + element and list - element.

    • kotlin.test.assertFailsWith with Class<T> parameter is deprecated, use an overload with KClass<T>.

    • toLinkedMap is deprecated.

    • UTF_32 charset properties added to Chatsets

  • Tools

    • To enable Android Extensions, use: apply plugin: 'kotlin-android-extensions'

  • IDE

    • Intention to replace iteration over map entries with a loop using a destructuring declaration

    • Inspection and quickfix to cleanup redundant visibility modifiers

    • Inspection to replace 'assert' calls checking that a variable is not null with !! or ?: error(...)

    • Show "Kotlin not configured" notification when opening a .kt file in the IDE if the Kotlin runtime is not configured for the corresponding module

    • Action to generate the toString() method

    • Support for implementing members by primary constructor parameters

    • Parameter info popup works for showing type parameters

    • Completion offers name variants based on unresolved identifiers in current file

    • Quickfix for adding missing branches to a when expression

    • Support for moving nested classes to the upper level or into another top-level class

    • @Suppress now works for IDE inspections

详情请看:发行说明

下载:here

Kotlin 是一个基于 JVM 的新的编程语言,由 JetBrains 开发。

其主要设计目标:

  • 创建一种兼容Java的语言

  • 让它比Java更安全,能够静态检测常见的陷阱。如:引用空指针

  • 让 它比Java更简洁,通过支持variable type inference,higher-order functions (closures),extension functions,mixins and first-class delegation等实现。

  • 让它比最成熟的竞争对手Scala语言更加简单。



历史版本 :
Kotlin 1.2.21 发布,Bug 修复版本
Kotlin 1.2.20 发布:添加对 Gradle 构建缓存的支持
Kotlin/Native 0.5 支持在Swift, C和LLVM 5中使用 Kotlin
Kotlin 1.2 发布,实现平台间共享代码
Kotlin 1.1.60 发布,开始支持增量编译
Kotlin 1.2 Beta2 发布:显著提升编译器性能
Kotlin 1.2 Beta 版发布,基于 JVM 的编程语言
Kotlin 1.1.50 发布,基于 JVM 的编程语言
Kotlin 1.1.4 发布,改进对 Java 9 的支持
Kotlin 1.2 M2 发布,1.2 系列的早期访问版
Kotlin 1.2-M1 发布,1.2 系列的早期访问版
Kotlin 1.1.3 发布,初始支持 JDK 9
最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务