Disassembling and Decompiling Scala Code
summary
Disassembles .class files with javap and a JD decompiler and shows concrete surprises: Scala emits a big @ScalaSignature byte array, case classes create companion $ classes that bloat permgen, default parameters become public static helper methods, and lazies compile to a volatile boolean plus a synchronized double‑check and a private compute method (thread‑safe). Demonstrates type erasure to Object for primitive-typed traits, shows tail-recursion converted to loop/break, and uses scalac -print and compiler phases to explain why mixed Java/Scala APIs can introduce runtime vs compile-time tradeoffs.
AI-written summary · about
chapters (16)
- 0:00Intro
- 1:07Motivation
- 3:27Tools
- 4:09Hello World
- 6:44Case Class
- 9:21Defaults via javap
- 10:27Profiler Lessons
- 12:44Decompiled Java Bean
- 13:57Companions
- 14:46Decompiled Generics
- 18:01Decompiled WorkerClConfig
- 23:00Decompiler Lessons
- 24:05scalac -Xprint:YYY Foo.scala
- 25:19Future Examples
- 26:37Architecture
- 27:36References








