Change private static final field using Java reflection
I have a class with a private static final field that, unfortunately, I need to change it at run-time. Using reflection I get this error: java.lang.IllegalAccessException: Can not set static final boolean field Is there any way to change the value? Field hack = WarpTransform2D.class.getDeclaredField(“USE_HACK”); hack.setAccessible(true); hack.set(null, true); 14 s 14 Assuming no SecurityManager is … Read more