1/*
2 * @test /nodynamiccopyright/
3 * @bug 6843077 8006775
4 * @summary test invalid location of TypeUse and TypeParameter
5 * @author Mahmood Ali
6 * @compile/fail/ref=VoidMethod.out -XDrawDiagnostics VoidMethod.java
7 */
8
9import java.lang.annotation.Target;
10import java.lang.annotation.ElementType;
11
12class VoidMethod {
13  // Invalid
14  @A void test1() { }
15  // The following is legal:
16  @B void test2() { }
17  // Invalid
18  @C void test3() { }
19  // The following is legal:
20  @D void test4() { }
21}
22
23@Target(ElementType.TYPE_USE)
24@interface A { }
25
26@Target({ElementType.TYPE_USE, ElementType.METHOD})
27@interface B { }
28
29@Target(ElementType.TYPE_PARAMETER)
30@interface C { }
31
32@Target({ElementType.TYPE_PARAMETER, ElementType.METHOD})
33@interface D { }
34