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