duke@1: /* darcy@1522: * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. duke@1: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@1: * duke@1: * This code is free software; you can redistribute it and/or modify it duke@1: * under the terms of the GNU General Public License version 2 only, as ohair@554: * published by the Free Software Foundation. Oracle designates this duke@1: * particular file as subject to the "Classpath" exception as provided ohair@554: * by Oracle in the LICENSE file that accompanied this code. duke@1: * duke@1: * This code is distributed in the hope that it will be useful, but WITHOUT duke@1: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@1: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@1: * version 2 for more details (a copy is included in the LICENSE file that duke@1: * accompanied this code). duke@1: * duke@1: * You should have received a copy of the GNU General Public License version duke@1: * 2 along with this work; if not, write to the Free Software Foundation, duke@1: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@1: * ohair@554: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@554: * or visit www.oracle.com if you need additional information or have any ohair@554: * questions. duke@1: */ duke@1: duke@1: package javax.lang.model.util; duke@1: jjg@1357: import javax.annotation.processing.SupportedSourceVersion; jjg@1357: import javax.lang.model.SourceVersion; duke@1: import javax.lang.model.element.*; duke@1: import static javax.lang.model.SourceVersion.*; duke@1: duke@1: duke@1: /** duke@1: * A skeletal visitor of program elements with default behavior duke@1: * appropriate for the {@link SourceVersion#RELEASE_6 RELEASE_6} duke@1: * source version. duke@1: * duke@1: *
WARNING: The {@code ElementVisitor} interface duke@1: * implemented by this class may have methods added to it in the duke@1: * future to accommodate new, currently unknown, language structures duke@1: * added to future versions of the Java™ programming language. duke@1: * Therefore, methods whose names begin with {@code "visit"} may be duke@1: * added to this class in the future; to avoid incompatibilities, duke@1: * classes which extend this class should not declare any instance duke@1: * methods with names beginning with {@code "visit"}. duke@1: * duke@1: *
When such a new visit method is added, the default duke@1: * implementation in this class will be to call the {@link duke@1: * #visitUnknown visitUnknown} method. A new abstract element visitor duke@1: * class will also be introduced to correspond to the new language duke@1: * level; this visitor will have different default behavior for the duke@1: * visit method in question. When the new visitor is introduced, all duke@1: * or portions of this visitor may be deprecated. duke@1: * darcy@1522: *
Note that adding a default implementation of a new visit method
darcy@1522: * in a visitor class will occur instead of adding a default
darcy@1522: * method directly in the visitor interface since a Java SE 8
darcy@1522: * language feature cannot be used to this version of the API since
darcy@1522: * this version is required to be runnable on Java SE 7
darcy@1522: * implementations. Future versions of the API that are only required
darcy@1522: * to run on Java SE 8 and later may take advantage of default methods
darcy@1522: * in this situation.
darcy@1522: *
duke@1: * @param the type of the additional parameter to this visitor's
duke@1: * methods. Use {@code Void} for visitors that do not need an
duke@1: * additional parameter.
duke@1: *
duke@1: * @author Joseph D. Darcy
duke@1: * @author Scott Seligman
duke@1: * @author Peter von der Ahé
darcy@575: *
darcy@575: * @see AbstractElementVisitor7
darcy@1054: * @see AbstractElementVisitor8
duke@1: * @since 1.6
duke@1: */
duke@1: @SupportedSourceVersion(RELEASE_6)
duke@1: public abstract class AbstractElementVisitor6 The default implementation of this method in
duke@1: * {@code AbstractElementVisitor6} will always throw
duke@1: * {@code UnknownElementException}.
duke@1: * This behavior is not required of a subclass.
duke@1: *
duke@1: * @param e the element to visit
duke@1: * @param p a visitor-specified parameter
duke@1: * @return a visitor-specified result
duke@1: * @throws UnknownElementException
duke@1: * a visitor implementation may optionally throw this exception
duke@1: */
duke@1: public R visitUnknown(Element e, P p) {
duke@1: throw new UnknownElementException(e, p);
duke@1: }
duke@1: }