Who Instruments the Instrumenters?
summary
Shows how Java agents actually work: installs transformers via the Instrumentation API, uses Javaassist and Byte Buddy to rewrite methods, and inspects real-world effects from JaCoCo and Mockito. Built an agent that records transformer diffs (old vs new bytecode), decompiles changes with a Fernflower fork, and opens an HTTP server on port 7071 to browse modified classes. Demonstrates pitfalls (JaCoCo abusing equals, bootstrap classpath limits) and a Maven plugin; the tool works and found a Spring bug.
AI-written summary · about
chapters (17)
- 0:00Introduction to code instrumentation
- 2:12Code coverage with JaCoCo
- 5:04Mocking with Mockito
- 5:49Monitoring and profiling
- 7:55About Submachine and Java agents
- 8:38How Java agents work
- 12:29Java Assist for bytecode manipulation
- 15:20Who instruments the instrumenters?
- 18:11Meta agent demo overview
- 23:57JaCoCo's equals method hack
- 25:44Mockito's bytecode generation
- 30:01Live demo of meta agent
- 33:34Annotation proxies and pitfalls
- 36:47Class loader hierarchies explained
- 40:16Bootstrap class path challenges
- 41:19Maven plugin for runtime transformers
- 43:34Q&A and final thoughts
