1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
197 |
197 |
198 /** |
198 /** |
199 * Visits a variable element, dispatching to the visit method for |
199 * Visits a variable element, dispatching to the visit method for |
200 * the specific {@linkplain ElementKind kind} of variable, {@code |
200 * the specific {@linkplain ElementKind kind} of variable, {@code |
201 * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD}, |
201 * ENUM_CONSTANT}, {@code EXCEPTION_PARAMETER}, {@code FIELD}, |
202 * {@code LOCAL_VARIABLE}, or {@code PARAMETER}. |
202 * {@code LOCAL_VARIABLE}, {@code PARAMETER}, or {@code RESOURCE_VARIABLE}. |
|
203 * |
203 * @param e {@inheritDoc} |
204 * @param e {@inheritDoc} |
204 * @param p {@inheritDoc} |
205 * @param p {@inheritDoc} |
205 * @return the result of the kind-specific visit method |
206 * @return the result of the kind-specific visit method |
206 */ |
207 */ |
207 @Override |
208 @Override |
221 return visitVariableAsLocalVariable(e, p); |
222 return visitVariableAsLocalVariable(e, p); |
222 |
223 |
223 case PARAMETER: |
224 case PARAMETER: |
224 return visitVariableAsParameter(e, p); |
225 return visitVariableAsParameter(e, p); |
225 |
226 |
|
227 case RESOURCE_VARIABLE: |
|
228 return visitVariableAsResourceVariable(e, p); |
|
229 |
226 default: |
230 default: |
227 throw new AssertionError("Bad kind " + k + " for VariableElement" + e); |
231 throw new AssertionError("Bad kind " + k + " for VariableElement" + e); |
228 } |
232 } |
229 |
|
230 } |
233 } |
231 |
234 |
232 /** |
235 /** |
233 * Visits an {@code ENUM_CONSTANT} variable element by calling |
236 * Visits an {@code ENUM_CONSTANT} variable element by calling |
234 * {@code defaultAction}. |
237 * {@code defaultAction}. |
285 * @param p a visitor-specified parameter |
288 * @param p a visitor-specified parameter |
286 * @return the result of {@code defaultAction} |
289 * @return the result of {@code defaultAction} |
287 */ |
290 */ |
288 public R visitVariableAsParameter(VariableElement e, P p) { |
291 public R visitVariableAsParameter(VariableElement e, P p) { |
289 return defaultAction(e, p); |
292 return defaultAction(e, p); |
|
293 } |
|
294 |
|
295 /** |
|
296 * Visits a {@code RESOURCE_VARIABLE} variable element by calling |
|
297 * {@code visitUnknown}. |
|
298 * |
|
299 * @param e the element to visit |
|
300 * @param p a visitor-specified parameter |
|
301 * @return the result of {@code visitUnknown} |
|
302 * |
|
303 * @since 1.7 |
|
304 */ |
|
305 public R visitVariableAsResourceVariable(VariableElement e, P p) { |
|
306 return visitUnknown(e, p); |
290 } |
307 } |
291 |
308 |
292 /** |
309 /** |
293 * Visits an executable element, dispatching to the visit method |
310 * Visits an executable element, dispatching to the visit method |
294 * for the specific {@linkplain ElementKind kind} of executable, |
311 * for the specific {@linkplain ElementKind kind} of executable, |