InvalidClsTypeParamTarget.java revision 2900:732890c00534
1/**
2 * @test    /nodynamiccopyright/
3 * @bug     8044196
4 * @summary Ensure that containers with target FIELD can't be applied to type parameters.
5 * @compile/fail/ref=InvalidClsTypeParamTarget.out -XDrawDiagnostics InvalidClsTypeParamTarget.java
6 */
7
8import java.lang.annotation.*;
9
10class InvalidClsTypeParamTarget {
11
12    @Target({ElementType.TYPE_PARAMETER, ElementType.TYPE_USE, ElementType.FIELD})
13    @Repeatable(TC.class)
14    @interface T { int value(); }
15
16    @Target(ElementType.FIELD)
17    @interface TC { T[] value(); }
18
19    class Test<@T(1) @T(2) N> {
20    }
21}
22