Wed, 21 Aug 2013 16:13:50 -0700
8023515: import type-annotations updates
Reviewed-by: jjg
Contributed-by: wdietl@gmail.com
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 */
9 import java.lang.annotation.Target;
10 import java.lang.annotation.ElementType;
12 class 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 }
23 @Target(ElementType.TYPE_USE)
24 @interface A { }
26 @Target({ElementType.TYPE_USE, ElementType.METHOD})
27 @interface B { }
29 @Target(ElementType.TYPE_PARAMETER)
30 @interface C { }
32 @Target({ElementType.TYPE_PARAMETER, ElementType.METHOD})
33 @interface D { }