Slide 1

Slide 1 text

Kotlin:
 An interoperability story Yan Zhulanow, JetBrains Nov 2018

Slide 2

Slide 2 text

Good Java interoperability
 from the very beginning

Slide 3

Slide 3 text

Good Java interoperability
 from the very beginning Because we needed it
 for our projects

Slide 4

Slide 4 text

Compiles to JVM bytecode equals? Good Java interoperability

Slide 5

Slide 5 text

Compiles to JVM bytecode equals? Good Java interoperability NO.

Slide 6

Slide 6 text

String? Nullable types

Slide 7

Slide 7 text

val name: String = null

Slide 8

Slide 8 text

val name: String = null Null can not be a value of a non-null type String

Slide 9

Slide 9 text

val name: String? = null name.length

Slide 10

Slide 10 text

val name: String? = null name.length Only safe (?.) or non-null asserted (!!.) calls are allowed

Slide 11

Slide 11 text

System.getProperty("my.property") String String? What about Java?

Slide 12

Slide 12 text

System.getProperty("my.property") String? What about Java?

Slide 13

Slide 13 text

class DetailsActivity : FragmentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setOrientation( getResources()!! .getConfiguration()!! .getOrientation()!!) getSupportFragmentManager()!! .beginTransaction()!! .add(android.R.id.content, DetailsFragment())!! .commit() } }

Slide 14

Slide 14 text

String! Platform types

Slide 15

Slide 15 text

Interoperable with Java

Slide 16

Slide 16 text

Interoperable with Java Ecosystem

Slide 17

Slide 17 text

Interoperable with Java Ecosystem Build tools Post-processors Analyzers Frameworks IDE

Slide 18

Slide 18 text

class Worker { @field:Inject var log: Logger? = null fun process(task: Task) { log?.debug("$task started") task.run() log?.debug("$task ended") } }

Slide 19

Slide 19 text

class Worker { @field:Inject var log: Logger? = null fun process(task: Task) { log?.debug("$task started") task.run() log?.debug("$task ended") } }

Slide 20

Slide 20 text

class Worker { @field:Inject lateinit var log: Logger fun process(task: Task) { log.debug("$task started") task.run() log.debug("$task ended") } }

Slide 21

Slide 21 text

@field:Inject Annotations with use-site targets

Slide 22

Slide 22 text

allopen noarg sam-with-receiver Compiler plugins

Slide 23

Slide 23 text

Inspections Java AST

Slide 24

Slide 24 text

UAST
 (universal AST) Java AST Kotlin AST Inspections

Slide 25

Slide 25 text

Interoperable with Java

Slide 26

Slide 26 text

Interoperable with Java Android

Slide 27

Slide 27 text

Tiny runtime around 1 MB

Slide 28

Slide 28 text

Dalvik/ART support

Slide 29

Slide 29 text

Tooling support Build tools, Lint, Android Extensions

Slide 30

Slide 30 text

Annotation processor support Dagger, ButterKnife, the rest 9000 of them

Slide 31

Slide 31 text

Kotlin 1.3
 Multi-platform projects!

Slide 32

Slide 32 text

Java Android Interoperable with

Slide 33

Slide 33 text

Java Android JavaScript Interoperable with

Slide 34

Slide 34 text

Java Android JavaScript C Interoperable with

Slide 35

Slide 35 text

Java Android JavaScript C
 Objective-C Interoperable with

Slide 36

Slide 36 text

Java Android JavaScript C
 Objective-C Swift Interoperable with

Slide 37

Slide 37 text

Java Android JavaScript C
 Objective-C Swift ??? Interoperable with

Slide 38

Slide 38 text

Java Android JavaScript C
 Objective-C Swift ??? Interoperable with ecosystem

Slide 39

Slide 39 text

We ❤ Kotlin. And we want to use it everywhere. because

Slide 40

Slide 40 text

We ❤ Kotlin. And we want to use it everywhere. because Back-end Front-end Android iOS Embedded Games Scripting ICPC Desktop Science

Slide 41

Slide 41 text

https://kotlinlang.org/

Slide 42

Slide 42 text

https://play.kotlinlang.org/

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Thanks! ❤