Skip to content

Kotlin 1.0.0 Beta Candidate

Pre-release
Pre-release
Compare
Choose a tag to compare
@abreslav abreslav released this 22 Oct 12:12
· 91715 commits to master since this release

Language

  • Imports from objects
  • @Deprecated supports ERROR and HIDDEN levels (@HiddenDeclaration is deprecated)
  • Smart casts for captured local var's that are not modified in lambdas
  • Single-file classes can have many main()'s
  • internal visibility checked in the compiler
  • No defensive copying needed for varargs
  • All Java methods with matching signatures are operators
  • Rename: unaryMinus/unaryPlus for unary operators
  • Rename: getValue/setValue for delegated properties
  • Checks for operator signatures at declarations sites
  • infix modifier for infix functions
  • Rename sparam annotation target to setparam
  • @UnsafeVariance annotation
  • fun foo<T>() deprecated in favor of fun <T> foo()
  • Constraints on type parameters should occur either in where or in <…>
  • x is Array<Foo> forbidden in favor of x is Array<*> && x.isArrayOf<Foo>()
  • Callable references restricted to support bound references later
  • PropertyMetadata deprecated in favor of KProperty<*>
  • if with no else in expression position is an error
  • Letters and digits right before/after string and char literals are prohibited
  • invoke convention for extension functions is removed
  • Visibility requirements for members
  • Protected members in objects are prohibited
  • final in interfaces is prohibited
  • Visibility for local classes is prohibited
  • Local interfaces are prohibited
  • Private setters for non-private lateinit vars are prohibited
  • Nothing-returning functions must declare return type explicitly
  • Annotations on multi-declarations are prohibited
  • Checks for escaped identifiers (backticks) to conform to JVM requirements
  • Supertypes of the form T.() -> Foo are prohibited
  • Foo<Int>.Bar is prohibited
  • Type parameters for properties are prohibited unless they are used in the receiver type
  • Parameter annotations and default values in function types are prohibited
  • inline properties are prohibited
  • ;; is reserved for future use

Libraries

  • Formerly deprecated declarations have been dropped
  • size(), length() etc are made properties
  • List.remove(int) is renamed to removeAt
  • Collection<E>.contains(Any?), Map<K, V>.get(Any?) and other similar function are now type-safe: contains(E), get(K)
  • containsRaw, getRaw extensions and alike are defined for the Java-like utyped behavior
  • Regex API changes: matchEntire added, match/matchAll renamed to find/findAll, also regex in string can be used isntead of regex.hasMatch(string)
  • listOf() doesn't make a defensive copy
  • StringBuilder {} function deprecated in favor of buildString {}
  • Rename: merge -> zip, join removed (use joinToString), mapNotNull deprecated to be changed later

Java interop

  • Java classes inherit static from supertypes
  • List<Nothing> is compiled to raw List to facilitate subtyping in Java
  • Support "static overrides" for Java fields
  • Top-level privates are private to file
  • Names of internal functions and properties are mangled
  • Kotlin classes see inherited statics and members of inherited companion objects
  • @Synchronized and @Volatile are inapplicable to unimplemented functions
  • isFoo() instead of getIsFoo() for properties named isFoo
  • Old package facades are dropped
  • Inheritance rules comply with Java 8
  • is distinguishes MutableList from List and supports functions of different arities
  • Int, String and other basic types are Serializable
  • @JvmField is required to make something a field
  • INSTANCE for objects (instead of INSTANCE$)
  • Constant pool stings are resued to reduce metadata sizes
  • @KotlinSignature is deprecated
  • Java sees defaul implementations of methods in the interface Foo as statics in Foo.DefaultImpls class
  • Constants from Java libraries are inlined into Kotlin byte code
  • @publicField is deprecated

Tools

  • Compiler daemon enabled by default in the IDE
  • Parallel Compilation of Independent Modules in the daemon mode
  • External annotations support removed

IDE

  • Parameter Info everywhere
  • Completion for callable references after ::
  • Actions to generated equals()/hashCode()
  • Actions to generate secondary constructors
  • '*'-imports configuration
  • Unit-testing support