1 /* |
1 /* |
2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2017, 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 |
32 |
32 |
33 |
33 |
34 /** |
34 /** |
35 * A scanning visitor of program elements with default behavior |
35 * A scanning visitor of program elements with default behavior |
36 * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6} |
36 * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6} |
37 * source version. The <code>visit<i>XYZ</i></code> methods in this |
37 * source version. The <code>visit<i>Xyz</i></code> methods in this |
38 * class scan their component elements by calling {@code scan} on |
38 * class scan their component elements by calling {@code scan} on |
39 * their {@linkplain Element#getEnclosedElements enclosed elements}, |
39 * their {@linkplain Element#getEnclosedElements enclosed elements}, |
40 * {@linkplain ExecutableElement#getParameters parameters}, etc., as |
40 * {@linkplain ExecutableElement#getParameters parameters}, etc., as |
41 * indicated in the individual method specifications. A subclass can |
41 * indicated in the individual method specifications. A subclass can |
42 * control the order elements are visited by overriding the |
42 * control the order elements are visited by overriding the |
43 * <code>visit<i>XYZ</i></code> methods. Note that clients of a scanner |
43 * <code>visit<i>Xyz</i></code> methods. Note that clients of a scanner |
44 * may get the desired behavior be invoking {@code v.scan(e, p)} rather |
44 * may get the desired behavior be invoking {@code v.scan(e, p)} rather |
45 * than {@code v.visit(e, p)} on the root objects of interest. |
45 * than {@code v.visit(e, p)} on the root objects of interest. |
46 * |
46 * |
47 * <p>When a subclass overrides a <code>visit<i>XYZ</i></code> method, the |
47 * <p>When a subclass overrides a <code>visit<i>Xyz</i></code> method, the |
48 * new method can cause the enclosed elements to be scanned in the |
48 * new method can cause the enclosed elements to be scanned in the |
49 * default way by calling <code>super.visit<i>XYZ</i></code>. In this |
49 * default way by calling <code>super.visit<i>Xyz</i></code>. In this |
50 * fashion, the concrete visitor can control the ordering of traversal |
50 * fashion, the concrete visitor can control the ordering of traversal |
51 * over the component elements with respect to the additional |
51 * over the component elements with respect to the additional |
52 * processing; for example, consistently calling |
52 * processing; for example, consistently calling |
53 * <code>super.visit<i>XYZ</i></code> at the start of the overridden |
53 * <code>super.visit<i>Xyz</i></code> at the start of the overridden |
54 * methods will yield a preorder traversal, etc. If the component |
54 * methods will yield a preorder traversal, etc. If the component |
55 * elements should be traversed in some other order, instead of |
55 * elements should be traversed in some other order, instead of |
56 * calling <code>super.visit<i>XYZ</i></code>, an overriding visit method |
56 * calling <code>super.visit<i>Xyz</i></code>, an overriding visit method |
57 * should call {@code scan} with the elements in the desired order. |
57 * should call {@code scan} with the elements in the desired order. |
58 * |
58 * |
59 * <p> Methods in this class may be overridden subject to their |
59 * <p> Methods in this class may be overridden subject to their |
60 * general contract. Note that annotating methods in concrete |
60 * general contract. Note that annotating methods in concrete |
61 * subclasses with {@link java.lang.Override @Override} will help |
61 * subclasses with {@link java.lang.Override @Override} will help |