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