Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Kotlin 1.4 Online Event Summary

Day 1

Opening Keynote by The Kotlin Team

  • KMM: Kotlin Multi platform for Mobile
  • New front ends and backends

Contributing to Kotlin by Egor Tolstoy

  • Enable data sharing in IntelliJ
  • Answer questions on SO

New Language Features in Kotlin 1.4 by Svetlana Isakova

  • Interfaces can be fun now! SAM conversion, but explicit
  • Explicit API Mode: Errors/Warnings enforcing explicit visibility and return types (for libraries, preventing accidental exposure/breakage)
  • Trailing, commas,
    • But don't be tempted to just swap argument lines, use IDE refactoring to properly handle usages!
  • continue and break allowed now in when inside loops
  • named and positional args can now be mixed!
    • but take care to maintain the order!
  • Better type inference!
    // 1.3 -> result: String!
    // 1.4 -> result: String
    val result = run {
        var str = getNullableString()
        if (str == null) {
            str = "test"
        }
        str
    }
  • References with default args!
    fun foo(i: Int = 0): String = "$i!"
    fun apply(f: () -> String): String = f()
    apply(foo) // 0!
  • KotlinNullPointerException (!!), TypeCastException (as Type), IllegalStateException (platform-type expression), IllegalArgumentException(parameter) -> NullPointerException
  • @JvmDefault no longer required for using java 8's interface default methods

Kotlin 1.4 in IntelliJ-based IDEs: Boosting Quality and Performance by Anton Yalyshev

  • Speeeeeeeedddddd!!!!!
    • make sure to update intellij
  • Kotlin plugin is becoming a part of intelliJ !!!
    • That means features like chain intermediate return types etc. can come together for Java & Kotlin!!

A Look Into the Future by Roman Elizarov

  • interop will continue for new Java versions
  • How things get decided: Slack/Forums, Comm with big users, YouTrack, Keep
  • Feature propagation: Ideas/Proposals: YouTrack #{language design} -> Design document: KEEP -> Corrections/improvements: KEEP Issues
  • Vote for KT-14663 :p (different type for different visibility for properties)
  • More stuff:
    • Namespaces & extensions
    • multiple receivers & decorators
    • public/private property types
    • ternary operators (bool ? true : false syntax declined)
    • immutability & inline classes

Full recording with Session QnA & General QnA

Day 2

Coroutines Update by Vsevolod Tolstopyatov

  • Debugging improvements in IntelliJ
  • StateFlow! Design (Looks similar to LiveData?)
  • SharedFlow!! Design
  • Core operators and invariants
    • Limited building-block core operators
    • Better exceptions on violating rules
  • Android Improvements
  • runInterruptible for blocking Java code
        withTimeout(500.milliseconds) {
            runInterruptible(Dispatchers.IO) {
                blockingQueue.take()
            }      
        }
  • Support for BlockHound and Java 9 Flow!!

kotlinx.serialization 1.0 by Leonid Startsev

  • Why?
    • Multi platform, kotlin oriented (such as default value support, reified goodness)
  • Configuration using DSL (future-proof, binary-compatible)
  • Some advanced features and formats are experimental
  • coerceInputValue: support default values in deserialization
  • more flexible polymorphic deserialization
  • Behind the sscenes: KotlinConf 2019: Design of Kotlin Serialization by Leonid Startsev

News From the Kotlin Standard Library by Svetlana Isakova

  • Consistency:
    • *OrNull: randomOrNull, maxOrNull, maxByOrNull, minOrNull, minByOrNull
      • maxOf -> returns the max value (where as maxBy return element with max value)
    • *Indexed: onEachIndexed, flatMapIndexed
      • reduceOrNull, reduceIndexedOrNull
  • runningReduce & runningFold: each intermediate value (kinda like KTable)
    (1..5).reduce { sum, elem -> sum + elem }        // 15
    (1..5).runningReduce { sum, elem -> elem + sum } // [1, 3, 6, 10, 15] 
  • ArrayDequeue (uses circular buffer internally, so adding element to begin is mostly constant
  • bit manipulation: countOneBits, countTrailingZeroBits, takeHighestOneBit)
  • stdlib dependency included by default
  • @Kotlin.Throws for interop with all platforms
  • Experimental
    • @RequiresOptIn/@OptIn
    • Collection Builders: similar to buildString (Mutable while building, returning immutable)
    • time measurement: measureTime (returns Duration, which is inline class), TimeSource, measureTimedValue -> Pair<T, Duration>

Introducing kotlinx-datetime by Ilya Gorbunov

  • Types & Operations:
    • Instant (Physical), LocalDateTime/LocalDate (Civil)
    • Arithmetic: plus, minus, until, periodUntil
    • Helper Type: DateTimeUnit, DateTimePeriod/DatePeriod, Month, DayOfWeek
  • Converters to/from java.time.*
  • Future: serialization, formatting & parsing (in english first), ranges (starDate..endDate), embedded TZDB for consistency

Full recording with Session QnA & General QnA

Day 3

State of Kotlin in Android by Florina Muntenescu

  • KSP (Kotlin Symbol Processing): Alternative to KAPT, 30-40% faster, developer preview currently
  • Kotlin metadata preservation in AGP to support kotlin-reflect, R8 etc.
  • Coroutine support in room, work manager, paging, data store, compose etc.

It's Time for Kotlin Multiplatform Mobile by Ekaterina Petrova

Kotlin/JS in 1.4 and Beyond by Sebastian Aigner

  • Improved webpack support
  • Improved npm support: Dukat
  • kotlinx-nodejs (experimental): Type safe access to Node.js API from Kotlin/JS
  • Coming with IR Compiler: Smaller bundles, @JsExport & Typescript definitions
  • Looking at WebAssembly

Diving into Kotlin Multiplatform by Dmitry Savvinov

  • Multi level heirarchy
  • Publishing
    • Intermediate sources also need to be published
    • .kotlin_metadata format (serialized declarations) used by common has limitations (no method bodies)
    • Hi klib!
      • Normal zips, contain kotlin_metadata + bodies in IR (~ serialized ASTs)
  • Dependency Management
    • Variants in .module file
    • Allows dependency inference magic
  • Commonizer
    • Extracts intersecting API
    • Enables shared native libraries

Full recording with Session QnA & General QnA

  • Florina: Data Layer/Room: Live Data or Flow?
    • Prefer flow as it has more flexible operators and doesn't return on main thread like LiveData
  • Florina: Will LiveData be deprecated in favor of Flow?
    • Not yet, because not supported everywhere yet (fixable) and lifecycle awareness (fixable??)

Day 4

Server-Side Development With Kotlin by Anton Arhipov

The State of Kotlin Support in Spring by Sébastien Deleuze

  • https://spring.io/guides/tutorials/spring-boot-kotlin/
  • Already part of documentation
  • Supported in MVC & WebFlux
    • Coroutines support in WebFlux, MVC support coming with 2.4
    • Annotations & Functional
  • First class coroutines support also in Data, Messaging & Vault
  • kotlinx.serialization supported starting 2.4!
  • 100% of spring framework API now has null-safety annotations
  • Rsocket kotlin (multiplatform with coroutines) rebooted
  • @ConfigurationProperties works with data classes with val properties using @ConstructorBinding
  • DSL for spring security

Ktor: Past, Present, and Future! by Hadi Hariri

  • Team size quadrupled, twitter account (@JetBrainsKtor), semver
  • CIO engine for server: Coroutines IO
  • Module Request -> Routing | -> App Logic | -> Response (Feature) (Feature) (Encoding) (Compression)
  • Features are like interceptors, such as default headers, content negotiation, authentication
  • Custom features supported, API being improved
  • Structure as it suits you; related post by Hadi
  • Improvements in store, including onboarding, tooling and documentation
  • ktor.io

Serverless Development With Kotlin and Kotless by Vladislav Tankov

  • Serverless
    • Pro: Pay per use, scalable, fault-tolerant
    • Con: Tons of configurations
  • Ktor deduces configuration from code, for..
    • multiple frameworks: spring, ktor, DSL ;
    • multiple runtimes: JVM, GraalVM, JS* ;
    • multiple clouds: AWS, GCP*, Azure* *: Under development
  • Supports local cloud emulation (using localstack)
  • Under the hood: Parses application -> cloud agnostic schema -> transpiled to and deployed using terraform
  • Cloud integration: permissions/events using annotations
  • Future:
    • Toolin in IDEA: remote logs tailing and debugging
    • More cloud-specific extensions

Full recording with Session QnA & General QnA

Day-wise summaries of talks of the Kotlin 1.4 Online Event
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment