Kotlin 1.0.0 Beta Candidate
Pre-release
Pre-release
·
103102 commits
to master
since this release
Language
- Imports from objects
@DeprecatedsupportsERRORandHIDDENlevels (@HiddenDeclarationis deprecated)- Smart casts for captured local
var's that are not modified in lambdas - Single-file classes can have many
main()'s internalvisibility checked in the compiler- No defensive copying needed for varargs
- All Java methods with matching signatures are operators
- Rename:
unaryMinus/unaryPlusfor unary operators - Rename:
getValue/setValuefor delegated properties - Checks for operator signatures at declarations sites
infixmodifier for infix functions- Rename
sparamannotation target tosetparam @UnsafeVarianceannotationfun foo<T>()deprecated in favor offun <T> foo()- Constraints on type parameters should occur either in
whereor in<…> x is Array<Foo>forbidden in favor ofx is Array<*> && x.isArrayOf<Foo>()- Callable references restricted to support bound references later
PropertyMetadatadeprecated in favor ofKProperty<*>ifwith noelsein expression position is an error- Letters and digits right before/after string and char literals are prohibited
invokeconvention for extension functions is removed- Visibility requirements for members
- Protected members in objects are prohibited
finalin 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.() -> Fooare prohibited Foo<Int>.Baris 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
inlineproperties are prohibited;;is reserved for future use
Libraries
- Formerly deprecated declarations have been dropped
size(),length()etc are made propertiesList.remove(int)is renamed toremoveAtCollection<E>.contains(Any?),Map<K, V>.get(Any?)and other similar function are now type-safe:contains(E),get(K)containsRaw,getRawextensions and alike are defined for the Java-like utyped behaviorRegexAPI changes:matchEntireadded,match/matchAllrenamed tofind/findAll, alsoregex in stringcan be used isntead ofregex.hasMatch(string)listOf()doesn't make a defensive copyStringBuilder {}function deprecated in favor ofbuildString {}- Rename:
merge->zip,joinremoved (usejoinToString),mapNotNulldeprecated 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
internalfunctions and properties are mangled - Kotlin classes see inherited statics and members of inherited companion objects
@Synchronizedand@Volatileare inapplicable to unimplemented functionsisFoo()instead ofgetIsFoo()for properties namedisFoo- Old package facades are dropped
- Inheritance rules comply with Java 8
isdistinguishesMutableListfromListand supports functions of different aritiesInt,Stringand other basic types areSerializable@JvmFieldis required to make something a fieldINSTANCEfor objects (instead ofINSTANCE$)- Constant pool stings are resued to reduce metadata sizes
@KotlinSignatureis deprecated- Java sees defaul implementations of methods in the interface
Fooas statics inFoo.DefaultImplsclass - Constants from Java libraries are inlined into Kotlin byte code
@publicFieldis 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