langtools/test/tools/javac/annotations/repeatingAnnotations/InvalidClsTypeParamTarget.java
author alundblad
Thu, 30 Apr 2015 12:21:50 +0200
changeset 30069 5686d5e44a83
permissions -rw-r--r--
8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter Summary: Additional applicability checks added. Reviewed-by: jlahoda
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30069
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     1
/**
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     2
 * @test    /nodynamiccopyright/
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     3
 * @bug     8044196
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     4
 * @summary Ensure that containers with target FIELD can't be applied to type parameters.
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     5
 * @compile/fail/ref=InvalidClsTypeParamTarget.out -XDrawDiagnostics InvalidClsTypeParamTarget.java
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     6
 */
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     7
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     8
import java.lang.annotation.*;
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
     9
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    10
class InvalidClsTypeParamTarget {
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    11
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    12
    @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE, ElementType.FIELD})
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    13
    @Repeatable(TC.class)
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    14
    @interface T { int value(); }
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    15
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    16
    @Target(ElementType.FIELD)
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    17
    @interface TC { T[] value(); }
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    18
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    19
    class Test<@T(1) @T(2) N> {
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    20
    }
5686d5e44a83 8044196: Incorrect applying of repeatable annotations with incompatible target to type parameter
alundblad
parents:
diff changeset
    21
}