title: Annotation attribute must be a class literal? Why? Constants should be fine too
body: <p>Can someone explain why String and Class annotation parameters are expected differently? Why does the compiler require literals for Classes, wherby accepting constants for Strings as well?</p>
  
  <p>Working example with Spring's @RequestMapping:</p>
  
  <pre><code>public class MyController {
      public static final String REQUEST_MAPPING = "/index.html";
      @RequestMapping(MyController.REQUEST_MAPPING) // ALL OK!
      ...
  }
  </code></pre>
  
  <p>WTF example with TestNG's @Test:</p>
  
  <pre><code>public class MyControllerTest {
      public static final Class TEST_EXCEPTION = RuntimeException.class;
      @Test(expectedExceptions = MyControllerTest.TEST_EXCEPTION) // compilation error, WTF:
      // The value for annotation attribute Test.expectedExceptions must be a class literal
      ...
  }
  </code></pre>
  
  <p>What does work of course is @Test(expectedExceptions = RuntimeException.class). But why? The only difference in the annotation parameter I see is its type: String vs Class. Why on earth would the Java compiler accept String constant as well but accept only class literals?</p>