package com.redhat.ceylon.compiler.java.metadata;

import java.lang.annotation.Annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** 
 * Annotates an annotation constructor method
 * (i.e. adjacent to {@link Method @Method}) 
 * as being a trivial instantiation of an annotation class. 
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
public @interface AnnotationInstantiation {
    /** 
     * The annotation class (not the annotation type for that class) 
     * that the annotation constructor instantiates 
     */
    // TODO This might not be needed
    java.lang.Class<?> annotationClass();
    
    // TODO Can also support a constructor which returns a value using some 
    // other annotation @AnnotationValue
    /** 
     * <p>A permutation of the annotation constructor parameters which produces the 
     * argument list for the instantiation of the annotation class.</p>
     * <table><tbody>
     * <tr><td>-32768</td>  <td>int, char, boolean, float or String literal</td></tr>
     * <tr><td>0-255</td>   <td>the corresponding parameter</td></tr>
     * <tr><td>256-511</td> <td>the corresponding parameter spread</td></tr>
     * </tbody></table>
     */
    short[] arguments() default {};
}

@@ -350,40 +350,45 @@
 %0A * 
-as being a trivial instantiation
+or the default parameter value method
  of 
@@ -402,21 +402,33 @@
 tation c
-lass.
+onstructor method
  %0A */%0A@R
@@ -577,29 +577,21 @@
 The 
-annotation
+Java
  class 
-(not
+of
  the
@@ -606,29 +606,39 @@
 ion 
-type for that class) 
+class or annotation constructor
 %0A   
@@ -679,19 +679,13 @@
 r in
-stantiat
+vok
 es
- 
 %0A   
@@ -697,205 +697,42 @@
     
-// TODO This might not be needed%0A    java.lang.Class%3C?%3E annotationClass();%0A    %0A    // TODO Can also support a constructor which returns a value using some %0A    // other annotation @AnnotationValue
+java.lang.Class%3C?%3E primary();%0A    
 %0A   
@@ -994,32 +994,261 @@
 teral%3C/td%3E%3C/tr%3E%0A
+     * %3Ctr%3E%3Ctd%3E-32767 - -1%3C/td%3E  %3Ctd%3EWhen used as an element of %0A     *  %7B@code @AnnotationInstantiationTree%7D, this points to another element of the %0A     *  tree, which is the invocation whose result is this argument.%3C/td%3E%3C/tr%3E%0A
      * %3Ctr%3E%3Ctd%3E0

Rename @AnnotationInstantiation.annotationClass() -> primary() since it is now used for annotation _constructors_ in some circumstances. See ceylon/ceylon-compiler#1221.