To get rid of all the old code, this version requires recompilation of all dependencies.
NOTE: EAP users must recompile their code all the same, although the compiler won't demand this (IllegalAccessError
is likely to be thrown at runtime)
- 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
- new
- Java interop
forEach
from Kotlin's library is preferred toforEach
fromjava.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 ofList<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
andassociateBy
are added to aid construction of maps associate and associateBy (instead of toMap/toMapBy)
groupBy
with key- and value-selector functionsMap.getOrElse()
andMap.getOrPut()
now treat keys associated withnull
values as missing.Map.getOrImplicitDefault()
has been made internalmutableListOf
,mutableSetOf
,mutableMapOf
added to construct mutable collections.linkedListOf
is deprecatedtoMutableList
added instead oftoArrayList
. The latter is deprecatedkotlin.system.exitProcess
instead ofSystem.exit
File.deleteRecursively
only returnsfalse
in case of incomplete deletionFile.copyRecursively
allows overwriting by specifying argumentoverwrite=true
- changed
File.copyTo
behavior to be likeFiles.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
andReader.readLines
are introducedFile.(buffered)reader/writer
now return less specificInputStreamReader/OutputStreamWriter
and use UTF-8 encoding by default- Comparator- and comparison-related functions are moved to
kotlin.comparisons
package (not imported by default) - new properties in
MatchResult
:groupValues
anddestructured
— provided for easier handling of regular expression match results Lazy
is now an interface open for implementationkotlin.system.measureTimeNano
renamed tomeasureNanoTime
.plusElement
andminusElement
functions as a synonyms forlist + element
andlist - element
.kotlin.test.assertFailsWith
withClass<T>
parameter is deprecated, use an overload withKClass<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