Wed, 15 Oct 2008 17:23:55 +0100
6759682: APT: compiler message file broken after refactoring of com.sun.tools.javac.util.Message
Summary: JavacMessages should refresh its own bundle cache when a new resource bundle is added by APT
Reviewed-by: jjg
1 /*
2 * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 */
25 /*
26 * @test
27 * @bug 4853450
28 * @summary AnnotationType tests
29 * @library ../../lib
30 * @compile -source 1.5 AnnoTyp.java
31 * @run main/othervm AnnoTyp
32 */
35 import java.util.*;
36 import com.sun.mirror.declaration.*;
37 import com.sun.mirror.type.*;
38 import com.sun.mirror.util.*;
41 public class AnnoTyp extends Tester {
43 public static void main(String[] args) {
44 (new AnnoTyp()).run();
45 }
48 // Declaration used by tests
50 @interface AT {
51 }
54 private AnnotationType at; // an annotation type
56 @AT
57 protected void init() {
58 at = getAnno("init", "AnnoTyp.AT").getAnnotationType();
59 }
62 // TypeMirror methods
64 @Test(result="anno type")
65 Collection<String> accept() {
66 final Collection<String> res = new ArrayList<String>();
68 at.accept(new SimpleTypeVisitor() {
69 public void visitReferenceType(ReferenceType t) {
70 res.add("ref type");
71 }
72 public void visitClassType(ClassType t) {
73 res.add("class");
74 }
75 public void visitInterfaceType(InterfaceType t) {
76 res.add("interface");
77 }
78 public void visitAnnotationType(AnnotationType t) {
79 res.add("anno type");
80 }
81 });
82 return res;
83 }
86 // AnnotationType method
88 @Test(result="AnnoTyp.AT")
89 AnnotationTypeDeclaration getDeclaration() {
90 return at.getDeclaration();
91 }
92 }