Skip to content

Kotlin — References

Sources used for chapter 05 — Kotlin, grouped by purpose. Every entry has a one-line note explaining what it is good for. Where a resource is best known by name rather than by a stable URL, it is named rather than linked, so nothing here is invented.


1. Official Kotlin language documentation

  • Kotlin Documentation home — the entry point to every official topic page; start here when a construct is unfamiliar.
  • Kotlin language specification — the normative document defining semantics; the only place that settles arguments about corner cases.
  • Basic syntax — the fastest orientation for a reader arriving from Java.
  • Null safety — nullable types, safe calls, the Elvis operator, the not-null assertion, and platform types.
  • Type checks and casts — is, as, as?, and smart casts, which explain many odd-looking decompiled branches.
  • Classes and inheritance — primary constructors, init blocks, and the final-by-default rule.
  • Data classes — states exactly which members the compiler generates, which is the contract you rely on when reading JADX.
  • Sealed classes and interfaces — the restricted hierarchy rules that produce DefaultConstructorMarker constructors.
  • Object declarations and expressions — the source of the INSTANCE field and the Companion nested class.
  • Extensions — explains static dispatch and why extensions are not members.
  • Functions — default arguments, named arguments, varargs, and infix functions.
  • Higher-order functions and lambdas — function types, it, closures, and receivers.
  • Inline functions — inlining, noinline, crossinline, reified, and non-local returns.
  • Scope functions — the official selection table for let, run, with, apply, and also.
  • Delegated properties — by lazy, Delegates.observable, and the getValue/setValue contract.
  • Delegation — interface delegation with by, which produces the $$delegate_0 field.
  • Generics — declaration-site variance with in and out, star projections, and type erasure.
  • Collections overview — the read-only versus mutable distinction and why it is compile-time only.
  • Sequences — lazy evaluation and when it beats eager collection operators.
  • Coding conventions — the naming rules that let you guess a symbol's role from its shape.
  • The per-version "What's new in Kotlin" pages on kotlinlang.org/docs — useful for dating an APK's compiler generation from which helper names it emits, for example checkParameterIsNotNull before Kotlin 1.4 versus checkNotNullParameter after it.

2. Coroutines and concurrency

3. Java interoperability and the JVM back end

  • Calling Java from Kotlin — platform types, SAM conversion, and mapped types.
  • Calling Kotlin from Java — the authoritative description of @JvmStatic, @JvmField, @JvmName, @JvmOverloads, and companion-object visibility from Java.
  • Kotlin and Java mixed-language projects — how the two compilers cooperate in one module.
  • Android Kotlin-Java interop guide — Google's rules for writing API surfaces that stay pleasant from both languages.
  • The kotlin-metadata-jvm library, in the JetBrains/kotlin repository under libraries/ — the official parser for the @Metadata annotation; the correct way to read Kotlin declaration information out of a class file programmatically.

4. Android-specific Kotlin

5. Compiler, bytecode, and toolchain

6. OWASP MASVS and MASTG

The OWASP Mobile Application Security project is the assessment framework this repository maps to. Kotlin-specific findings almost always land in one of the control groups below; consult the MASTG site for the current test identifiers, which are renumbered periodically.

  • OWASP Mobile Application Security home — the umbrella project.
  • OWASP MASVS — the verification standard; the control groups are MASVS-STORAGE, MASVS-CRYPTO, MASVS-AUTH, MASVS-NETWORK, MASVS-PLATFORM, MASVS-CODE, MASVS-RESILIENCE, and MASVS-PRIVACY.
  • OWASP MASTG — the testing guide with concrete procedures and current test identifiers.
Kotlin-specific issue from this chapter MASVS control group What to verify
Data-class toString writing tokens to logcat MASVS-STORAGE No sensitive data reaches system logs or crash reports
Secrets held in by lazy delegates or companion object constants MASVS-CRYPTO, MASVS-STORAGE Keys are not hardcoded and are not recoverable from the DEX or from memory
!! on Intent extras in exported components MASVS-PLATFORM IPC input is validated before use; components are not crashable by third-party apps
Platform types from Java or JNI used as non-null MASVS-CODE External input is validated at the boundary
Suspend functions performing network work without pinning or validation MASVS-NETWORK Transport security is enforced regardless of which dispatcher the call runs on
Intrinsics strings and @Metadata leaking original names in a release build MASVS-RESILIENCE Obfuscation configuration matches the app's threat model
Personal data flowing through flows and continuations into logs MASVS-PRIVACY Data minimisation and no incidental persistence

7. Books

  • Kotlin in Action, Dmitry Jemerov and Svetlana Isakova, Manning — the standard book for Java developers; chapters on lambdas, inline functions, and Java interop are directly relevant to reading decompiled output. A second edition co-authored with Roman Elizarov and Sebastian Aigner adds coroutines and flows.
  • Atomic Kotlin, Bruce Eckel and Svetlana Isakova — small self-contained lessons, well suited to a reader who has never programmed before.
  • Effective Kotlin, Marcin Moskała — idioms and their costs; useful for predicting what a well-written codebase looks like and therefore what an anomaly looks like.
  • Kotlin Coroutines: Deep Dive, Marcin Moskała — the most thorough treatment of the continuation and state-machine transformation outside the KEEP document.
  • Android Security Internals, Nikolay Elenkov, No Starch Press — the platform-security background this repository assumes; predates Kotlin but the runtime and IPC material is unchanged.
  • The Mobile Application Hacker's Handbook, Chell, Erasmus, Colley, and Whitehouse, Wiley — assessment methodology to hang the Kotlin-specific techniques on.

8. Talks and long-form articles

Conference-talk URLs move between hosting platforms, so these are named rather than linked; each is findable by title on the KotlinConf and JetBrains channels.

  • Roman Elizarov, Deep Dive into Coroutines on JVM (KotlinConf) — the talk that walks through the compiler's state-machine transformation with real bytecode; the closest thing to a video version of this chapter's coroutine section.
  • Roman Elizarov, Structured Concurrency (article series) — the argument for scoping every coroutine, and the reasoning behind coroutineScope and supervisorScope.
  • Roman Elizarov, Blocking Threads, Suspending Coroutines (article) — the clearest short explanation of why a suspended coroutine occupies no thread.
  • Andrey Breslav and later JetBrains language-design talks on Why Kotlin looks the way it does — the pragmatic trade-offs behind platform types and interop.
  • Jake Wharton's talks on Kotlin's generated code and on multiplatform — consistently focused on what the compiler actually emits rather than on syntax.
  • The Talking Kotlin podcast, JetBrains — episodes with the compiler team cover back-end decisions that never appear in user documentation.

9. Chapters in this repository that build on this one

  • 04 — Java — the language the decompiler outputs; prerequisite for everything here.
  • 10 — APK Internals — where classes.dex lives and how to extract it.
  • 12 — DEX Internals — the string table format that detect-kotlin.py walks.
  • 13 — ART — how these methods are actually executed and compiled.
  • 26 — Intent — the delivery mechanism for the null-safety crash cases described in the FAQ.