SlideShare a Scribd company logo
1 of 32
Download to read offline
Mikhail Glukhikh
mailto: Mikhail.Glukhikh@jetbrains.com
JetBrains, Senior Software Developer
 Developed by JetBrains since 2011
 Open-Source since 2012
 Targets JVM and JavaScript
◦ Java 6 / 7 / 8 / Android
 Statically Typed
 Object-Oriented
◦ + Functional features
◦ + Procedural features
 Java- and Scala-Compatible
 Plugins for IDEA and Eclipse
Kotlin: from null dereference to
smart casts 2
 14 minor releases passed in 2012 – 2015
 1.0 beta released (Nov 2015)
 1.0 coming soon
 Lines of Code
◦ ~250 KLOC in Kotlin project itself
◦ ~250 KLOC in other JetBrains projects
◦ ~1000 KLOC in non-JetBrains projects on GitHub
Kotlin: from null dereference to
smart casts 3
 Working in Kotlin project since March 2015
 Before: author of various research static
analysis tools
 Also: associate professor in SPbPU
Kotlin: from null dereference to
smart casts 4
 Full Java interoperability
 Safer than Java
◦ Null safety
◦ No raw types
◦ Invariant arrays
◦ Read-only collections
 More concise and expressive than Java
◦ Type inference
◦ Higher-order functions (closures)
◦ Extension functions
◦ Class delegation
 Compiler is at least as fast as Java
 Simpler than Scala
Kotlin: from null dereference to
smart casts 5
fun main(args: Array<String>) {
val name = if (args.isNotEmpty()) args[0]
else "Kotlin"
println("Hello, $name")
}
 val / var name : Type or = …
 fun name(a: TypeA, b: TypeB): Type { … } or = …
 Array<>, String
 if … else … expressions
 "Hello, $name" or even "Hello, ${my.name}"
Kotlin: from null dereference to
smart casts 6
 No primitive types, everything is an object
◦ Standard classes Int, Long, Char, Boolean, String, etc.
◦ Unit as the single-value type
 fun main(args: Array<String>): Unit { … }
◦ Nothing as the type that never exists
 fun todo(): Nothing = throw AssertionError()
◦ null has the type of Nothing?
◦ Any as the very base type for everything (not-null)
 fun equals(other: Any?): Boolean = …
 Interfaces and classes
 Nullable and not-null types
◦ E.g. String? and String, Any? and Any, etc.
Kotlin: from null dereference to
smart casts 7
interface Food
interface Animal : Food {
enum class Kind { HERBIVORE,OMNIVORE,CARNIVORE }
val kind: Kind
fun eat(food: Food): Boolean
fun die() = println("It dies")
}
class Lion : Animal {
override val kind = Animal.Kind.CARNIVORE
override fun eat(food: Food) =
if (food is Animal) {
food.die()
true
} else false
}
}
Kotlin: from null dereference to
smart casts 8
fun String.greet() =
println("Hello, $this")
fun greet(args: List<String>) =
args.filter { it.isNotEmpty() }
.sortBy { it }
.forEach { it.greet() }
Kotlin: from null dereference to
smart casts 9
sealed class Tree {
object Empty: Tree()
class Leaf(val x: Int): Tree()
class Node(val left: Tree,
val right: Tree): Tree()
fun max(): Int = when (this) {
Empty -> Int.MIN_VALUE
is Leaf -> this.x
is Node -> Math.max(this.left.max(),
this.right.max())
}
}
Kotlin: from null dereference to
smart casts 10
 Distinct nullable types Type? and
not-null types Type
 Null checks and smart casts
fun foo(s: String?) {
// Error: Only safe or not-null asserted
// calls allowed
println(s.length)
// Ok, smart cast to String
if (s != null) println(s.length)
if (s == null) return
println(s.length) // Smart cast also here
}
Kotlin: from null dereference to
smart casts 11
 Distinct nullable types Type? and
not-null types Type
 Safe calls, not-null asserted calls
fun foo(s: String?) {
// Error: Only safe or not-null asserted
// calls allowed
println(s.length)
// Ok, safe call (s.length or null)
println(s?.length)
// Ok, not-null assertion (unsafe!)
println(s!!.length)
}
Kotlin: from null dereference to
smart casts 12
 Distinct nullable types Type? and
not-null types Type
 Safe call with Elvis operator
fun foo(s: String?) {
// Error: Only safe or
// not-null asserted calls allowed
println(s.length)
// Ok, safe call + Elvis (s.length or NOTHING)
println(s?.length ?: "NOTHING")
}
Kotlin: from null dereference to
smart casts 13
 Flexible Types like Type!
◦ Type in Java  Type! in Kotlin
◦ Type! is not a syntax, just notation
◦ Assignable to both Type and Type?
◦ Dot is applicable to a variable of Type!
◦ Annotations are taken into account
 @NotNull Type in Java  Type in Kotlin
Kotlin: from null dereference to
smart casts 14
 is or !is to check, as or as? to convert
class StringHolder(val s: String) {
override fun equals(o: Any?): Boolean {
// Error: unresolved reference (o.s)
return s == o.s
if (o !is StringHolder) return false
// Ok, smart cast to StringHolder
return s == o.s
}
}
Kotlin: from null dereference to
smart casts 15
 is or !is to check, as or as? to convert
class StringHolder(val s: String) {
override fun equals(o: Any?): Boolean {
// Ok, unsafe (ClassCastException)
return s == (o as StringHolder).s
// Ok, safe
return s == (o as? StringHolder)?.s
}
}
Kotlin: from null dereference to
smart casts 16
 Top-down analysis on AST
 For each relevant expression E, possible types of
E: T(E) are determined at each AST node
 T(null) = Nothing?
 Example
fun foo(s: String?) {
// T(s) = {String?} = {String,Nothing?}
if (s != null) {
// T(s) = {Nothing?}
println(s.length)
}
}
Kotlin: from null dereference to
smart casts 17
 For local values, function parameters,
special this variable
 For member or top-level values if:
◦ They are not overridable and have no custom getter AND
 They are private or internal (not a part of public API) OR
 They are protected or public, and used in the same
compilation module when declared
class My {
private val a: String? // safe
public val b: String? // same module only
internal open val c: String? // unsafe
private val d: String? // unsafe
get() = null
}
Kotlin: from null dereference to
smart casts 18
 For local variables if
◦ a smart cast is performed not in the loop which changes the
variable after the smart cast
fun foo() {
var s: String? // T(s) = String U Nothing?
s = "abc" // T(s) = String
s.length // smart cast
while (s != "x") {
// Unsafe: changed later in the loop
if (s.length > 0) s = s.substring(1)
else s = null
}
}
Kotlin: from null dereference to
smart casts 19
 For local variables if
◦ a smart cast is performed in the same function when the
variable is declared, not inside some closure
◦ no closure that changes the variable exists before the
location of the smart cast
fun indexOfMax(a: IntArray): Int? {
var maxI: Int? = null
a.forEachIndexed { i, value ->
if (maxI == null || value >= a[maxI]) {
maxI = i
}
}
return maxI
}
Kotlin: from null dereference to
smart casts 20
 val / var x: Type :
T(x) = Type
 val / var x: Type? :
T(x) = Type U Nothing?
 Statement:
Tin(x)  Tout(x)
 If:
Tin(x)  Ttrue(x), Tfalse(x)
 Merge:
Tin1(x), Tin2(x)  Tout(x)
Kotlin: from null dereference to
smart casts 21
 if (x != null) or while (x != null)
Ttrue (x) = Tin(x)  {Nothing?}
Tfalse(x) = Tin(x) & {Nothing?}
 if (x is Something)
Ttrue (x) = Tin(x) & {Something}
Tfalse(x) = Tin(x)  {Something}
 if (x == y)
Ttrue (x,y) = Tin(x) & Tin(y)
Tfalse(x) = Tin(x)  Tin(y)
Tfalse(y) = Tin(y)  Tin(x)
Kotlin: from null dereference to
smart casts 22
 if (A && B)
True: TrueA & TrueB
False: FalseA U FalseB
 if (A || B)
True: TrueA U TrueB
False: FalseA & FalseB
 Example: if (x == null && y != null)
Ttrue (x) = Tin(x) & {Nothing?}
Ttrue (y) = Tin(y)  {Nothing?}
Tfalse(x) = Tin(x)
Tfalse(y) = Tin(y)
Kotlin: from null dereference to
smart casts 23
 x!!
Tout(x) = Tin(x)  {Nothing?}
 x as Something
Tout(x) = Tin(x) & {Something}
 x?.foo(...)
Tfoo(x) = Tin(x)  {Nothing?}
Tout(x) = Tin(x)
Kotlin: from null dereference to
smart casts 24
 if (…) { … } else { … }
Out = In1 U In2
 when (…) { … -> …; … -> …; else -> …;}
Out = In1 U In2 U … U In(else)
Kotlin: from null dereference to
smart casts 25
 Assignment: x = y or initialization: var x = y
◦ Tout(x) = Tin(y)
 Initialization with given type: var x: Type = y
◦ Tout(x) = { Type }
 Before entering a loop
◦ For all X changed inside: Tout(X) = Type(X)
data class Node(val s: String, val next: Node?)
fun foo(node: Node) {
var current: Node? // T = {Node,Nothing?}
current = node // T = {Node}
while (true) { // T = {Node,Nothing?}
println(current.s) // Error
if (current == null) break
println(current.s) // Ok: T = {Node}
current = current.next // T = {Node,Nothing?}
} // T = {Nothing?}
}
Kotlin: from null dereference to
smart casts 26
 Classic data flow analysis on CFG
◦ Variable initialization analysis
◦ Variable usage analysis
◦ Code reachability analysis
◦ …
Kotlin: from null dereference to
smart casts 27
 Total smart casts: 8500
 Unsafe operations
◦ !! : 1500 (mostly provoked by implicit conventions)
◦ as : 1500
 Checks:
◦ != null : 2000
◦ == null : 1000
 Safe operations:
◦ ?. : 2500
◦ as? : 1000
◦ ?: : 2500
Kotlin: from null dereference to
smart casts 28
 More precise loop analysis
 More precise closure analysis
 Extra helper annotations like
@Pure or @Consistent for mutable properties
 …
Kotlin: from null dereference to
smart casts 29
 http://kotlinlang.org – language information,
API reference, tutorials, koans, installation
instructions, community, etc.
 http://github.com/JetBrains/Kotlin –
main compiler & plugin repository
 http://blog.jetbrains.com/kotlin/ –
Kotlin blog
 Questions?
Kotlin: from null dereference to
smart casts 30
 Java  Kotlin
◦ Checked exceptions
◦ Primitive types that are not classes
◦ Static members
◦ Non-private fields
 Kotlin  Java
◦ Extension functions
◦ Null-safety, smart casts
◦ String templates
◦ Properties
◦ Primary constructors
◦ Class delegation
◦ Type inference
◦ Singletons
◦ Operator overloading, infix functions
◦ …
Kotlin: from null dereference to
smart casts 31
 Scala  Kotlin
◦ Implicit conversions
◦ Overridable type members
◦ Existential types
◦ Structural types
◦ Value types
◦ Yield operator
◦ Actors
◦ …
 Kotlin  Scala
◦ Zero overhead null safety
◦ Smart casts
◦ Class delegation
Kotlin: from null dereference to
smart casts 32

More Related Content

What's hot

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to ScalaBrian Hsu
 
Being Expressive in Code
Being Expressive in CodeBeing Expressive in Code
Being Expressive in CodeEamonn Boyle
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?Federico Tomassetti
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
Objective-C to Swift - Swift Cloud Workshop 3
Objective-C to Swift - Swift Cloud Workshop 3Objective-C to Swift - Swift Cloud Workshop 3
Objective-C to Swift - Swift Cloud Workshop 3Randy Scovil
 
Temporal logic and functional reactive programming
Temporal logic and functional reactive programmingTemporal logic and functional reactive programming
Temporal logic and functional reactive programmingSergei Winitzki
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalMichael Stal
 
Understanding Javascript Engines
Understanding Javascript Engines Understanding Javascript Engines
Understanding Javascript Engines Parashuram N
 
AST Transformations
AST TransformationsAST Transformations
AST TransformationsHamletDRC
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)HamletDRC
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpMichael Stal
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In PracticeMichiel Borkent
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaMichael Stal
 
Preparing Java 7 Certifications
Preparing Java 7 CertificationsPreparing Java 7 Certifications
Preparing Java 7 CertificationsGiacomo Veneri
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalkkim.mens
 

What's hot (20)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Being Expressive in Code
Being Expressive in CodeBeing Expressive in Code
Being Expressive in Code
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Objective-C to Swift - Swift Cloud Workshop 3
Objective-C to Swift - Swift Cloud Workshop 3Objective-C to Swift - Swift Cloud Workshop 3
Objective-C to Swift - Swift Cloud Workshop 3
 
Programming in Arduino (Part 2)
Programming in Arduino  (Part 2)Programming in Arduino  (Part 2)
Programming in Arduino (Part 2)
 
Programming in Arduino (Part 1)
Programming in Arduino (Part 1)Programming in Arduino (Part 1)
Programming in Arduino (Part 1)
 
Temporal logic and functional reactive programming
Temporal logic and functional reactive programmingTemporal logic and functional reactive programming
Temporal logic and functional reactive programming
 
Elm talk bayhac2015
Elm talk bayhac2015Elm talk bayhac2015
Elm talk bayhac2015
 
Oop2010 Scala Presentation Stal
Oop2010 Scala Presentation StalOop2010 Scala Presentation Stal
Oop2010 Scala Presentation Stal
 
Understanding Javascript Engines
Understanding Javascript Engines Understanding Javascript Engines
Understanding Javascript Engines
 
Java 5 Features
Java 5 FeaturesJava 5 Features
Java 5 Features
 
AST Transformations
AST TransformationsAST Transformations
AST Transformations
 
Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)Groovy Ast Transformations (greach)
Groovy Ast Transformations (greach)
 
Qcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharpQcon2011 functions rockpresentation_f_sharp
Qcon2011 functions rockpresentation_f_sharp
 
Functional Programming In Practice
Functional Programming In PracticeFunctional Programming In Practice
Functional Programming In Practice
 
Qcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scalaQcon2011 functions rockpresentation_scala
Qcon2011 functions rockpresentation_scala
 
Preparing Java 7 Certifications
Preparing Java 7 CertificationsPreparing Java 7 Certifications
Preparing Java 7 Certifications
 
Scala
ScalaScala
Scala
 
Introduction to Smalltalk
Introduction to SmalltalkIntroduction to Smalltalk
Introduction to Smalltalk
 

Viewers also liked

TMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessTMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessIosif Itkin
 
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...Iosif Itkin
 
TMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsTMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsIosif Itkin
 
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...Iosif Itkin
 
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...Iosif Itkin
 
TMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsTMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsIosif Itkin
 
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsTMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsIosif Itkin
 
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...Iosif Itkin
 
TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...Iosif Itkin
 
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...Iosif Itkin
 
TMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachTMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachIosif Itkin
 
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...Iosif Itkin
 
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...Iosif Itkin
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...Iosif Itkin
 
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesTMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesIosif Itkin
 
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemTMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemIosif Itkin
 
TMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsTMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsIosif Itkin
 
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentTMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentIosif Itkin
 
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...Iosif Itkin
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...Iosif Itkin
 

Viewers also liked (20)

TMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored AccessTMPA-2015: FPGA-Based Low Latency Sponsored Access
TMPA-2015: FPGA-Based Low Latency Sponsored Access
 
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...
TMPA-2015: The Verification of Functional Programs by Applying Statechart Dia...
 
TMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in RoboticsTMPA-2015: Formal Methods in Robotics
TMPA-2015: Formal Methods in Robotics
 
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
TMPA-2015: Towards a Usable Defect Prediction Tool: Crossbreeding Machine Lea...
 
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
TMPA-2015: Automated Testing of Multi-thread Data Structures Solutions Lineri...
 
TMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard FunctionsTMPA-2015: A Need To Specify and Verify Standard Functions
TMPA-2015: A Need To Specify and Verify Standard Functions
 
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade SystemsTMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
TMPA-2015: ClearTH: a Tool for Automated Testing of Post Trade Systems
 
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
TMPA-2015: Standards and Standartization in Program Engineering. Why Would Yo...
 
TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...TMPA-2015: Automated process of creating test scenarios for financial protoco...
TMPA-2015: Automated process of creating test scenarios for financial protoco...
 
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
TMPA-2015: Expanding the Meta-Generation of Correctness Conditions by Means o...
 
TMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir ApproachTMPA-2015: Software Engineering Education: The Messir Approach
TMPA-2015: Software Engineering Education: The Messir Approach
 
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
TMPA-2015: Generation of Test Scenarios for Non Deterministic and Concurrent ...
 
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
TMPA-2015: Information Support System for Autonomous Spacecraft Control Macro...
 
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
TMPA-2015: The Application of Parameterized Hierarchy Templates for Automated...
 
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual MachinesTMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
TMPA-2015: Multi-Platform Approach to Reverse Debugging of Virtual Machines
 
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light SystemTMPA-2015: Implementing the MetaVCG Approach in the C-light System
TMPA-2015: Implementing the MetaVCG Approach in the C-light System
 
TMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressionsTMPA-2015: Lexical analysis of dynamically formed string expressions
TMPA-2015: Lexical analysis of dynamically formed string expressions
 
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS EnvironmentTMPA-2015: Multi-Module Application Tracing in z/OS Environment
TMPA-2015: Multi-Module Application Tracing in z/OS Environment
 
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
TMPA-2015: The Application of Static Analysis to Optimize the Dynamic Detecti...
 
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
TMPA-2015: The dynamic Analysis of Executable Code in ELF Format Based on Sta...
 

Similar to Kotlin From Null Dereference to Smart Casts

Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvmArnaud Giuliani
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Andrés Viedma Peláez
 
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdfAndrey Breslav
 
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan s.r.o.
 
A quick and fast intro to Kotlin
A quick and fast intro to Kotlin A quick and fast intro to Kotlin
A quick and fast intro to Kotlin XPeppers
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesKai Koenig
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxIan Robertson
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Mohamed Nabil, MSc.
 
Kotlin for Android devs
Kotlin for Android devsKotlin for Android devs
Kotlin for Android devsAdit Lal
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampKai Koenig
 
Android 101 - Kotlin ( Future of Android Development)
Android 101 - Kotlin ( Future of Android Development)Android 101 - Kotlin ( Future of Android Development)
Android 101 - Kotlin ( Future of Android Development)Hassan Abid
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinKai Koenig
 
2 kotlin vs. java: what java has that kotlin does not
2  kotlin vs. java: what java has that kotlin does not2  kotlin vs. java: what java has that kotlin does not
2 kotlin vs. java: what java has that kotlin does notSergey Bandysik
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Andrey Breslav
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, SwiftYandex
 
Building Mobile Apps with Android
Building Mobile Apps with AndroidBuilding Mobile Apps with Android
Building Mobile Apps with AndroidKurt Renzo Acosta
 

Similar to Kotlin From Null Dereference to Smart Casts (20)

Kotlin, smarter development for the jvm
Kotlin, smarter development for the jvmKotlin, smarter development for the jvm
Kotlin, smarter development for the jvm
 
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
Poniendo Kotlin en producción a palos (Kotlin in production, the hard way)
 
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
2022 May - Shoulders of Giants - Amsterdam - Kotlin Dev Day.pdf
 
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
eMan Dev Meetup: Kotlin - A Language we should know it exists (part 02/03) 18...
 
A quick and fast intro to Kotlin
A quick and fast intro to Kotlin A quick and fast intro to Kotlin
A quick and fast intro to Kotlin
 
Kotlin
KotlinKotlin
Kotlin
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutes
 
Why Kotlin is your next language?
Why Kotlin is your next language? Why Kotlin is your next language?
Why Kotlin is your next language?
 
KotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptxKotlinForJavaDevelopers-UJUG.pptx
KotlinForJavaDevelopers-UJUG.pptx
 
Kotlin for Android Developers - 3
Kotlin for Android Developers - 3Kotlin for Android Developers - 3
Kotlin for Android Developers - 3
 
Kotlin for Android devs
Kotlin for Android devsKotlin for Android devs
Kotlin for Android devs
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcamp
 
Android 101 - Kotlin ( Future of Android Development)
Android 101 - Kotlin ( Future of Android Development)Android 101 - Kotlin ( Future of Android Development)
Android 101 - Kotlin ( Future of Android Development)
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with Kotlin
 
2 kotlin vs. java: what java has that kotlin does not
2  kotlin vs. java: what java has that kotlin does not2  kotlin vs. java: what java has that kotlin does not
2 kotlin vs. java: what java has that kotlin does not
 
Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011Kotlin @ Devoxx 2011
Kotlin @ Devoxx 2011
 
Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011Kotlin Slides from Devoxx 2011
Kotlin Slides from Devoxx 2011
 
Kotlin
KotlinKotlin
Kotlin
 
Denis Lebedev, Swift
Denis  Lebedev, SwiftDenis  Lebedev, Swift
Denis Lebedev, Swift
 
Building Mobile Apps with Android
Building Mobile Apps with AndroidBuilding Mobile Apps with Android
Building Mobile Apps with Android
 

More from Iosif Itkin

Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Iosif Itkin
 
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...Iosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesIosif Itkin
 
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolExactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolIosif Itkin
 
Operational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresOperational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresIosif Itkin
 
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday SeasonIosif Itkin
 
Testing the Intelligence of your AI
Testing the Intelligence of your AITesting the Intelligence of your AI
Testing the Intelligence of your AIIosif Itkin
 
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresEXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresIosif Itkin
 
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...Iosif Itkin
 
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiEXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiIosif Itkin
 
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenEXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenIosif Itkin
 
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...Iosif Itkin
 
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...Iosif Itkin
 
QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)Iosif Itkin
 
Machine Learning and RoboCop Testing
Machine Learning and RoboCop TestingMachine Learning and RoboCop Testing
Machine Learning and RoboCop TestingIosif Itkin
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileIosif Itkin
 
2018 - Exactpro Year in Review
2018 - Exactpro Year in Review2018 - Exactpro Year in Review
2018 - Exactpro Year in ReviewIosif Itkin
 
Exactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyExactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyIosif Itkin
 
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesFIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesIosif Itkin
 
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)Iosif Itkin
 

More from Iosif Itkin (20)

Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4Foundations of Software Testing Lecture 4
Foundations of Software Testing Lecture 4
 
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
QA Financial Forum London 2021 - Automation in Software Testing. Humans and C...
 
Exactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test OraclesExactpro FinTech Webinar - Global Exchanges Test Oracles
Exactpro FinTech Webinar - Global Exchanges Test Oracles
 
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX ProtocolExactpro FinTech Webinar - Global Exchanges FIX Protocol
Exactpro FinTech Webinar - Global Exchanges FIX Protocol
 
Operational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market InfrastructuresOperational Resilience in Financial Market Infrastructures
Operational Resilience in Financial Market Infrastructures
 
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
20 Simple Questions from Exactpro for Your Enjoyment This Holiday Season
 
Testing the Intelligence of your AI
Testing the Intelligence of your AITesting the Intelligence of your AI
Testing the Intelligence of your AI
 
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market InfrastructuresEXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
EXTENT 2019: Exactpro Quality Assurance for Financial Market Infrastructures
 
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
ClearTH Test Automation Framework: Case Study in IRS & CDS Swaps Lifecycle Mo...
 
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan ShamraiEXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
EXTENT Talks 2019 Tbilisi: Failover and Recovery Test Automation - Ivan Shamrai
 
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference OpenEXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
EXTENT Talks QA Community Tbilisi 20 April 2019 - Conference Open
 
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
User-Assisted Log Analysis for Quality Control of Distributed Fintech Applica...
 
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
QAFF Chicago 2019 - Complex Post-Trade Systems, Requirements Traceability and...
 
QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)QA Community Saratov: Past, Present, Future (2019-02-08)
QA Community Saratov: Past, Present, Future (2019-02-08)
 
Machine Learning and RoboCop Testing
Machine Learning and RoboCop TestingMachine Learning and RoboCop Testing
Machine Learning and RoboCop Testing
 
Behaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibileBehaviour Driven Development: Oltre i limiti del possibile
Behaviour Driven Development: Oltre i limiti del possibile
 
2018 - Exactpro Year in Review
2018 - Exactpro Year in Review2018 - Exactpro Year in Review
2018 - Exactpro Year in Review
 
Exactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and StrategyExactpro Discussion about Joy and Strategy
Exactpro Discussion about Joy and Strategy
 
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing ChallengesFIX EMEA Conference 2018 - Post Trade Software Testing Challenges
FIX EMEA Conference 2018 - Post Trade Software Testing Challenges
 
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
BDD. The Outer Limits. Iosif Itkin at Youcon (in Russian)
 

Recently uploaded

Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfSumit Kumar yadav
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...Sérgio Sacani
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfSumit Kumar yadav
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfSumit Kumar yadav
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000Sapana Sha
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxkessiyaTpeter
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisDiwakar Mishra
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfmuntazimhurra
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCEPRINCE C P
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxgindu3009
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)Areesha Ahmad
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRDelhi Call girls
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSarthak Sekhar Mondal
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfSumit Kumar yadav
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...anilsa9823
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptxRajatChauhan518211
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PPRINCE C P
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxjana861314
 

Recently uploaded (20)

Botany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdfBotany 4th semester file By Sumit Kumar yadav.pdf
Botany 4th semester file By Sumit Kumar yadav.pdf
 
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
All-domain Anomaly Resolution Office U.S. Department of Defense (U) Case: “Eg...
 
Chemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdfChemistry 4th semester series (krishna).pdf
Chemistry 4th semester series (krishna).pdf
 
Botany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdfBotany 4th semester series (krishna).pdf
Botany 4th semester series (krishna).pdf
 
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 60009654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
9654467111 Call Girls In Raj Nagar Delhi Short 1500 Night 6000
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
 
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral AnalysisRaman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
Raman spectroscopy.pptx M Pharm, M Sc, Advanced Spectral Analysis
 
Biological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdfBiological Classification BioHack (3).pdf
Biological Classification BioHack (3).pdf
 
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCESTERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
STERILITY TESTING OF PHARMACEUTICALS ppt by DR.C.P.PRINCE
 
CELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdfCELL -Structural and Functional unit of life.pdf
CELL -Structural and Functional unit of life.pdf
 
Presentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptxPresentation Vikram Lander by Vedansh Gupta.pptx
Presentation Vikram Lander by Vedansh Gupta.pptx
 
GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)GBSN - Microbiology (Unit 1)
GBSN - Microbiology (Unit 1)
 
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCRStunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
Stunning ➥8448380779▻ Call Girls In Panchshil Enclave Delhi NCR
 
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
9953056974 Young Call Girls In Mahavir enclave Indian Quality Escort service
 
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatidSpermiogenesis or Spermateleosis or metamorphosis of spermatid
Spermiogenesis or Spermateleosis or metamorphosis of spermatid
 
Zoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdfZoology 4th semester series (krishna).pdf
Zoology 4th semester series (krishna).pdf
 
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
Lucknow 💋 Russian Call Girls Lucknow Finest Escorts Service 8923113531 Availa...
 
Green chemistry and Sustainable development.pptx
Green chemistry  and Sustainable development.pptxGreen chemistry  and Sustainable development.pptx
Green chemistry and Sustainable development.pptx
 
VIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C PVIRUSES structure and classification ppt by Dr.Prince C P
VIRUSES structure and classification ppt by Dr.Prince C P
 
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptxBroad bean, Lima Bean, Jack bean, Ullucus.pptx
Broad bean, Lima Bean, Jack bean, Ullucus.pptx
 

Kotlin From Null Dereference to Smart Casts

  • 2.  Developed by JetBrains since 2011  Open-Source since 2012  Targets JVM and JavaScript ◦ Java 6 / 7 / 8 / Android  Statically Typed  Object-Oriented ◦ + Functional features ◦ + Procedural features  Java- and Scala-Compatible  Plugins for IDEA and Eclipse Kotlin: from null dereference to smart casts 2
  • 3.  14 minor releases passed in 2012 – 2015  1.0 beta released (Nov 2015)  1.0 coming soon  Lines of Code ◦ ~250 KLOC in Kotlin project itself ◦ ~250 KLOC in other JetBrains projects ◦ ~1000 KLOC in non-JetBrains projects on GitHub Kotlin: from null dereference to smart casts 3
  • 4.  Working in Kotlin project since March 2015  Before: author of various research static analysis tools  Also: associate professor in SPbPU Kotlin: from null dereference to smart casts 4
  • 5.  Full Java interoperability  Safer than Java ◦ Null safety ◦ No raw types ◦ Invariant arrays ◦ Read-only collections  More concise and expressive than Java ◦ Type inference ◦ Higher-order functions (closures) ◦ Extension functions ◦ Class delegation  Compiler is at least as fast as Java  Simpler than Scala Kotlin: from null dereference to smart casts 5
  • 6. fun main(args: Array<String>) { val name = if (args.isNotEmpty()) args[0] else "Kotlin" println("Hello, $name") }  val / var name : Type or = …  fun name(a: TypeA, b: TypeB): Type { … } or = …  Array<>, String  if … else … expressions  "Hello, $name" or even "Hello, ${my.name}" Kotlin: from null dereference to smart casts 6
  • 7.  No primitive types, everything is an object ◦ Standard classes Int, Long, Char, Boolean, String, etc. ◦ Unit as the single-value type  fun main(args: Array<String>): Unit { … } ◦ Nothing as the type that never exists  fun todo(): Nothing = throw AssertionError() ◦ null has the type of Nothing? ◦ Any as the very base type for everything (not-null)  fun equals(other: Any?): Boolean = …  Interfaces and classes  Nullable and not-null types ◦ E.g. String? and String, Any? and Any, etc. Kotlin: from null dereference to smart casts 7
  • 8. interface Food interface Animal : Food { enum class Kind { HERBIVORE,OMNIVORE,CARNIVORE } val kind: Kind fun eat(food: Food): Boolean fun die() = println("It dies") } class Lion : Animal { override val kind = Animal.Kind.CARNIVORE override fun eat(food: Food) = if (food is Animal) { food.die() true } else false } } Kotlin: from null dereference to smart casts 8
  • 9. fun String.greet() = println("Hello, $this") fun greet(args: List<String>) = args.filter { it.isNotEmpty() } .sortBy { it } .forEach { it.greet() } Kotlin: from null dereference to smart casts 9
  • 10. sealed class Tree { object Empty: Tree() class Leaf(val x: Int): Tree() class Node(val left: Tree, val right: Tree): Tree() fun max(): Int = when (this) { Empty -> Int.MIN_VALUE is Leaf -> this.x is Node -> Math.max(this.left.max(), this.right.max()) } } Kotlin: from null dereference to smart casts 10
  • 11.  Distinct nullable types Type? and not-null types Type  Null checks and smart casts fun foo(s: String?) { // Error: Only safe or not-null asserted // calls allowed println(s.length) // Ok, smart cast to String if (s != null) println(s.length) if (s == null) return println(s.length) // Smart cast also here } Kotlin: from null dereference to smart casts 11
  • 12.  Distinct nullable types Type? and not-null types Type  Safe calls, not-null asserted calls fun foo(s: String?) { // Error: Only safe or not-null asserted // calls allowed println(s.length) // Ok, safe call (s.length or null) println(s?.length) // Ok, not-null assertion (unsafe!) println(s!!.length) } Kotlin: from null dereference to smart casts 12
  • 13.  Distinct nullable types Type? and not-null types Type  Safe call with Elvis operator fun foo(s: String?) { // Error: Only safe or // not-null asserted calls allowed println(s.length) // Ok, safe call + Elvis (s.length or NOTHING) println(s?.length ?: "NOTHING") } Kotlin: from null dereference to smart casts 13
  • 14.  Flexible Types like Type! ◦ Type in Java  Type! in Kotlin ◦ Type! is not a syntax, just notation ◦ Assignable to both Type and Type? ◦ Dot is applicable to a variable of Type! ◦ Annotations are taken into account  @NotNull Type in Java  Type in Kotlin Kotlin: from null dereference to smart casts 14
  • 15.  is or !is to check, as or as? to convert class StringHolder(val s: String) { override fun equals(o: Any?): Boolean { // Error: unresolved reference (o.s) return s == o.s if (o !is StringHolder) return false // Ok, smart cast to StringHolder return s == o.s } } Kotlin: from null dereference to smart casts 15
  • 16.  is or !is to check, as or as? to convert class StringHolder(val s: String) { override fun equals(o: Any?): Boolean { // Ok, unsafe (ClassCastException) return s == (o as StringHolder).s // Ok, safe return s == (o as? StringHolder)?.s } } Kotlin: from null dereference to smart casts 16
  • 17.  Top-down analysis on AST  For each relevant expression E, possible types of E: T(E) are determined at each AST node  T(null) = Nothing?  Example fun foo(s: String?) { // T(s) = {String?} = {String,Nothing?} if (s != null) { // T(s) = {Nothing?} println(s.length) } } Kotlin: from null dereference to smart casts 17
  • 18.  For local values, function parameters, special this variable  For member or top-level values if: ◦ They are not overridable and have no custom getter AND  They are private or internal (not a part of public API) OR  They are protected or public, and used in the same compilation module when declared class My { private val a: String? // safe public val b: String? // same module only internal open val c: String? // unsafe private val d: String? // unsafe get() = null } Kotlin: from null dereference to smart casts 18
  • 19.  For local variables if ◦ a smart cast is performed not in the loop which changes the variable after the smart cast fun foo() { var s: String? // T(s) = String U Nothing? s = "abc" // T(s) = String s.length // smart cast while (s != "x") { // Unsafe: changed later in the loop if (s.length > 0) s = s.substring(1) else s = null } } Kotlin: from null dereference to smart casts 19
  • 20.  For local variables if ◦ a smart cast is performed in the same function when the variable is declared, not inside some closure ◦ no closure that changes the variable exists before the location of the smart cast fun indexOfMax(a: IntArray): Int? { var maxI: Int? = null a.forEachIndexed { i, value -> if (maxI == null || value >= a[maxI]) { maxI = i } } return maxI } Kotlin: from null dereference to smart casts 20
  • 21.  val / var x: Type : T(x) = Type  val / var x: Type? : T(x) = Type U Nothing?  Statement: Tin(x)  Tout(x)  If: Tin(x)  Ttrue(x), Tfalse(x)  Merge: Tin1(x), Tin2(x)  Tout(x) Kotlin: from null dereference to smart casts 21
  • 22.  if (x != null) or while (x != null) Ttrue (x) = Tin(x) {Nothing?} Tfalse(x) = Tin(x) & {Nothing?}  if (x is Something) Ttrue (x) = Tin(x) & {Something} Tfalse(x) = Tin(x) {Something}  if (x == y) Ttrue (x,y) = Tin(x) & Tin(y) Tfalse(x) = Tin(x) Tin(y) Tfalse(y) = Tin(y) Tin(x) Kotlin: from null dereference to smart casts 22
  • 23.  if (A && B) True: TrueA & TrueB False: FalseA U FalseB  if (A || B) True: TrueA U TrueB False: FalseA & FalseB  Example: if (x == null && y != null) Ttrue (x) = Tin(x) & {Nothing?} Ttrue (y) = Tin(y) {Nothing?} Tfalse(x) = Tin(x) Tfalse(y) = Tin(y) Kotlin: from null dereference to smart casts 23
  • 24.  x!! Tout(x) = Tin(x) {Nothing?}  x as Something Tout(x) = Tin(x) & {Something}  x?.foo(...) Tfoo(x) = Tin(x) {Nothing?} Tout(x) = Tin(x) Kotlin: from null dereference to smart casts 24
  • 25.  if (…) { … } else { … } Out = In1 U In2  when (…) { … -> …; … -> …; else -> …;} Out = In1 U In2 U … U In(else) Kotlin: from null dereference to smart casts 25
  • 26.  Assignment: x = y or initialization: var x = y ◦ Tout(x) = Tin(y)  Initialization with given type: var x: Type = y ◦ Tout(x) = { Type }  Before entering a loop ◦ For all X changed inside: Tout(X) = Type(X) data class Node(val s: String, val next: Node?) fun foo(node: Node) { var current: Node? // T = {Node,Nothing?} current = node // T = {Node} while (true) { // T = {Node,Nothing?} println(current.s) // Error if (current == null) break println(current.s) // Ok: T = {Node} current = current.next // T = {Node,Nothing?} } // T = {Nothing?} } Kotlin: from null dereference to smart casts 26
  • 27.  Classic data flow analysis on CFG ◦ Variable initialization analysis ◦ Variable usage analysis ◦ Code reachability analysis ◦ … Kotlin: from null dereference to smart casts 27
  • 28.  Total smart casts: 8500  Unsafe operations ◦ !! : 1500 (mostly provoked by implicit conventions) ◦ as : 1500  Checks: ◦ != null : 2000 ◦ == null : 1000  Safe operations: ◦ ?. : 2500 ◦ as? : 1000 ◦ ?: : 2500 Kotlin: from null dereference to smart casts 28
  • 29.  More precise loop analysis  More precise closure analysis  Extra helper annotations like @Pure or @Consistent for mutable properties  … Kotlin: from null dereference to smart casts 29
  • 30.  http://kotlinlang.org – language information, API reference, tutorials, koans, installation instructions, community, etc.  http://github.com/JetBrains/Kotlin – main compiler & plugin repository  http://blog.jetbrains.com/kotlin/ – Kotlin blog  Questions? Kotlin: from null dereference to smart casts 30
  • 31.  Java Kotlin ◦ Checked exceptions ◦ Primitive types that are not classes ◦ Static members ◦ Non-private fields  Kotlin Java ◦ Extension functions ◦ Null-safety, smart casts ◦ String templates ◦ Properties ◦ Primary constructors ◦ Class delegation ◦ Type inference ◦ Singletons ◦ Operator overloading, infix functions ◦ … Kotlin: from null dereference to smart casts 31
  • 32.  Scala Kotlin ◦ Implicit conversions ◦ Overridable type members ◦ Existential types ◦ Structural types ◦ Value types ◦ Yield operator ◦ Actors ◦ …  Kotlin Scala ◦ Zero overhead null safety ◦ Smart casts ◦ Class delegation Kotlin: from null dereference to smart casts 32