Annotations
- What annotations are. An annotation attaches metadata to code: @Override for the compiler, @Test for tools reading later.
- Retention. Retention decides how long an annotation survives: source, class file, or visible at runtime.
- Writing your own. Custom annotations plus a processor let you declare intent once and generate the boilerplate.
Reflection
- Reflection basics. Reflection inspects classes at runtime: fields, methods and annotations discovered from Class objects.
- Dynamic invocation. Reflection can invoke methods found by name: the machinery under dependency injection and test runners.
- The cost. Reflection trades safety and speed for flexibility: application code should rarely reach for it directly.
Dynamic Language Features and Trade-Offs
- Proxies. A dynamic proxy implements an interface at runtime, wrapping calls: how frameworks add behaviour invisibly.
- Class loading. Classes load lazily through classloaders: plugins and containers isolate code by loader.
- Magic budget. Every reflective trick spends the team’s debuggability: frameworks may, application code mostly should not.
Before and after this level
- Before: Level 9: JVM & Memory: Heap, Stack and Object Allocation, Garbage Collection, JVM Runtime Behaviour.
- Next: Level 11: Networking & Data: HTTP and Network Programming, JDBC and Database Access, Reliable External Integrations.
In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See Checkpoints and flashcards.
Frequently asked questions
What does Java Level 10: Reflection & Language Infrastructure cover?
Annotations, Reflection, Dynamic Language Features and Trade-Offs: 3 lessons and 9 ideas.
What should I know before this level?
The level before it, Level 9: JVM & Memory, which covers Heap, Stack and Object Allocation, Garbage Collection, JVM Runtime Behaviour.