title: Generate a compiler warning for enum.ordinal
body: <p>Working Java 7+ .... Suppose we create an enum:</p>
  
  <pre><code>enum Foo{ FOO, BAR }
  </code></pre>
  
  <p>then <code>Foo.FOO.ordinal() == 0</code>.  However, if I reorder the enum, say:</p>
  
  <pre><code>enum Foo{ BAR, FOO }
  </code></pre>
  
  <p>then <code>Foo.FOO.ordinal() == 1</code>. This is surprising for most people, as they feel reordering fields is a "safe" operation. No surprise that Java recommends <em>against</em> using <code>enum.ordinal()</code> in most cases.  There are plenty of alternatives, most obviously (and self-documentingly) associating each enum value with an int.</p>
  
  <p>Unfortunately some people in my company did not get the memo and a lot of our old code uses the <code>.ordinal()</code> method all over the place, depending in a fundamental way on the association between the int and the enum value. When I have time, I go through and refactor, but it doesn't prevent new code from using <code>.ordinal()</code>, which introduces potentially untraceable bugs.</p>
  
  <p>So! Suppose I have an enum with a lot of structure associated to it. Can I somehow mark the <code>.ordinal()</code> as <em>unsafe</em>, so that if someone uses (say) <code>Foo.FOO.ordinal()</code> a compiler warning will be generated?</p>
  
  <p>I'm content to use external packages for this purpose but would prefer it if they weren't too obscure.</p>