aoqi@0: /* aoqi@0: * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. Oracle designates this aoqi@0: * particular file as subject to the "Classpath" exception as provided aoqi@0: * by Oracle in the LICENSE file that accompanied this code. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: */ aoqi@0: aoqi@0: package javax.lang.model.util; aoqi@0: aoqi@0: import javax.lang.model.element.*; aoqi@0: import javax.annotation.processing.SupportedSourceVersion; aoqi@0: import javax.lang.model.SourceVersion; aoqi@0: import static javax.lang.model.SourceVersion.*; aoqi@0: aoqi@0: aoqi@0: /** aoqi@0: * A scanning visitor of program elements with default behavior aoqi@0: * appropriate for the {@link SourceVersion#RELEASE_8 RELEASE_8} aoqi@0: * source version. The visitXYZ methods in this aoqi@0: * class scan their component elements by calling {@code scan} on aoqi@0: * their {@linkplain Element#getEnclosedElements enclosed elements}, aoqi@0: * {@linkplain ExecutableElement#getParameters parameters}, etc., as aoqi@0: * indicated in the individual method specifications. A subclass can aoqi@0: * control the order elements are visited by overriding the aoqi@0: * visitXYZ methods. Note that clients of a scanner aoqi@0: * may get the desired behavior be invoking {@code v.scan(e, p)} rather aoqi@0: * than {@code v.visit(e, p)} on the root objects of interest. aoqi@0: * aoqi@0: *

When a subclass overrides a visitXYZ method, the aoqi@0: * new method can cause the enclosed elements to be scanned in the aoqi@0: * default way by calling super.visitXYZ. In this aoqi@0: * fashion, the concrete visitor can control the ordering of traversal aoqi@0: * over the component elements with respect to the additional aoqi@0: * processing; for example, consistently calling aoqi@0: * super.visitXYZ at the start of the overridden aoqi@0: * methods will yield a preorder traversal, etc. If the component aoqi@0: * elements should be traversed in some other order, instead of aoqi@0: * calling super.visitXYZ, an overriding visit method aoqi@0: * should call {@code scan} with the elements in the desired order. aoqi@0: * aoqi@0: *

Methods in this class may be overridden subject to their aoqi@0: * general contract. Note that annotating methods in concrete aoqi@0: * subclasses with {@link java.lang.Override @Override} will help aoqi@0: * ensure that methods are overridden as intended. aoqi@0: * aoqi@0: *

WARNING: The {@code ElementVisitor} interface aoqi@0: * implemented by this class may have methods added to it in the aoqi@0: * future to accommodate new, currently unknown, language structures aoqi@0: * added to future versions of the Java™ programming language. aoqi@0: * Therefore, methods whose names begin with {@code "visit"} may be aoqi@0: * added to this class in the future; to avoid incompatibilities, aoqi@0: * classes which extend this class should not declare any instance aoqi@0: * methods with names beginning with {@code "visit"}. aoqi@0: * aoqi@0: *

When such a new visit method is added, the default aoqi@0: * implementation in this class will be to call the {@link aoqi@0: * #visitUnknown visitUnknown} method. A new element scanner visitor aoqi@0: * class will also be introduced to correspond to the new language aoqi@0: * level; this visitor will have different default behavior for the aoqi@0: * visit method in question. When the new visitor is introduced, all aoqi@0: * or portions of this visitor may be deprecated. aoqi@0: * aoqi@0: * @param the return type of this visitor's methods. Use {@link aoqi@0: * Void} for visitors that do not need to return results. aoqi@0: * @param

the type of the additional parameter to this visitor's aoqi@0: * methods. Use {@code Void} for visitors that do not need an aoqi@0: * additional parameter. aoqi@0: * aoqi@0: * @see ElementScanner6 aoqi@0: * @see ElementScanner7 aoqi@0: * @since 1.8 aoqi@0: */ aoqi@0: @SupportedSourceVersion(RELEASE_8) aoqi@0: public class ElementScanner8 extends ElementScanner7 { aoqi@0: /** aoqi@0: * Constructor for concrete subclasses; uses {@code null} for the aoqi@0: * default value. aoqi@0: */ aoqi@0: protected ElementScanner8(){ aoqi@0: super(null); aoqi@0: } aoqi@0: aoqi@0: /** aoqi@0: * Constructor for concrete subclasses; uses the argument for the aoqi@0: * default value. aoqi@0: * aoqi@0: * @param defaultValue the default value aoqi@0: */ aoqi@0: protected ElementScanner8(R defaultValue){ aoqi@0: super(defaultValue); aoqi@0: } aoqi@0: }