Preface
Introduction to the JVM
- Managed Runtime Environment
- Java Ecosystem
- JVM
- Class Loader, CLASSPATH and Interoperability
- Central Repository and Dependency Management
- Exercises
Type Basics
- JVM Type Fundamentals
- Primitive Types
- Reference Types
- Members
- Nested Types
- Kotlin to Java type system
- Kotlin Class Members
- Conversions and Casting
- Primitive Numeric Conversions
- Reference Type Casting
- Boxing and Unboxing
- Abstract and Base Types
- Anonymous classes
- Kotlin Object declarations
- Kotlin Function types
- Lambdas Translation in former Kotlin 1.x
- Exercises
Reflection
- Kotlin Reflection
- A Simple Logger Using Kotlin Reflection
- Java Reflection
- Checking Type Compatibility
- NaiveMapper: automatic object to object mapper
- NaiveMapper Motivation
- NaiveMapper Implementation
- Annotations
- Reflection of generic types
- Reflection Overhead and the Enhancement of NaiveMapper
- Reflection Overhead
- Enhancing the NaiveMapper
- Exercises
Performance testing and Microbenchmarking
- Performance Measurement Pitfalls
- JMH
- Exercises
Bytecode and the Just-in-time Compiler
- Evaluation Stack
- Constant Pool and Descriptors
- Managing Instances and Members
Metaprogramming
- Introduction
- Class-File API
- Dynamic Mapper
- Cojen Maker
- Cojen Maker Features
- Cojen Maker Examples
- Dynamic Mapper with Cojen Maker
Sequences, Generators and Suspending functions
- Sequence Alternatives
- Operation names
- Composability: method chaining versus nested functions
- Eager versus lazy evaluation
- Extensibility
- Access approach: pull versus push
- Generators and yield pattern
- Suspend functions
- Deconstructing yield and generators
- Translating a Suspend Function into a State Machine
- sequence builder
- Exercises
Garbage Collection and Cleanup Actions
- The Managed Heap
- Garbage Collection
- Types Requiring Special Cleanup
- Using closeable types
- Finalization and Cleaners