title: Which types can be used for Java annotation members?
body: <p>Today I wanted to create my first annotation interface following <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/annotations.html" rel="noreferrer">this documentation</a> and I got this compiler error </p>
  
  <blockquote>
  <pre><code>Invalid type for annotation member":
  public @interface MyAnnotation {
      Object myParameter;
      ^^^^^^
  }
  </code></pre>
  </blockquote>
  
  <p>Obviously <code>Object</code> cannot be used as type of an annotation member. Unfortunately I could not find any information on which types can be used in general.</p>
  
  <p>This I found out using trial-and-error:</p>
  
  <ul>
  <li><code>String</code> → Valid</li>
  <li><code>int</code> → Valid</li>
  <li><code>Integer</code> → Invalid (Surprisingly)</li>
  <li><code>String[]</code> → Valid (Surprisingly)</li>
  <li><code>Object</code> → Invalid</li>
  </ul>
  
  <p>Perhaps someone can shed some light on which types are actually allowed and why.</p>