author | xdono |
Mon, 15 Dec 2008 16:55:33 -0800 | |
changeset 1652 | 1324f96f3883 |
parent 1467 | 290837884931 |
child 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
1652 | 2 |
* Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved. |
10 | 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 |
*/ |
|
23 |
||
24 |
||
25 |
/* |
|
26 |
* @test |
|
27 |
* @bug 4853450 |
|
28 |
* @summary PrimitiveType tests |
|
29 |
* @library ../../lib |
|
30 |
* @compile -source 1.5 PrimitiveTyp.java |
|
1467
290837884931
6749967: regression tests for apt should be same-vm friendly
jjg
parents:
10
diff
changeset
|
31 |
* @run main/othervm PrimitiveTyp |
10 | 32 |
*/ |
33 |
||
34 |
||
35 |
import java.util.*; |
|
36 |
import com.sun.mirror.declaration.*; |
|
37 |
import com.sun.mirror.type.*; |
|
38 |
import com.sun.mirror.util.*; |
|
39 |
||
40 |
||
41 |
public class PrimitiveTyp extends Tester { |
|
42 |
||
43 |
public static void main(String[] args) { |
|
44 |
(new PrimitiveTyp()).run(); |
|
45 |
} |
|
46 |
||
47 |
||
48 |
// Declaration used by tests |
|
49 |
||
50 |
private boolean b; |
|
51 |
||
52 |
||
53 |
private PrimitiveType prim; // a primitive type |
|
54 |
||
55 |
protected void init() { |
|
56 |
prim = (PrimitiveType) getField("b").getType(); |
|
57 |
} |
|
58 |
||
59 |
||
60 |
// TypeMirror methods |
|
61 |
||
62 |
@Test(result="primitive") |
|
63 |
Collection<String> accept() { |
|
64 |
final Collection<String> res = new ArrayList<String>(); |
|
65 |
||
66 |
prim.accept(new SimpleTypeVisitor() { |
|
67 |
public void visitTypeMirror(TypeMirror t) { |
|
68 |
res.add("type"); |
|
69 |
} |
|
70 |
public void visitPrimitiveType(PrimitiveType t) { |
|
71 |
res.add("primitive"); |
|
72 |
} |
|
73 |
public void visitReferenceType(ReferenceType t) { |
|
74 |
res.add("ref type"); |
|
75 |
} |
|
76 |
}); |
|
77 |
return res; |
|
78 |
} |
|
79 |
||
80 |
@Test(result="boolean") |
|
81 |
String toStringTest() { |
|
82 |
return prim.toString(); |
|
83 |
} |
|
84 |
||
85 |
||
86 |
// PrimitiveType method |
|
87 |
||
88 |
@Test(result="BOOLEAN") |
|
89 |
PrimitiveType.Kind getKind() { |
|
90 |
return prim.getKind(); |
|
91 |
} |
|
92 |
} |