1 /* |
1 /* |
2 * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 |
26 * @bug 6397298 6400986 6425592 6449798 6453386 6508401 6498938 6911854 8030049 |
27 * @summary Tests that getElementsAnnotatedWith works properly. |
27 * @summary Tests that getElementsAnnotatedWith works properly. |
28 * @author Joseph D. Darcy |
28 * @author Joseph D. Darcy |
29 * @library /tools/javac/lib |
29 * @library /tools/javac/lib |
30 * @build JavacTestingAbstractProcessor |
30 * @build JavacTestingAbstractProcessor |
31 * @compile TestElementsAnnotatedWith.java |
31 * @compile TestElementsAnnotatedWith.java |
35 * @compile -processor TestElementsAnnotatedWith -proc:only BuriedAnnotations.java |
35 * @compile -processor TestElementsAnnotatedWith -proc:only BuriedAnnotations.java |
36 * @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java |
36 * @compile -processor TestElementsAnnotatedWith -proc:only Part1.java Part2.java |
37 * @compile -processor TestElementsAnnotatedWith -proc:only C2.java |
37 * @compile -processor TestElementsAnnotatedWith -proc:only C2.java |
38 * @compile -processor TestElementsAnnotatedWith -proc:only Foo.java |
38 * @compile -processor TestElementsAnnotatedWith -proc:only Foo.java |
39 * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java |
39 * @compile -processor TestElementsAnnotatedWith -proc:only TypeParameterAnnotations.java |
|
40 * @compile/fail/ref=ErroneousAnnotations.out -processor TestElementsAnnotatedWith -proc:only -XDrawDiagnostics ErroneousAnnotations.java |
40 * @compile Foo.java |
41 * @compile Foo.java |
41 * @compile/process -processor TestElementsAnnotatedWith -proc:only Foo |
42 * @compile/process -processor TestElementsAnnotatedWith -proc:only Foo |
42 */ |
43 */ |
43 |
44 |
44 import java.lang.annotation.Annotation; |
45 import java.lang.annotation.Annotation; |
45 import java.io.*; |
|
46 import java.util.Collections; |
46 import java.util.Collections; |
47 import java.util.Set; |
47 import java.util.Set; |
48 import java.util.HashSet; |
48 import java.util.HashSet; |
49 import java.util.List; |
|
50 import java.util.ArrayList; |
|
51 import java.util.Arrays; |
49 import java.util.Arrays; |
52 import javax.annotation.processing.*; |
50 import javax.annotation.processing.*; |
53 import javax.tools.*; |
|
54 import javax.lang.model.SourceVersion; |
|
55 import javax.lang.model.element.*; |
51 import javax.lang.model.element.*; |
56 import javax.lang.model.util.*; |
|
57 import static javax.lang.model.util.ElementFilter.*; |
52 import static javax.lang.model.util.ElementFilter.*; |
58 |
53 |
59 /** |
54 /** |
60 * This processor verifies that the information returned by |
55 * This processor verifies that the information returned by |
61 * getElementsAnnotatedWith is consistent with the expected results |
56 * getElementsAnnotatedWith is consistent with the expected results |