Skip to content

Releases: JetBrains/kotlin

Kotlin 1.1 M01 (Early Access Preview)

14 Jul 13:18
Compare
Choose a tag to compare
Pre-release

Language features

  • Coroutines (async/await, generators) (proposal)

    Current limitations:

    • for some cases type inference is not supported yet
    • limited IDE support
    • allowed only one handleResult function: design
    • handling finally blocks is not supported: issue
  • Bound callable references (proposal)

  • Type aliases (proposal)

    Current limitations:

    • type alias constructors for inner classes are not supported yet
    • annotations on type alias are not supported yet
    • limited IDE support
  • Local delegated properties (proposal)

  • JDK dependent built-in classes (proposal)

  • Sealed class inheritors in the same file (proposal)

  • Allow base classes for data classes (proposal)

Scripting

  • Implement support for Script Definition Template
    and related functionality, except the following parts:
    • automatic script templates discovery is not implemented
    • @file:ScriptTemplate annotation is not supported
    • the parameters javaHome and scripts from KotlinScriptExternalDependencies are not used yet
  • Implement support for custom template-based scripts in IDEA: resolving, completion and navigation to symbols from script classpath and sources
  • Implement GradleScriptTemplateProvider extension that supplies a script template if gradle with
    kotlin script support is used in the project

Compiler

Issues fixed
  • KT-4779 Generate default methods for implementations in interfaces
  • KT-11780 Fixed incorrect "No cast needed" warning
  • KT-12156 Fixed incorrect error on inline modifier inside final class
  • KT-12358 Report missing error "Abstract member not implemented" when a fake method of 'Any' is inherited from an interface
  • KT-6206 Generate equals/hashCode/toString in data class always unless it'll cause a JVM signature clash error
  • KT-8990 Fixed incorrect error "virtual member hidden" for a private method of an inner class
  • KT-12429 Fixed visibility checks for annotation usage on top-level declarations
  • KT-5068 Introduced a special diagnostic message for "type mismatch" errors such as fun f(): Int = { 1 }.

Standard Library

  • KT-8254 Provide standard library supplement artifacts for using with JDK 7 and 8.
    These artifacts include extensions for the types available in the latter JDKs, such as AutoCloseable.use (KT-5899) or Stream.toList.
  • KT-12753 Provide an access to named group matches of Regex match result (for JDK 8 only).
  • Add assertFails overload with message to kotlin-test.

IDE

New features
  • "Leaking this" inspection

    This inspection reports dangerous operations inside constructors including:

    • Accessing non-final property in constructor
    • Calling non-final function in constructor
    • Using 'this' as function argument in constructor of non-final class
Issues fixed
  • KT-12389 Do not exit from REPL when toString() of user class throws an exception
  • KT-12129 Fixed link on api reference page in KDoc

1.0.3

30 Jun 12:55
Compare
Choose a tag to compare

Compiler

Analysis & diagnostics

  • Combination of open and override is no longer a warning
  • KT-4829 Equal conditions in when is now a warning
  • KT-6611 "This cast can never succeed" warning is no longer reported for Foo<T> as Foo<Any>
  • KT-7174 Declaring members with the same signature as non-overridable methods from Java classes (like Object.wait/notify) is now an error (when targeting JVM)
  • KT-12302 abstract modifier for a member of interface is no longer a warning
  • KT-12452 open modifier for a member of interface without implementation is now a warning
  • KT-11111 Overriding by inline function is now a warning, overriding by a function with reified type parameter is an error
  • KT-12337 Reference to a property with invisible setter now has KProperty type (as opposed to KMutableProperty)
Issues fixed
  • KT-4285 No warning for a non-tail call when the method inherits default arguments from superclass
  • KT-4764 Spurious "Variable must be initialized" in try/catch/finally
  • KT-6665 Unresolved reference leads to marking subsequent code unreachable
  • KT-9597 NullPointerException during resolution of complicated star projections
  • KT-11750 Exceptions when creating various entries with the name "name" in enums
  • KT-11998 Smart cast to not-null is not performed on a boolean property in if condition
  • KT-10648 Exhaustiveness check does not work when sealed class hierarchy contains intermediate sealed classes
  • KT-10717 Type inference for lambda with local return
  • KT-11266 Fixed "Empty intersection of types" internal compiler error for some cases
  • KT-11857 Fix visibility check for dynamic members within protected method (when targeting JS)
  • KT-12589 Improved "infix modifier is inapplicable" diagnostic message
  • KT-11679 Erroneous call with argument causes Throwable at ResolvedCallImpl.getArgumentMapping()
  • KT-12623 Fix ISE on malformed code

JVM code generation

  • KT-5075 Optimize array/collection indices usage in for loop
  • KT-11116 Optimize coercion to Unit, POP operations are backward-propagated
Issues fixed
  • KT-11499 Compiler crashes with "Incompatible stack heights"
  • KT-11943 CompilationException with extension property of KClass
  • KT-12125 Wrong increment/decrement on Byte/Char/Short.MAX_VALUE/MIN_VALUE
  • KT-12192 Exhaustiveness check isn't generated for when expression returning Unit
  • KT-12200 Erroneously optimized away assignment to a property initialized to zero
  • KT-12582 "VerifyError: Bad local variable type" caused by explicit loop variable type
  • KT-12708 Bridge method not generated when data class implements interface with copy() method
  • KT-12106 import static of reified companion object method throws IllegalAccessError

Performance

  • Reduced number of IO operation when loading kotlin compiled classes

Сompiler options

  • Allow to specify version of Kotlin language for source compatibility with older releases.
    • CLI: -language-version command line option
    • Maven: languageVersion configuration parameter, linked with kotlin.compiler.languageVersion property
    • Gradle: kotlinOptions.languageVersion property in task configuration
  • Allow to specify which java runtime target version to generate bytecode for.
    • CLI: -jvm-target command line option
    • Maven: jvmTarget configuration parameter, linked with kotlin.compiler.jvmTarget property
    • Gradle: kotlinOptions.jvmTarget property in task configuration
  • Allow to specify path to JDK to resolve classes from.
    • CLI: -jdk-home command line option
    • Maven: jdkHome configuration parameter, linked with kotlin.compiler.jdkHome property
    • Gradle: kotlinOptions.jdkHome property in task configuration

Standard Library

  • Improve documentation (including KT-11632)
  • List iteration used in collection operations is performed with an indexed loop when the list supports RandomAccess and the operation isn't inlined

IDE

Completion

New features
  • Smart completion after by and in
  • Improved completion in bodies of overridden members (when no type is specified)
  • Improved presentation of completion items for property accessors
  • Fixed keyword completion after try in assignment expression
  • KT-8527 Include non-imported declarations on the first completion
  • KT-12068 Special completion item for "[]" get-operator access
  • KT-12080 Parameter names are now higher up in completion list
Issues fixed
  • Fixed enum members being present in completion as static members
  • Fixed QuickDoc not working for properties generated for java classes
  • KT-9166 Code completion does not work for synthetic java properties on typing "g"
  • KT-11609 No named arguments completion should be after dot
  • KT-11633 Wrong indentation after completing a statement in data class
  • KT-11680 Code completion of label for existing return with value inserts redundant whitespace
  • KT-11784 Completion for if statement should add parentheses automatically
  • KT-11890 Completion for callable references does not propose static Java members
  • KT-11912 String interpolation is not converted to ${} form when accessing this.property
  • KT-11957 No catch and finally keywords in completion
  • KT-12103 Smart completion for nested SAM-adapter produces short unresolved name
  • KT-12138 Do not show "::error" in smart completion when any function type accepting one argument is expected
  • KT-12150 Smart completion suggests to compare non-nullable with null
  • KT-12124 No code completion for a java property in a specific position
  • KT-12299 Completion: incorrect priority of property foo over method getFoo in Kotlin-only code
  • KT-12328 Qualified function name inserted when typing before if
  • KT-12427 Completion doesn't work for "@receiver:" annotation target
  • KT-12447 Don't use CompletionProgressIndicator in Kotlin plugin
  • KT-12669 Completion should show variant with () when there is default lambda
  • KT-12369 Pressing dot after class name should not cause insertion of constructor call

Spring support

New features
Issues fixed
  • KT-12091 Fixed unstable behavior of Spring line markers
  • KT-12096 Fixed rename of custom-named beans specified with Kotlin annotation
  • KT-12117...
Read more

1.0.2

13 May 06:48
Compare
Choose a tag to compare

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 but set 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 and currentStackTrace @InlineOnly not to lose stack trace
  • KT-11745 Rename parameters of String.subSequence to match those of CharSequence.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 and kotlinFunction 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

Read more

1.0.1 hotfix update #2

1.0.1 hotfix update

23 Mar 11:10
Compare
Choose a tag to compare

1.0.1

17 Mar 13:14
Compare
Choose a tag to compare

Copy of 1.0.1 release with another github URL.

1.0.1

17 Mar 13:15
Compare
Choose a tag to compare

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

15 Feb 12:01
Compare
Choose a tag to compare

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 and Throwable#cause open
  • kotlin.Metadata annotation is used instead of KotlinClass
  • 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

04 Feb 13:36
Compare
Choose a tag to compare
Pre-release

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
  • 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

Kotlin 1.0.0 Beta 4 Update 2

20 Jan 11:47
Compare
Choose a tag to compare
Pre-release

Bugfix update:

  • Gradle Plugin for Android
  • Instant Run support for Android Studio
  • Compatibility with IntelliJ IDEA 16