Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Kotlin:
 An interoperability story

Yan
November 20, 2018

Kotlin:
 An interoperability story

Yan

November 20, 2018
Tweet

More Decks by Yan

Other Decks in Programming

Transcript

  1. val name: String = null Null can not be a

    value of a non-null type String
  2. val name: String? = null name.length Only safe (?.) or

    non-null asserted (!!.) calls are allowed
  3. class DetailsActivity : FragmentActivity() { override fun onCreate(savedInstanceState: Bundle?) {

    super.onCreate(savedInstanceState) setOrientation( getResources()!! .getConfiguration()!! .getOrientation()!!) getSupportFragmentManager()!! .beginTransaction()!! .add(android.R.id.content, DetailsFragment())!! .commit() } }
  4. class Worker { @field:Inject var log: Logger? = null fun

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

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

    Task) { log.debug("$task started") task.run() log.debug("$task ended") } }
  7. We ❤ Kotlin. And we want to use it everywhere.

    because Back-end Front-end Android iOS Embedded Games Scripting ICPC Desktop Science