Fun things you can do by mutating Java strings
- by polygenelubricants
So I've come around since I asked how to limit setAccessible to only “legitimate” uses and have come to embrace its power for fun. Enabled by its power, of course, is string mutation.
import java.lang.reflect.Field;
public class Mutator {
static void mutate(Object obj, String field, Object newValue) {
try {
Field f =…