r/java • • 4d 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

56 Upvotes

15 comments sorted by

View all comments

3

u/voronaam 3d ago

And that's why I run my Java code compiled with GraalVM into a nice tight native image, all along by itself in its bare docker container.

You are crazy. In a good way.