title: Cannot change static final field using java reflection?
body: <p>I recently stumbled upon <a href="https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection">Change private static final field using Java reflection</a> and tested polygenelubricants' <code>EverythingIsTrue</code> class, works fine, <code>System.out.format("Everything is %s", false);</code> prints <code>Everything is true</code> indeed. But when I change the code as </p>
  
  <pre><code>public class EverythingIsTrue {
  
      public static final boolean FALSE = false;
  
      static void setFinalStatic(Field field, Object newValue) throws Exception {
          field.setAccessible(true);
          Field modifiersField = Field.class.getDeclaredField("modifiers");
          modifiersField.setAccessible(true);
          modifiersField.setInt(field, field.getModifiers() &amp; ~Modifier.FINAL);
          field.set(null, newValue);
      }
  
      public static void main(String[] args) throws Exception {
          setFinalStatic(EverythingIsTrue.class.getField("FALSE"), true);
          System.out.format("Everything is %s", FALSE);
      }
  }
  </code></pre>
  
  <p>it prints</p>
  
  <pre class="lang-none prettyprint-override"><code>Everything is false
  </code></pre>
  
  <p>Does anybody know why? Does setFinalStatic actually work or not?</p>