@@ -2,19 +2,30 @@ public class Solo<T extends com.foo.Foo.Bar> {}
2
2
Solo<Integer> val = new Solo<>();
3
3
Duo<Double, Character> dual = new Duo<Double, Character>(12.2585, 'C');
4
4
5
+ List<?> list
6
+ List<? extends Number> nums = ints;
7
+ List<? super Integer> list
8
+ Entry<String, String> pair = Entry.<String>twice("Hello");
9
+
10
+ public class Entry<KeyType, ValueType> {}
11
+ class D <T extends A & B & C> {}
12
+
13
+ public <T extends Throwable> void throwMeConditional(boolean conditional, T exception) throws T {}
14
+
15
+ <T> T instantiateElementType(List<T> arg) {}
16
+
17
+ // not generics
18
+ if (a<6&&b>6){}
19
+
5
20
----------------------------------------------------
6
21
7
22
[
8
23
["keyword", "public"],
9
24
["keyword", "class"],
10
- ["class-name", [
11
- "Solo"
12
- ]],
25
+ ["class-name", ["Solo"]],
13
26
["generics", [
14
27
["punctuation", "<"],
15
- ["class-name", [
16
- "T"
17
- ]],
28
+ ["class-name", ["T"]],
18
29
["keyword", "extends"],
19
30
["class-name", [
20
31
["namespace", [
@@ -32,22 +43,16 @@ Duo<Double, Character> dual = new Duo<Double, Character>(12.2585, 'C');
32
43
["punctuation", "{"],
33
44
["punctuation", "}"],
34
45
35
- ["class-name", [
36
- "Solo"
37
- ]],
46
+ ["class-name", ["Solo"]],
38
47
["generics", [
39
48
["punctuation", "<"],
40
- ["class-name", [
41
- "Integer"
42
- ]],
49
+ ["class-name", ["Integer"]],
43
50
["punctuation", ">"]
44
51
]],
45
52
" val ",
46
53
["operator", "="],
47
54
["keyword", "new"],
48
- ["class-name", [
49
- "Solo"
50
- ]],
55
+ ["class-name", ["Solo"]],
51
56
["generics", [
52
57
["punctuation", "<"],
53
58
["punctuation", ">"]
@@ -56,43 +61,170 @@ Duo<Double, Character> dual = new Duo<Double, Character>(12.2585, 'C');
56
61
["punctuation", ")"],
57
62
["punctuation", ";"],
58
63
59
- ["class-name", [
60
- "Duo"
61
- ]],
64
+ ["class-name", ["Duo"]],
62
65
["generics", [
63
66
["punctuation", "<"],
64
- ["class-name", [
65
- "Double"
66
- ]],
67
+ ["class-name", ["Double"]],
67
68
["punctuation", ","],
68
- ["class-name", [
69
- "Character"
70
- ]],
69
+ ["class-name", ["Character"]],
71
70
["punctuation", ">"]
72
71
]],
73
72
" dual ",
74
73
["operator", "="],
75
74
["keyword", "new"],
76
- ["class-name", [
77
- "Duo"
78
- ]],
75
+ ["class-name", ["Duo"]],
79
76
["generics", [
80
77
["punctuation", "<"],
81
- ["class-name", [
82
- "Double"
83
- ]],
78
+ ["class-name", ["Double"]],
84
79
["punctuation", ","],
85
- ["class-name", [
86
- "Character"
87
- ]],
80
+ ["class-name", ["Character"]],
88
81
["punctuation", ">"]
89
82
]],
90
83
["punctuation", "("],
91
84
["number", "12.2585"],
92
85
["punctuation", ","],
93
86
["string", "'C'"],
94
87
["punctuation", ")"],
95
- ["punctuation", ";"]
88
+ ["punctuation", ";"],
89
+
90
+ ["class-name", ["List"]],
91
+ ["generics", [
92
+ ["punctuation", "<"],
93
+ ["operator", "?"],
94
+ ["punctuation", ">"]
95
+ ]],
96
+ " list\r\n",
97
+
98
+ ["class-name", ["List"]],
99
+ ["generics", [
100
+ ["punctuation", "<"],
101
+ ["operator", "?"],
102
+ ["keyword", "extends"],
103
+ ["class-name", ["Number"]],
104
+ ["punctuation", ">"]
105
+ ]],
106
+ " nums ",
107
+ ["operator", "="],
108
+ " ints",
109
+ ["punctuation", ";"],
110
+
111
+ ["class-name", ["List"]],
112
+ ["generics", [
113
+ ["punctuation", "<"],
114
+ ["operator", "?"],
115
+ ["keyword", "super"],
116
+ ["class-name", ["Integer"]],
117
+ ["punctuation", ">"]
118
+ ]],
119
+ " list\r\n",
120
+
121
+ ["class-name", ["Entry"]],
122
+ ["generics", [
123
+ ["punctuation", "<"],
124
+ ["class-name", ["String"]],
125
+ ["punctuation", ","],
126
+ ["class-name", ["String"]],
127
+ ["punctuation", ">"]
128
+ ]],
129
+ " pair ",
130
+ ["operator", "="],
131
+ ["class-name", ["Entry"]],
132
+ ["punctuation", "."],
133
+ ["generics", [
134
+ ["punctuation", "<"],
135
+ ["class-name", ["String"]],
136
+ ["punctuation", ">"]
137
+ ]],
138
+ ["function", "twice"],
139
+ ["punctuation", "("],
140
+ ["string", "\"Hello\""],
141
+ ["punctuation", ")"],
142
+ ["punctuation", ";"],
143
+
144
+ ["keyword", "public"],
145
+ ["keyword", "class"],
146
+ ["class-name", ["Entry"]],
147
+ ["generics", [
148
+ ["punctuation", "<"],
149
+ ["class-name", ["KeyType"]],
150
+ ["punctuation", ","],
151
+ ["class-name", ["ValueType"]],
152
+ ["punctuation", ">"]
153
+ ]],
154
+ ["punctuation", "{"],
155
+ ["punctuation", "}"],
156
+
157
+ ["keyword", "class"],
158
+ ["class-name", ["D"]],
159
+ ["generics", [
160
+ ["punctuation", "<"],
161
+ ["class-name", ["T"]],
162
+ ["keyword", "extends"],
163
+ ["class-name", ["A"]],
164
+ ["operator", "&"],
165
+ ["class-name", ["B"]],
166
+ ["operator", "&"],
167
+ ["class-name", ["C"]],
168
+ ["punctuation", ">"]
169
+ ]],
170
+ ["punctuation", "{"],
171
+ ["punctuation", "}"],
172
+
173
+ ["keyword", "public"],
174
+ ["generics", [
175
+ ["punctuation", "<"],
176
+ ["class-name", ["T"]],
177
+ ["keyword", "extends"],
178
+ ["class-name", ["Throwable"]],
179
+ ["punctuation", ">"]
180
+ ]],
181
+ ["keyword", "void"],
182
+ ["function", "throwMeConditional"],
183
+ ["punctuation", "("],
184
+ ["keyword", "boolean"],
185
+ " conditional",
186
+ ["punctuation", ","],
187
+ ["class-name", ["T"]],
188
+ " exception",
189
+ ["punctuation", ")"],
190
+ ["keyword", "throws"],
191
+ ["class-name", ["T"]],
192
+ ["punctuation", "{"],
193
+ ["punctuation", "}"],
194
+
195
+ ["generics", [
196
+ ["punctuation", "<"],
197
+ ["class-name", ["T"]],
198
+ ["punctuation", ">"]
199
+ ]],
200
+ ["class-name", ["T"]],
201
+ ["function", "instantiateElementType"],
202
+ ["punctuation", "("],
203
+ ["class-name", ["List"]],
204
+ ["generics", [
205
+ ["punctuation", "<"],
206
+ ["class-name", ["T"]],
207
+ ["punctuation", ">"]
208
+ ]],
209
+ " arg",
210
+ ["punctuation", ")"],
211
+ ["punctuation", "{"],
212
+ ["punctuation", "}"],
213
+
214
+ ["comment", "// not generics"],
215
+
216
+ ["keyword", "if"],
217
+ ["punctuation", "("],
218
+ "a",
219
+ ["operator", "<"],
220
+ ["number", "6"],
221
+ ["operator", "&&"],
222
+ "b",
223
+ ["operator", ">"],
224
+ ["number", "6"],
225
+ ["punctuation", ")"],
226
+ ["punctuation", "{"],
227
+ ["punctuation", "}"]
96
228
]
97
229
98
230
----------------------------------------------------
0 commit comments