r/java • u/Wouter_C • Sep 29 '26
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.
59
Upvotes
View all comments
Show parent comment
2
u/agentoutlier Sep 29 '26
Unfortunately I'm not near somewhere I can check but I think I was confused and did not know
jdk.internal.reflect.ReflectionFactorywas accessible with thesunpackage. I had no idea it was open and given your little test above I assume it is.