author | jlahoda |
Wed, 02 Oct 2019 10:59:40 +0200 | |
branch | JDK-8226585-branch |
changeset 58440 | 4c8a6d1d066c |
parent 58109 | ee07de0d2c16 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
55306 | 2 |
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.source.util; |
|
27 |
||
28 |
import com.sun.source.tree.*; |
|
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
29 |
import com.sun.source.tree.CaseTree.CaseKind; |
10 | 30 |
|
31 |
/** |
|
32 |
* A TreeVisitor that visits all the child tree nodes. |
|
33 |
* To visit nodes of a particular type, just override the |
|
34 |
* corresponding visitXYZ method. |
|
35 |
* Inside your method, call super.visitXYZ to visit descendant |
|
36 |
* nodes. |
|
37 |
* |
|
38 |
* <p>The default implementation of the visitXYZ methods will determine |
|
39 |
* a result as follows: |
|
40 |
* <ul> |
|
25287 | 41 |
* <li>If the node being visited has no children, the result will be {@code null}. |
10 | 42 |
* <li>If the node being visited has one child, the result will be the |
43 |
* result of calling {@code scan} on that child. The child may be a simple node |
|
44 |
* or itself a list of nodes. |
|
45 |
* <li> If the node being visited has more than one child, the result will |
|
46 |
* be determined by calling {@code scan} each child in turn, and then combining the |
|
47 |
* result of each scan after the first with the cumulative result |
|
48 |
* so far, as determined by the {@link #reduce} method. Each child may be either |
|
49 |
* a simple node of a list of nodes. The default behavior of the {@code reduce} |
|
50 |
* method is such that the result of the visitXYZ method will be the result of |
|
51 |
* the last child scanned. |
|
52 |
* </ul> |
|
53 |
* |
|
54 |
* <p>Here is an example to count the number of identifier nodes in a tree: |
|
55 |
* <pre> |
|
13844 | 56 |
* class CountIdentifiers extends TreeScanner<Integer,Void> { |
10 | 57 |
* {@literal @}Override |
58 |
* public Integer visitIdentifier(IdentifierTree node, Void p) { |
|
59 |
* return 1; |
|
60 |
* } |
|
61 |
* {@literal @}Override |
|
62 |
* public Integer reduce(Integer r1, Integer r2) { |
|
63 |
* return (r1 == null ? 0 : r1) + (r2 == null ? 0 : r2); |
|
64 |
* } |
|
65 |
* } |
|
66 |
* </pre> |
|
67 |
* |
|
25287 | 68 |
* @param <R> the return type of this visitor's methods. Use {@link |
69 |
* Void} for visitors that do not need to return results. |
|
70 |
* @param <P> the type of the additional parameter to this visitor's |
|
71 |
* methods. Use {@code Void} for visitors that do not need an |
|
72 |
* additional parameter. |
|
73 |
* |
|
10 | 74 |
* @author Peter von der Ahé |
75 |
* @author Jonathan Gibbons |
|
76 |
* @since 1.6 |
|
77 |
*/ |
|
78 |
public class TreeScanner<R,P> implements TreeVisitor<R,P> { |
|
79 |
||
25287 | 80 |
/** |
81 |
* Scans a single node. |
|
82 |
* @param tree the node to be scanned |
|
83 |
* @param p a parameter value passed to the visit method |
|
84 |
* @return the result value from the visit method |
|
10 | 85 |
*/ |
25287 | 86 |
public R scan(Tree tree, P p) { |
87 |
return (tree == null) ? null : tree.accept(this, p); |
|
10 | 88 |
} |
89 |
||
90 |
private R scanAndReduce(Tree node, P p, R r) { |
|
91 |
return reduce(scan(node, p), r); |
|
92 |
} |
|
93 |
||
25287 | 94 |
/** |
95 |
* Scans a sequence of nodes. |
|
96 |
* @param nodes the nodes to be scanned |
|
97 |
* @param p a parameter value to be passed to the visit method for each node |
|
98 |
* @return the combined return value from the visit methods. |
|
99 |
* The values are combined using the {@link #reduce reduce} method. |
|
10 | 100 |
*/ |
101 |
public R scan(Iterable<? extends Tree> nodes, P p) { |
|
102 |
R r = null; |
|
103 |
if (nodes != null) { |
|
104 |
boolean first = true; |
|
105 |
for (Tree node : nodes) { |
|
106 |
r = (first ? scan(node, p) : scanAndReduce(node, p, r)); |
|
107 |
first = false; |
|
108 |
} |
|
109 |
} |
|
110 |
return r; |
|
111 |
} |
|
112 |
||
113 |
private R scanAndReduce(Iterable<? extends Tree> nodes, P p, R r) { |
|
114 |
return reduce(scan(nodes, p), r); |
|
115 |
} |
|
116 |
||
117 |
/** |
|
118 |
* Reduces two results into a combined result. |
|
119 |
* The default implementation is to return the first parameter. |
|
120 |
* The general contract of the method is that it may take any action whatsoever. |
|
25287 | 121 |
* @param r1 the first of the values to be combined |
122 |
* @param r2 the second of the values to be combined |
|
123 |
* @return the result of combining the two parameters |
|
10 | 124 |
*/ |
125 |
public R reduce(R r1, R r2) { |
|
126 |
return r1; |
|
127 |
} |
|
128 |
||
129 |
||
130 |
/* *************************************************************************** |
|
131 |
* Visitor methods |
|
132 |
****************************************************************************/ |
|
133 |
||
25287 | 134 |
/** |
135 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
136 |
* |
|
137 |
* @param node {@inheritDoc} |
|
138 |
* @param p {@inheritDoc} |
|
139 |
* @return the result of scanning |
|
140 |
*/ |
|
141 |
@Override |
|
10 | 142 |
public R visitCompilationUnit(CompilationUnitTree node, P p) { |
24069 | 143 |
R r = scan(node.getPackage(), p); |
10 | 144 |
r = scanAndReduce(node.getImports(), p, r); |
145 |
r = scanAndReduce(node.getTypeDecls(), p, r); |
|
146 |
return r; |
|
147 |
} |
|
148 |
||
25287 | 149 |
/** |
150 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
151 |
* |
|
152 |
* @param node {@inheritDoc} |
|
153 |
* @param p {@inheritDoc} |
|
154 |
* @return the result of scanning |
|
155 |
*/ |
|
156 |
@Override |
|
24069 | 157 |
public R visitPackage(PackageTree node, P p) { |
158 |
R r = scan(node.getAnnotations(), p); |
|
159 |
r = scanAndReduce(node.getPackageName(), p, r); |
|
160 |
return r; |
|
161 |
} |
|
162 |
||
25287 | 163 |
/** |
164 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
165 |
* |
|
166 |
* @param node {@inheritDoc} |
|
167 |
* @param p {@inheritDoc} |
|
168 |
* @return the result of scanning |
|
169 |
*/ |
|
170 |
@Override |
|
10 | 171 |
public R visitImport(ImportTree node, P p) { |
172 |
return scan(node.getQualifiedIdentifier(), p); |
|
173 |
} |
|
174 |
||
25287 | 175 |
/** |
176 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
177 |
* |
|
178 |
* @param node {@inheritDoc} |
|
179 |
* @param p {@inheritDoc} |
|
180 |
* @return the result of scanning |
|
181 |
*/ |
|
182 |
@Override |
|
10 | 183 |
public R visitClass(ClassTree node, P p) { |
184 |
R r = scan(node.getModifiers(), p); |
|
185 |
r = scanAndReduce(node.getTypeParameters(), p, r); |
|
186 |
r = scanAndReduce(node.getExtendsClause(), p, r); |
|
187 |
r = scanAndReduce(node.getImplementsClause(), p, r); |
|
188 |
r = scanAndReduce(node.getMembers(), p, r); |
|
189 |
return r; |
|
190 |
} |
|
191 |
||
25287 | 192 |
/** |
193 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
194 |
* |
|
195 |
* @param node {@inheritDoc} |
|
196 |
* @param p {@inheritDoc} |
|
197 |
* @return the result of scanning |
|
198 |
*/ |
|
199 |
@Override |
|
10 | 200 |
public R visitMethod(MethodTree node, P p) { |
201 |
R r = scan(node.getModifiers(), p); |
|
202 |
r = scanAndReduce(node.getReturnType(), p, r); |
|
203 |
r = scanAndReduce(node.getTypeParameters(), p, r); |
|
204 |
r = scanAndReduce(node.getParameters(), p, r); |
|
15385 | 205 |
r = scanAndReduce(node.getReceiverParameter(), p, r); |
10 | 206 |
r = scanAndReduce(node.getThrows(), p, r); |
207 |
r = scanAndReduce(node.getBody(), p, r); |
|
6597
9367c22c445f
6983239: TreeScanner does not scan default value for method
jjg
parents:
6148
diff
changeset
|
208 |
r = scanAndReduce(node.getDefaultValue(), p, r); |
10 | 209 |
return r; |
210 |
} |
|
211 |
||
25287 | 212 |
/** |
213 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
214 |
* |
|
215 |
* @param node {@inheritDoc} |
|
216 |
* @param p {@inheritDoc} |
|
217 |
* @return the result of scanning |
|
218 |
*/ |
|
219 |
@Override |
|
10 | 220 |
public R visitVariable(VariableTree node, P p) { |
221 |
R r = scan(node.getModifiers(), p); |
|
222 |
r = scanAndReduce(node.getType(), p, r); |
|
17580 | 223 |
r = scanAndReduce(node.getNameExpression(), p, r); |
10 | 224 |
r = scanAndReduce(node.getInitializer(), p, r); |
225 |
return r; |
|
226 |
} |
|
227 |
||
25287 | 228 |
/** |
229 |
* {@inheritDoc} This implementation returns {@code null}. |
|
230 |
* |
|
231 |
* @param node {@inheritDoc} |
|
232 |
* @param p {@inheritDoc} |
|
233 |
* @return the result of scanning |
|
234 |
*/ |
|
235 |
@Override |
|
10 | 236 |
public R visitEmptyStatement(EmptyStatementTree node, P p) { |
237 |
return null; |
|
238 |
} |
|
239 |
||
25287 | 240 |
/** |
241 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
242 |
* |
|
243 |
* @param node {@inheritDoc} |
|
244 |
* @param p {@inheritDoc} |
|
245 |
* @return the result of scanning |
|
246 |
*/ |
|
247 |
@Override |
|
10 | 248 |
public R visitBlock(BlockTree node, P p) { |
249 |
return scan(node.getStatements(), p); |
|
250 |
} |
|
251 |
||
25287 | 252 |
/** |
253 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
254 |
* |
|
255 |
* @param node {@inheritDoc} |
|
256 |
* @param p {@inheritDoc} |
|
257 |
* @return the result of scanning |
|
258 |
*/ |
|
259 |
@Override |
|
10 | 260 |
public R visitDoWhileLoop(DoWhileLoopTree node, P p) { |
261 |
R r = scan(node.getStatement(), p); |
|
262 |
r = scanAndReduce(node.getCondition(), p, r); |
|
263 |
return r; |
|
264 |
} |
|
265 |
||
25287 | 266 |
/** |
267 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
268 |
* |
|
269 |
* @param node {@inheritDoc} |
|
270 |
* @param p {@inheritDoc} |
|
271 |
* @return the result of scanning |
|
272 |
*/ |
|
273 |
@Override |
|
10 | 274 |
public R visitWhileLoop(WhileLoopTree node, P p) { |
275 |
R r = scan(node.getCondition(), p); |
|
276 |
r = scanAndReduce(node.getStatement(), p, r); |
|
277 |
return r; |
|
278 |
} |
|
279 |
||
25287 | 280 |
/** |
281 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
282 |
* |
|
283 |
* @param node {@inheritDoc} |
|
284 |
* @param p {@inheritDoc} |
|
285 |
* @return the result of scanning |
|
286 |
*/ |
|
287 |
@Override |
|
10 | 288 |
public R visitForLoop(ForLoopTree node, P p) { |
289 |
R r = scan(node.getInitializer(), p); |
|
290 |
r = scanAndReduce(node.getCondition(), p, r); |
|
291 |
r = scanAndReduce(node.getUpdate(), p, r); |
|
292 |
r = scanAndReduce(node.getStatement(), p, r); |
|
293 |
return r; |
|
294 |
} |
|
295 |
||
25287 | 296 |
/** |
297 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
298 |
* |
|
299 |
* @param node {@inheritDoc} |
|
300 |
* @param p {@inheritDoc} |
|
301 |
* @return the result of scanning |
|
302 |
*/ |
|
303 |
@Override |
|
10 | 304 |
public R visitEnhancedForLoop(EnhancedForLoopTree node, P p) { |
305 |
R r = scan(node.getVariable(), p); |
|
306 |
r = scanAndReduce(node.getExpression(), p, r); |
|
307 |
r = scanAndReduce(node.getStatement(), p, r); |
|
308 |
return r; |
|
309 |
} |
|
310 |
||
25287 | 311 |
/** |
312 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
313 |
* |
|
314 |
* @param node {@inheritDoc} |
|
315 |
* @param p {@inheritDoc} |
|
316 |
* @return the result of scanning |
|
317 |
*/ |
|
318 |
@Override |
|
10 | 319 |
public R visitLabeledStatement(LabeledStatementTree node, P p) { |
320 |
return scan(node.getStatement(), p); |
|
321 |
} |
|
322 |
||
25287 | 323 |
/** |
324 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
325 |
* |
|
326 |
* @param node {@inheritDoc} |
|
327 |
* @param p {@inheritDoc} |
|
328 |
* @return the result of scanning |
|
329 |
*/ |
|
330 |
@Override |
|
10 | 331 |
public R visitSwitch(SwitchTree node, P p) { |
332 |
R r = scan(node.getExpression(), p); |
|
333 |
r = scanAndReduce(node.getCases(), p, r); |
|
334 |
return r; |
|
335 |
} |
|
336 |
||
25287 | 337 |
/** |
58440
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
338 |
* {@preview Associated with switch expressions, a preview feature of |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
339 |
* the Java language. |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
340 |
* |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
341 |
* This method is associated with <i>switch expressions</i>, a preview |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
342 |
* feature of the Java language. Preview features |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
343 |
* may be removed in a future release, or upgraded to permanent |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
344 |
* features of the Java language.} |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
345 |
* |
25287 | 346 |
* {@inheritDoc} This implementation scans the children in left to right order. |
347 |
* |
|
348 |
* @param node {@inheritDoc} |
|
349 |
* @param p {@inheritDoc} |
|
350 |
* @return the result of scanning |
|
351 |
*/ |
|
352 |
@Override |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
55306
diff
changeset
|
353 |
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
55306
diff
changeset
|
354 |
@SuppressWarnings("preview") |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
355 |
public R visitSwitchExpression(SwitchExpressionTree node, P p) { |
10 | 356 |
R r = scan(node.getExpression(), p); |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
357 |
r = scanAndReduce(node.getCases(), p, r); |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
358 |
return r; |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
359 |
} |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
360 |
|
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
361 |
/** |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
362 |
* {@inheritDoc} This implementation scans the children in left to right order. |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
363 |
* |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
364 |
* @param node {@inheritDoc} |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
365 |
* @param p {@inheritDoc} |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
366 |
* @return the result of scanning |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
367 |
*/ |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
368 |
@Override |
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
55306
diff
changeset
|
369 |
@SuppressWarnings("preview") |
51563
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
370 |
public R visitCase(CaseTree node, P p) { |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
371 |
R r = scan(node.getExpressions(), p); |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
372 |
if (node.getCaseKind() == CaseKind.RULE) |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
373 |
r = scanAndReduce(node.getBody(), p, r); |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
374 |
else |
de411d537aae
8206986: Compiler support for Switch Expressions (Preview)
jlahoda
parents:
47216
diff
changeset
|
375 |
r = scanAndReduce(node.getStatements(), p, r); |
10 | 376 |
return r; |
377 |
} |
|
378 |
||
25287 | 379 |
/** |
380 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
381 |
* |
|
382 |
* @param node {@inheritDoc} |
|
383 |
* @param p {@inheritDoc} |
|
384 |
* @return the result of scanning |
|
385 |
*/ |
|
386 |
@Override |
|
10 | 387 |
public R visitSynchronized(SynchronizedTree node, P p) { |
388 |
R r = scan(node.getExpression(), p); |
|
389 |
r = scanAndReduce(node.getBlock(), p, r); |
|
390 |
return r; |
|
391 |
} |
|
392 |
||
25287 | 393 |
/** |
394 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
395 |
* |
|
396 |
* @param node {@inheritDoc} |
|
397 |
* @param p {@inheritDoc} |
|
398 |
* @return the result of scanning |
|
399 |
*/ |
|
400 |
@Override |
|
10 | 401 |
public R visitTry(TryTree node, P p) { |
6148
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5520
diff
changeset
|
402 |
R r = scan(node.getResources(), p); |
3a8158299c51
6911256: Project Coin: Support Automatic Resource Management (ARM) blocks in the compiler
darcy
parents:
5520
diff
changeset
|
403 |
r = scanAndReduce(node.getBlock(), p, r); |
10 | 404 |
r = scanAndReduce(node.getCatches(), p, r); |
405 |
r = scanAndReduce(node.getFinallyBlock(), p, r); |
|
406 |
return r; |
|
407 |
} |
|
408 |
||
25287 | 409 |
/** |
410 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
411 |
* |
|
412 |
* @param node {@inheritDoc} |
|
413 |
* @param p {@inheritDoc} |
|
414 |
* @return the result of scanning |
|
415 |
*/ |
|
416 |
@Override |
|
10 | 417 |
public R visitCatch(CatchTree node, P p) { |
418 |
R r = scan(node.getParameter(), p); |
|
419 |
r = scanAndReduce(node.getBlock(), p, r); |
|
420 |
return r; |
|
421 |
} |
|
422 |
||
25287 | 423 |
/** |
424 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
425 |
* |
|
426 |
* @param node {@inheritDoc} |
|
427 |
* @param p {@inheritDoc} |
|
428 |
* @return the result of scanning |
|
429 |
*/ |
|
430 |
@Override |
|
10 | 431 |
public R visitConditionalExpression(ConditionalExpressionTree node, P p) { |
432 |
R r = scan(node.getCondition(), p); |
|
433 |
r = scanAndReduce(node.getTrueExpression(), p, r); |
|
434 |
r = scanAndReduce(node.getFalseExpression(), p, r); |
|
435 |
return r; |
|
436 |
} |
|
437 |
||
25287 | 438 |
/** |
439 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
440 |
* |
|
441 |
* @param node {@inheritDoc} |
|
442 |
* @param p {@inheritDoc} |
|
443 |
* @return the result of scanning |
|
444 |
*/ |
|
445 |
@Override |
|
10 | 446 |
public R visitIf(IfTree node, P p) { |
447 |
R r = scan(node.getCondition(), p); |
|
448 |
r = scanAndReduce(node.getThenStatement(), p, r); |
|
449 |
r = scanAndReduce(node.getElseStatement(), p, r); |
|
450 |
return r; |
|
451 |
} |
|
452 |
||
25287 | 453 |
/** |
454 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
455 |
* |
|
456 |
* @param node {@inheritDoc} |
|
457 |
* @param p {@inheritDoc} |
|
458 |
* @return the result of scanning |
|
459 |
*/ |
|
460 |
@Override |
|
10 | 461 |
public R visitExpressionStatement(ExpressionStatementTree node, P p) { |
462 |
return scan(node.getExpression(), p); |
|
463 |
} |
|
464 |
||
25287 | 465 |
/** |
466 |
* {@inheritDoc} This implementation returns {@code null}. |
|
467 |
* |
|
468 |
* @param node {@inheritDoc} |
|
469 |
* @param p {@inheritDoc} |
|
470 |
* @return the result of scanning |
|
471 |
*/ |
|
472 |
@Override |
|
10 | 473 |
public R visitBreak(BreakTree node, P p) { |
55306 | 474 |
return null; |
10 | 475 |
} |
476 |
||
25287 | 477 |
/** |
478 |
* {@inheritDoc} This implementation returns {@code null}. |
|
479 |
* |
|
480 |
* @param node {@inheritDoc} |
|
481 |
* @param p {@inheritDoc} |
|
482 |
* @return the result of scanning |
|
483 |
*/ |
|
484 |
@Override |
|
10 | 485 |
public R visitContinue(ContinueTree node, P p) { |
486 |
return null; |
|
487 |
} |
|
488 |
||
25287 | 489 |
/** |
490 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
491 |
* |
|
492 |
* @param node {@inheritDoc} |
|
493 |
* @param p {@inheritDoc} |
|
494 |
* @return the result of scanning |
|
495 |
*/ |
|
496 |
@Override |
|
10 | 497 |
public R visitReturn(ReturnTree node, P p) { |
498 |
return scan(node.getExpression(), p); |
|
499 |
} |
|
500 |
||
25287 | 501 |
/** |
502 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
503 |
* |
|
504 |
* @param node {@inheritDoc} |
|
505 |
* @param p {@inheritDoc} |
|
506 |
* @return the result of scanning |
|
507 |
*/ |
|
508 |
@Override |
|
10 | 509 |
public R visitThrow(ThrowTree node, P p) { |
510 |
return scan(node.getExpression(), p); |
|
511 |
} |
|
512 |
||
25287 | 513 |
/** |
514 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
515 |
* |
|
516 |
* @param node {@inheritDoc} |
|
517 |
* @param p {@inheritDoc} |
|
518 |
* @return the result of scanning |
|
519 |
*/ |
|
520 |
@Override |
|
10 | 521 |
public R visitAssert(AssertTree node, P p) { |
522 |
R r = scan(node.getCondition(), p); |
|
523 |
r = scanAndReduce(node.getDetail(), p, r); |
|
524 |
return r; |
|
525 |
} |
|
526 |
||
25287 | 527 |
/** |
528 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
529 |
* |
|
530 |
* @param node {@inheritDoc} |
|
531 |
* @param p {@inheritDoc} |
|
532 |
* @return the result of scanning |
|
533 |
*/ |
|
534 |
@Override |
|
10 | 535 |
public R visitMethodInvocation(MethodInvocationTree node, P p) { |
536 |
R r = scan(node.getTypeArguments(), p); |
|
537 |
r = scanAndReduce(node.getMethodSelect(), p, r); |
|
538 |
r = scanAndReduce(node.getArguments(), p, r); |
|
539 |
return r; |
|
540 |
} |
|
541 |
||
25287 | 542 |
/** |
543 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
544 |
* |
|
545 |
* @param node {@inheritDoc} |
|
546 |
* @param p {@inheritDoc} |
|
547 |
* @return the result of scanning |
|
548 |
*/ |
|
549 |
@Override |
|
10 | 550 |
public R visitNewClass(NewClassTree node, P p) { |
551 |
R r = scan(node.getEnclosingExpression(), p); |
|
552 |
r = scanAndReduce(node.getIdentifier(), p, r); |
|
553 |
r = scanAndReduce(node.getTypeArguments(), p, r); |
|
554 |
r = scanAndReduce(node.getArguments(), p, r); |
|
555 |
r = scanAndReduce(node.getClassBody(), p, r); |
|
556 |
return r; |
|
557 |
} |
|
558 |
||
25287 | 559 |
/** |
560 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
561 |
* |
|
562 |
* @param node {@inheritDoc} |
|
563 |
* @param p {@inheritDoc} |
|
564 |
* @return the result of scanning |
|
565 |
*/ |
|
566 |
@Override |
|
10 | 567 |
public R visitNewArray(NewArrayTree node, P p) { |
568 |
R r = scan(node.getType(), p); |
|
569 |
r = scanAndReduce(node.getDimensions(), p, r); |
|
570 |
r = scanAndReduce(node.getInitializers(), p, r); |
|
19491 | 571 |
r = scanAndReduce(node.getAnnotations(), p, r); |
572 |
for (Iterable< ? extends Tree> dimAnno : node.getDimAnnotations()) { |
|
573 |
r = scanAndReduce(dimAnno, p, r); |
|
574 |
} |
|
10 | 575 |
return r; |
576 |
} |
|
577 |
||
25287 | 578 |
/** |
579 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
580 |
* |
|
581 |
* @param node {@inheritDoc} |
|
582 |
* @param p {@inheritDoc} |
|
583 |
* @return the result of scanning |
|
584 |
*/ |
|
585 |
@Override |
|
11141 | 586 |
public R visitLambdaExpression(LambdaExpressionTree node, P p) { |
587 |
R r = scan(node.getParameters(), p); |
|
588 |
r = scanAndReduce(node.getBody(), p, r); |
|
589 |
return r; |
|
590 |
} |
|
591 |
||
25287 | 592 |
/** |
593 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
594 |
* |
|
595 |
* @param node {@inheritDoc} |
|
596 |
* @param p {@inheritDoc} |
|
597 |
* @return the result of scanning |
|
598 |
*/ |
|
599 |
@Override |
|
10 | 600 |
public R visitParenthesized(ParenthesizedTree node, P p) { |
601 |
return scan(node.getExpression(), p); |
|
602 |
} |
|
603 |
||
25287 | 604 |
/** |
605 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
606 |
* |
|
607 |
* @param node {@inheritDoc} |
|
608 |
* @param p {@inheritDoc} |
|
609 |
* @return the result of scanning |
|
610 |
*/ |
|
611 |
@Override |
|
10 | 612 |
public R visitAssignment(AssignmentTree node, P p) { |
613 |
R r = scan(node.getVariable(), p); |
|
614 |
r = scanAndReduce(node.getExpression(), p, r); |
|
615 |
return r; |
|
616 |
} |
|
617 |
||
25287 | 618 |
/** |
619 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
620 |
* |
|
621 |
* @param node {@inheritDoc} |
|
622 |
* @param p {@inheritDoc} |
|
623 |
* @return the result of scanning |
|
624 |
*/ |
|
625 |
@Override |
|
10 | 626 |
public R visitCompoundAssignment(CompoundAssignmentTree node, P p) { |
627 |
R r = scan(node.getVariable(), p); |
|
628 |
r = scanAndReduce(node.getExpression(), p, r); |
|
629 |
return r; |
|
630 |
} |
|
631 |
||
25287 | 632 |
/** |
633 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
634 |
* |
|
635 |
* @param node {@inheritDoc} |
|
636 |
* @param p {@inheritDoc} |
|
637 |
* @return the result of scanning |
|
638 |
*/ |
|
639 |
@Override |
|
10 | 640 |
public R visitUnary(UnaryTree node, P p) { |
641 |
return scan(node.getExpression(), p); |
|
642 |
} |
|
643 |
||
25287 | 644 |
/** |
645 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
646 |
* |
|
647 |
* @param node {@inheritDoc} |
|
648 |
* @param p {@inheritDoc} |
|
649 |
* @return the result of scanning |
|
650 |
*/ |
|
651 |
@Override |
|
10 | 652 |
public R visitBinary(BinaryTree node, P p) { |
653 |
R r = scan(node.getLeftOperand(), p); |
|
654 |
r = scanAndReduce(node.getRightOperand(), p, r); |
|
655 |
return r; |
|
656 |
} |
|
657 |
||
25287 | 658 |
/** |
659 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
660 |
* |
|
661 |
* @param node {@inheritDoc} |
|
662 |
* @param p {@inheritDoc} |
|
663 |
* @return the result of scanning |
|
664 |
*/ |
|
665 |
@Override |
|
10 | 666 |
public R visitTypeCast(TypeCastTree node, P p) { |
667 |
R r = scan(node.getType(), p); |
|
668 |
r = scanAndReduce(node.getExpression(), p, r); |
|
669 |
return r; |
|
670 |
} |
|
671 |
||
25287 | 672 |
/** |
673 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
674 |
* |
|
675 |
* @param node {@inheritDoc} |
|
676 |
* @param p {@inheritDoc} |
|
677 |
* @return the result of scanning |
|
678 |
*/ |
|
679 |
@Override |
|
10 | 680 |
public R visitInstanceOf(InstanceOfTree node, P p) { |
681 |
R r = scan(node.getExpression(), p); |
|
682 |
r = scanAndReduce(node.getType(), p, r); |
|
683 |
return r; |
|
684 |
} |
|
685 |
||
25287 | 686 |
/** |
687 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
688 |
* |
|
689 |
* @param node {@inheritDoc} |
|
690 |
* @param p {@inheritDoc} |
|
691 |
* @return the result of scanning |
|
692 |
*/ |
|
693 |
@Override |
|
10 | 694 |
public R visitArrayAccess(ArrayAccessTree node, P p) { |
695 |
R r = scan(node.getExpression(), p); |
|
696 |
r = scanAndReduce(node.getIndex(), p, r); |
|
697 |
return r; |
|
698 |
} |
|
699 |
||
25287 | 700 |
/** |
701 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
702 |
* |
|
703 |
* @param node {@inheritDoc} |
|
704 |
* @param p {@inheritDoc} |
|
705 |
* @return the result of scanning |
|
706 |
*/ |
|
707 |
@Override |
|
10 | 708 |
public R visitMemberSelect(MemberSelectTree node, P p) { |
709 |
return scan(node.getExpression(), p); |
|
710 |
} |
|
711 |
||
25287 | 712 |
/** |
713 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
714 |
* |
|
715 |
* @param node {@inheritDoc} |
|
716 |
* @param p {@inheritDoc} |
|
717 |
* @return the result of scanning |
|
718 |
*/ |
|
719 |
@Override |
|
11142 | 720 |
public R visitMemberReference(MemberReferenceTree node, P p) { |
721 |
R r = scan(node.getQualifierExpression(), p); |
|
722 |
r = scanAndReduce(node.getTypeArguments(), p, r); |
|
723 |
return r; |
|
724 |
} |
|
725 |
||
25287 | 726 |
/** |
727 |
* {@inheritDoc} This implementation returns {@code null}. |
|
728 |
* |
|
729 |
* @param node {@inheritDoc} |
|
730 |
* @param p {@inheritDoc} |
|
731 |
* @return the result of scanning |
|
732 |
*/ |
|
733 |
@Override |
|
10 | 734 |
public R visitIdentifier(IdentifierTree node, P p) { |
735 |
return null; |
|
736 |
} |
|
737 |
||
25287 | 738 |
/** |
739 |
* {@inheritDoc} This implementation returns {@code null}. |
|
740 |
* |
|
741 |
* @param node {@inheritDoc} |
|
742 |
* @param p {@inheritDoc} |
|
743 |
* @return the result of scanning |
|
744 |
*/ |
|
745 |
@Override |
|
10 | 746 |
public R visitLiteral(LiteralTree node, P p) { |
747 |
return null; |
|
748 |
} |
|
749 |
||
25287 | 750 |
/** |
751 |
* {@inheritDoc} This implementation returns {@code null}. |
|
752 |
* |
|
753 |
* @param node {@inheritDoc} |
|
754 |
* @param p {@inheritDoc} |
|
755 |
* @return the result of scanning |
|
756 |
*/ |
|
757 |
@Override |
|
10 | 758 |
public R visitPrimitiveType(PrimitiveTypeTree node, P p) { |
759 |
return null; |
|
760 |
} |
|
761 |
||
25287 | 762 |
/** |
763 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
764 |
* |
|
765 |
* @param node {@inheritDoc} |
|
766 |
* @param p {@inheritDoc} |
|
767 |
* @return the result of scanning |
|
768 |
*/ |
|
769 |
@Override |
|
10 | 770 |
public R visitArrayType(ArrayTypeTree node, P p) { |
771 |
return scan(node.getType(), p); |
|
772 |
} |
|
773 |
||
25287 | 774 |
/** |
775 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
776 |
* |
|
777 |
* @param node {@inheritDoc} |
|
778 |
* @param p {@inheritDoc} |
|
779 |
* @return the result of scanning |
|
780 |
*/ |
|
781 |
@Override |
|
10 | 782 |
public R visitParameterizedType(ParameterizedTypeTree node, P p) { |
783 |
R r = scan(node.getType(), p); |
|
784 |
r = scanAndReduce(node.getTypeArguments(), p, r); |
|
785 |
return r; |
|
786 |
} |
|
787 |
||
25287 | 788 |
/** |
789 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
790 |
* |
|
791 |
* @param node {@inheritDoc} |
|
792 |
* @param p {@inheritDoc} |
|
793 |
* @return the result of scanning |
|
794 |
*/ |
|
795 |
@Override |
|
9300
c2de4dd9853b
7033809: Rename "disjunctive" to "union" in javax.lang.model
darcy
parents:
8031
diff
changeset
|
796 |
public R visitUnionType(UnionTypeTree node, P p) { |
7074 | 797 |
return scan(node.getTypeAlternatives(), p); |
5492
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
3149
diff
changeset
|
798 |
} |
515e4b33b335
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents:
3149
diff
changeset
|
799 |
|
25287 | 800 |
/** |
801 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
802 |
* |
|
803 |
* @param node {@inheritDoc} |
|
804 |
* @param p {@inheritDoc} |
|
805 |
* @return the result of scanning |
|
806 |
*/ |
|
807 |
@Override |
|
14725
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
13844
diff
changeset
|
808 |
public R visitIntersectionType(IntersectionTypeTree node, P p) { |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
13844
diff
changeset
|
809 |
return scan(node.getBounds(), p); |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
13844
diff
changeset
|
810 |
} |
65836e833f59
8002099: Add support for intersection types in cast expression
mcimadamore
parents:
13844
diff
changeset
|
811 |
|
25287 | 812 |
/** |
813 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
814 |
* |
|
815 |
* @param node {@inheritDoc} |
|
816 |
* @param p {@inheritDoc} |
|
817 |
* @return the result of scanning |
|
818 |
*/ |
|
819 |
@Override |
|
10 | 820 |
public R visitTypeParameter(TypeParameterTree node, P p) { |
15385 | 821 |
R r = scan(node.getAnnotations(), p); |
822 |
r = scanAndReduce(node.getBounds(), p, r); |
|
3149 | 823 |
return r; |
10 | 824 |
} |
825 |
||
25287 | 826 |
/** |
827 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
828 |
* |
|
829 |
* @param node {@inheritDoc} |
|
830 |
* @param p {@inheritDoc} |
|
831 |
* @return the result of scanning |
|
832 |
*/ |
|
833 |
@Override |
|
10 | 834 |
public R visitWildcard(WildcardTree node, P p) { |
835 |
return scan(node.getBound(), p); |
|
836 |
} |
|
837 |
||
25287 | 838 |
/** |
839 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
840 |
* |
|
841 |
* @param node {@inheritDoc} |
|
842 |
* @param p {@inheritDoc} |
|
843 |
* @return the result of scanning |
|
844 |
*/ |
|
845 |
@Override |
|
10 | 846 |
public R visitModifiers(ModifiersTree node, P p) { |
847 |
return scan(node.getAnnotations(), p); |
|
848 |
} |
|
849 |
||
25287 | 850 |
/** |
851 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
852 |
* |
|
853 |
* @param node {@inheritDoc} |
|
854 |
* @param p {@inheritDoc} |
|
855 |
* @return the result of scanning |
|
856 |
*/ |
|
857 |
@Override |
|
10 | 858 |
public R visitAnnotation(AnnotationTree node, P p) { |
859 |
R r = scan(node.getAnnotationType(), p); |
|
860 |
r = scanAndReduce(node.getArguments(), p, r); |
|
861 |
return r; |
|
862 |
} |
|
863 |
||
25287 | 864 |
/** |
865 |
* {@inheritDoc} This implementation scans the children in left to right order. |
|
866 |
* |
|
867 |
* @param node {@inheritDoc} |
|
868 |
* @param p {@inheritDoc} |
|
869 |
* @return the result of scanning |
|
870 |
*/ |
|
871 |
@Override |
|
872 |
public R visitAnnotatedType(AnnotatedTypeTree node, P p) { |
|
873 |
R r = scan(node.getAnnotations(), p); |
|
874 |
r = scanAndReduce(node.getUnderlyingType(), p, r); |
|
875 |
return r; |
|
876 |
} |
|
15385 | 877 |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
878 |
@Override |
36526 | 879 |
public R visitModule(ModuleTree node, P p) { |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
880 |
R r = scan(node.getAnnotations(), p); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
881 |
r = scanAndReduce(node.getName(), p, r); |
36526 | 882 |
r = scanAndReduce(node.getDirectives(), p, r); |
883 |
return r; |
|
884 |
} |
|
885 |
||
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
886 |
@Override |
36526 | 887 |
public R visitExports(ExportsTree node, P p) { |
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
888 |
R r = scan(node.getPackageName(), p); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
889 |
r = scanAndReduce(node.getModuleNames(), p, r); |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
890 |
return r; |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
891 |
} |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
892 |
|
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
893 |
@Override |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
894 |
public R visitOpens(OpensTree node, P p) { |
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
895 |
R r = scan(node.getPackageName(), p); |
36526 | 896 |
r = scanAndReduce(node.getModuleNames(), p, r); |
897 |
return r; |
|
898 |
} |
|
899 |
||
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
900 |
@Override |
36526 | 901 |
public R visitProvides(ProvidesTree node, P p) { |
902 |
R r = scan(node.getServiceName(), p); |
|
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
903 |
r = scanAndReduce(node.getImplementationNames(), p, r); |
36526 | 904 |
return r; |
905 |
} |
|
906 |
||
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
907 |
@Override |
36526 | 908 |
public R visitRequires(RequiresTree node, P p) { |
909 |
return scan(node.getModuleName(), p); |
|
910 |
} |
|
911 |
||
42407
f3702cff2933
8169069: Module system implementation refresh (11/2016)
alanb
parents:
36526
diff
changeset
|
912 |
@Override |
36526 | 913 |
public R visitUses(UsesTree node, P p) { |
914 |
return scan(node.getServiceName(), p); |
|
915 |
} |
|
916 |
||
25287 | 917 |
/** |
918 |
* {@inheritDoc} This implementation returns {@code null}. |
|
919 |
* |
|
920 |
* @param node {@inheritDoc} |
|
921 |
* @param p {@inheritDoc} |
|
922 |
* @return the result of scanning |
|
923 |
*/ |
|
924 |
@Override |
|
10 | 925 |
public R visitOther(Tree node, P p) { |
926 |
return null; |
|
927 |
} |
|
928 |
||
25287 | 929 |
/** |
930 |
* {@inheritDoc} This implementation returns {@code null}. |
|
931 |
* |
|
932 |
* @param node {@inheritDoc} |
|
933 |
* @param p {@inheritDoc} |
|
934 |
* @return the result of scanning |
|
935 |
*/ |
|
936 |
@Override |
|
10 | 937 |
public R visitErroneous(ErroneousTree node, P p) { |
938 |
return null; |
|
939 |
} |
|
55306 | 940 |
|
941 |
/** |
|
58440
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
942 |
* {@preview Associated with switch expressions, a preview feature of |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
943 |
* the Java language. |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
944 |
* |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
945 |
* This method is associated with <i>switch expressions</i>, a preview |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
946 |
* feature of the Java language. Preview features |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
947 |
* may be removed in a future release, or upgraded to permanent |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
948 |
* features of the Java language.} |
4c8a6d1d066c
Improving appearance of javadoc of the APIs associated with preview features.
jlahoda
parents:
58109
diff
changeset
|
949 |
* |
55306 | 950 |
* {@inheritDoc} This implementation returns {@code null}. |
951 |
* |
|
952 |
* @param node {@inheritDoc} |
|
953 |
* @param p {@inheritDoc} |
|
954 |
* @return the result of scanning |
|
955 |
*/ |
|
956 |
@Override |
|
58109
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
55306
diff
changeset
|
957 |
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS) |
ee07de0d2c16
Updating javac behavior w.r.t. preview API. Based on darcy's patch.
jlahoda
parents:
55306
diff
changeset
|
958 |
@SuppressWarnings("preview") |
55306 | 959 |
public R visitYield(YieldTree node, P p) { |
960 |
return scan(node.getValue(), p); |
|
961 |
} |
|
10 | 962 |
} |