Skip to content

Instantly share code, notes, and snippets.

@abreslav
Last active December 11, 2021 09:13
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abreslav/f60fc0de060e7ed721c9 to your computer and use it in GitHub Desktop.
Save abreslav/f60fc0de060e7ed721c9 to your computer and use it in GitHub Desktop.

Kotlin 1.0.0 RC

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
  • 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
  • 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment