private void setFinalStatic(Field field, Object val) throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
field.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(field, field.getModifiers() &~Modifier.FINAL);
field.set(null, val);
}