Releases: JetBrains/kotlin
Releases · JetBrains/kotlin
1.0.2
Compiler
Analysis & diagnostics
- KT-7437, KT-7971, KT-7051, KT-6125, KT-6186, KT-11649 Implement missing checks for protected visibility
- KT-11666 Report "Implicit nothing return type" on non-override member functions
- KT-4328, KT-11497, KT-10493, KT-10820, KT-11368 Report error if some classes were not found due to missing or conflicting dependencies
- KT-11280 Do not perform smart casts for values with custom
equals
compared with==
- KT-3856 Fix wrong "inner class inaccessible" diagnostic for extension to outer class
- KT-3896, KT-3883, KT-4986
do...while (true)
is now considered an infinite loop - KT-10445 Prohibit initialization of captured
val
in lambda or in local function - KT-10042 Correctly handle local classes and anonymous objects in control flow analysis
- KT-11043 Prohibit complex expressions with class literals in annotation arguments
- KT-10992, KT-11007 Fix multiple problems related to smart casts
- KT-11490 Prohibit nested intersection types in return position
- KT-11411 Report "illegal noinline/crossinline" on parameter of subtype of function type
- KT-3083 Report "conflicting overloads" for functions with parameter of type parameter type
- KT-7265 Parse anonymous functions in blocks as expressions
- KT-8246 Handle break/continue for outer loop correctly in case of try/finally in between
- KT-11300 Report error on increment or augmented assignment when
get
is an operator butset
is not - Report warning about unused anonymous functions
- Improve callable reference type in some ambiguous cases
- Improve multiple diagnostic messages: KT-10761, KT-9760, KT-10949, KT-9887, KT-9550, KT-11239, KT-11819
- Fix several compiler bugs leading to exceptions: KT-9820, KT-11597, KT-10983, KT-10972, KT-11287, KT-11492, KT-11765, KT-11869
JVM code generation
- KT-8269, KT-9246, KT-10143 Fix visibility of protected classes in bytecode
- KT-11363 Fix potential binary compatibility breakage on using
when
over enums in inline functions - KT-11762 Fix VerifyError caused by explicit loop variable type
- KT-11645 Fix NoSuchFieldError on private const property in multi-file class
- KT-9670 Optimize Class <-> KClass wrapping/unwrapping when getting values from annotation
- KT-6842 Optimize unnecessary boxing and interface calls on iterating over ranges
- KT-11025 Don't inline const val properties in non-annotation contexts
- KT-5429 Write nullability annotations on extension receiver parameters
- KT-11347 Preserve source file and line number of call site when inlining certain standard library functions
- KT-11677 Write correct generic signatures for local classes in inlined lambdas
- KT-12127 Do not write unnecessary generic signature for property delegate backing field
- Fix multiple issues leading to exceptions or bad bytecode being generated: KT-11034, KT-11519, KT-11117, KT-11479
Java interoperability
- KT-3068 Load contravariantly projected collections in Java (
List<? super T>
) as mutable collections in Kotlin (MutableList<in T>
) - KT-11322 Do not lose type nullability information in SAM constructors
- KT-11721 Fix wrong "Typechecker has run into recursive problem" error on calling Kotlin get function as synthetic Java property
- KT-10691 Fix wrong "Inherited platform declarations clash" error on inheritance from generic Java class with overloaded methods
Command line compiler
- KT-9546 Flush stdout and stderr before shutdown when executing scripts
- KT-10605 Disable colored output on certain platforms to prevent crashes
- Report warning instead of error on unknown "-X" flags
- Remove the compiler option "Xmultifile-facades-open"
Compiler daemon
- Reduce read disk activity
- Fix compiler daemon JAR cache clearing on IDEA Ultimate
Standard library
- KT-11410 Reduce method count of the standard library by ~2k
- KT-9990 Optimize snapshot operations to return special collection implementations when result is empty or has single element
- KT-10794 EmptyList now implements RandomAccess
- KT-10821 Create at most one wrapper sequence for adjacent drop/take operations on sequences
- KT-11301 Make Map.plus accept Map out-projected by key type as either operand (receiver or parameter)
- KT-11485 Remove implementations of some internal intrinsic functions
- KT-11648 Add deprecated extension MutableList.remove to redirect to valid function removeAt
- KT-11348 kotlin.test: Make inline methods
todo
andcurrentStackTrace
@InlineOnly
not to lose stack trace - KT-11745 Rename parameters of
String.subSequence
to match those ofCharSequence.subSequence
- KT-10953 Clarify parameter order of lambda function parameter of
*Indexed
functions - KT-10198 Improve docs for
binarySearch
functions - KT-9786 Improve docs for
trimIndent
/trimMargin
Reflection
- KT-9952 Improve
toString()
for lambdas and function expressions when kotlin-reflect.jar is available - KT-11433 Fix multiple resource leaks by closing InputStream instances
- KT-8131 Fix exception from calling
KProperty.javaField
on a subclass - KT-10690 Support
javaMethod
andkotlinFunction
for top level functions in a different file - KT-11447 Support reflection calls to multifile class members
- KT-10892 Load annotations of const properties from multifile classes
- KT-11258 Don't crash on requesting members of Java collection classes
- KT-11502 Clarify KClass equality
JS
- KT-4124 Support nested classes
- KT-11030 Support local classes
- KT-7819 Support non-local returns in local lambdas
- KT-6912 Safe calls (
x?.let { it }
) are now inlined - [KT-2670](https://youtrack.jetbrains.com/issue/KT-2...
1.0.1 hotfix update #2
1.0.1 hotfix update
1.0.1
1.0.1
Compiler
Analysis & diagnostics issues fixed:
- KT-2277 Local function declarations are now checked for overload conflicts
- KT-3602 Special diagnostic is reported now on nullable ‘for’ range
- KT-10775 No compilation exception for empty when
- KT-10952 False deprecation warnings removed
- KT-10934 Type inference improved for whens
- KT-10902 Redeclaration is reported for top-level property vs classifier conflict
- KT-9985 Correct handling of safe call arguments in generic functions
- KT-10856 Diagnostic about projected out member is reported correctly on calls with smart cast receiver
- KT-5190 Calls of Java 8 Stream.collect
- KT-11109 Warning is reported on Strictfp annotation on a class because it's not supported yet
- KT-10686 Support generic constructors defined in Java
- KT-6958 Fixed resolution for overloaded functions with extension lambdas
- KT-10765 Correct handling of overload conflict between constructor and function in JPS
- KT-10752 If inferred type for an expression refers to a non-accessible Java class, it's a compiler error to prevent IAE in runtime
- KT-10913, KT-10186, KT-5198 False “unreachable code” fixed for various situations
- Minor: KT-3680, KT-9702, KT-8776, KT-6745, KT-10919, KT-9548
JVM code generation issues fixed:
- KT-11153 NoClassDefFoundError is fixed on primitive iterators during boxing optimization
- KT-7319 Correct parameter names for @JvmOverloads-generated methods
- KT-10425 Non-const values of member properties are not inlined now
- KT-11163 Correct calls of custom compareTo on primitives
- KT-11081 Reified type parameters are correctly stored in anonymous objects
- KT-11121 Generic properties generation is fixed for interfaces
- KT-11285, KT-10958 Special bridge generation refined
- KT-10313, KT-11190, KT-11192, KT-11130 Diagnostics and bytecode fixed for various operations with Long
- KT-11203, KT-11191, KT-11206, KT-8505, KT-11203 Handling of increment / decrement for collection elements with user-defined get / set fixed
- KT-9739 Backticked names with spaces are generated correctly
JS translator issues fixed:
Standard library
- KT-10579 Improved performance of sum() and average() for arrays
- KT-10821 Improved performance of drop() / take() for sequences
IDE
New features:
- Compatibility with IDEA 2016
- Kotlin Education Plugin (for IDEA 2016)
- KT-9752 More usable file chooser for "Move declaration to another file"
- KT-9697 Move method to companion object and back
General issues fixed:
- KT-11277 Correct moving of Java classes from project view
- KT-11256 Navigate Declaration fixed for Java classes with @NotNull parameter in constructor
- KT-10553 A warning provided when Refactor / Move result is not compilable due to visibility problems
- KT-11039 Parameter names are now not missing in parameter info and completion for compiled java code used from kotlin
- KT-10204 Highlight usages in file is working now for function parameter
- KT-10954 Introduce Parameter (Ctrl+Alt+P) fixed when default value is a simple name reference
- KT-10776 Intentions: "Convert to lambda expression" works now for empty function body
- KT-10815 Generate equals() and hashCode() is no more suggested for interfaces
- KT-10818 "Initialize with constructor parameter" fixed
- KT-8876 "Convert member to extension" now removes modality modifiers (open / final)
- KT-10800 Create enum entry now adds comma after a new entry
- KT-10552 Pull Members Up now takes visibility conflicts into account
- KT-10978 Partially fixed, completion for JOOQ became ~ 10 times faster
- KT-10940 Reference search optimized for convention functions
- KT-9026 Editor no more locks up during scala file viewing
- KT-11142, KT-11276 Darkula scheme appearance corrected for Kotlin
- Minor: KT-10778, KT-10763, KT-10908, KT-10345, KT-10696, KT-11041, KT-9434
Configuration issues fixed:
- KT-11213 Kotlin plugin version corrected in build.gradle
- KT-10918 "Update Kotlin runtime" action does not try to update the runtime coming in from Gradle
- KT-11072 Libraries in maven, gradle and ide systems are never more detected as runtime libraries
- KT-10489 Configuration messages are aggregated into one notification
- KT-10831 Configure Kotlin in Project: "All modules containing Kotlin files" does not list modules not containing Kotlin files
- KT-10366 Gradle import: no fake "Configure Kotlin" notification on project creating
Debugger issues fixed:
- KT-10827 Fixed debugger stepping for inline calls
- KT-10780 Breakpoints in a lazy property work correctly
- KT-10634 Watches can now use private overloaded functions
- KT-10611 Line breakpoints now can be created inside lambda in init block
- KT-10673 Breakpoints inside lambda are no more ignored in presence of crossinline function parameter
- KT-11318 Stepping inside for each is optimized
- KT-3873 Editing code while standing on breakpoint is optimized
- KT-7261, KT-7266, KT-10672 Evaluate expression applicability corrected
Tools
Kotlin 1.0.0
Welcome Kotlin 1.0.0 — the first official release of the Kotlin programming language!
Find installation instructions and documentation here.
This release is a result of over five years of hard work. Below, find the changes made since the RC build.
Library
- KT-5587 Make
Throwable#message
andThrowable#cause
open kotlin.Metadata
annotation is used instead ofKotlinClass
- Old metadata annotations deleted from the
kotlin.jvm.internal
package - KT-10462: Use HALF_EVEN rounding mode by default for BigDecimal division operator.
- Default buffer size for IO operations changed to 8K (same default as in Java's
BufferedReader
). - Last deprecations dropped
Compiler
- KT-10858 Proguard issue with inline-only functions in multi-file classes
- KT-10939 CANNOT_COMPLETE_RESOLVE for inherited generic interface method
- KT-10595 Internal visibility fixed for Gradle projects in IntelliJ IDEA 16
- KT-10934 UninferredParameterTypeConstructor exception fixed for exhaustive when
- KT-10896 Wrong inference of if / else result type fixed
- RoboVM incompatibility fixed
Kotlin 1.0.0 Release Candidate
Important notes
To get rid of all the old code, this version requires recompilation of all dependencies.
EAP users must recompile their code as well, although the compiler won't demand this (IllegalAccessError
is likely to be thrown at runtime)
What's new
- 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 defaultSequence
andIterable
SAM constructor-like functions- 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'
- To enable Android Extensions, use:
- 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
Kotlin 1.0.0 Beta 4 Update 2
Bugfix update:
- Gradle Plugin for Android
- Instant Run support for Android Studio
- Compatibility with IntelliJ IDEA 16
Kotlin 1.0.0 Beta 4
Hot-fix update: Wrong JDK in class path for Android
See What's new here
Kotlin 1.0.0 Beta 4
Language
- Primary constructor is resolved in the same scope as secondary constructors
yield
is reserved as a keywordasync
is reserved in some contextstypeof
is reserved as a keyword. In JS, usejsTypeOf()
sealed
when reserved- Multiple fixes in the overload resolution algorithm.
- The curious case of
File.listFiles
- The curious case of
KPropertyN
now extendFunctionN
, i.e.list.map(String::length)
works now- Duplicate bounds for type parameters forbidden
- Multiple class bounds for type parameters forbidden
Array<Nothing>
andArray<Nothing?>
are prohibitedif
with noelse
is not an expressionvalues()
andvalueOf()
in enums are preferred to member of companion objects- Better scheme of translation of variant types to Java
@JvmSuppressWildards
and@JvmWildcard
added- Statics inherited by companion object are visible without qualification in the outer class and its subclasses
- Absolute package references dropped. Use alias imports instead
- Overloads are compared according to actual arguments only
- Deprecations lifted to errors:
Enum.values
, local sealed classes, private setter for open property
Library
kotlin-test.jar
extracted- Extensions are moved to specific packages (no source changes required for Kotlin code)
javaPrimitiveType
andjavaObjectType
added forKClass
IntArray(5) { it * 3 }
and other initializers supported for primitive arrays- Semantics of
null
in maps is going to change minWith(comparator)
/maxWith(comparator)
supportedtoMap((T)
-> Pair<K,V>)` supportedFileTreeWalk
:- constructor is deprecated, preferred construction with fluent builder methods
treeFilter
is deprecated, recursive filtering now happens inonStart
- File utilities behavior changes and deprecations
IDE
- New precise incremental compilation (experimental)
- Rename for unresolved references
- Create From Usage for callable references
- Go to Test and Create Test for top-level functions
- Intention to convert anonymous function to a lambda
- Go to Class and Search Everywhere show Kotlin built-in types
- Debugger: Skip simple getters supported