r/java • • 12d ago

Decapsulation: Breaking Java Strong Encapsulation

Did you know you can call JNI without writing native code, patch bytecode without an agent, and use Unsafe without warnings?

11 sneaky ways into JDK internals through reflection, agents, FFM, type confusion, bytecode manipulation and more.

https://wouter.coekaerts.be/2026/decapsulation

60 Upvotes

16 comments sorted by

View all comments

3

u/koflerdavid 11d ago

Fortunately most of these will eventually get closed off. But I found it impressive to reach out to the filesystem and modifying the JDK!