langtools/src/share/classes/com/sun/source/tree/TreeVisitor.java
author mcimadamore
Mon, 03 May 2010 17:12:59 -0700
changeset 5492 515e4b33b335
parent 3149 0cd06d598d6f
child 5520 86e4b9a9da40
permissions -rw-r--r--
6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch') Reviewed-by: jjg, darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
 * have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.source.tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
 * A visitor of trees, in the style of the visitor design pattern.
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
 * Classes implementing this interface are used to operate
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
 * on a tree when the kind of tree is unknown at compile time.
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
 * When a visitor is passed to an tree's {@link Tree#accept
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
 * accept} method, the <tt>visit<i>XYZ</i></tt> method most applicable
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
 * to that tree is invoked.
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
 * <p> Classes implementing this interface may or may not throw a
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * {@code NullPointerException} if the additional parameter {@code p}
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 * is {@code null}; see documentation of the implementing class for
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
 * details.
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
 * <p> <b>WARNING:</b> It is possible that methods will be added to
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
 * this interface to accommodate new, currently unknown, language
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
 * structures added to future versions of the Java&trade; programming
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * language.  Therefore, visitor classes directly implementing this
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * interface may be source incompatible with future versions of the
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * platform.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * @param <R> the return type of this visitor's methods.  Use {@link
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 *            Void} for visitors that do not need to return results.
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * @param <P> the type of the additional parameter to this visitor's
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 *            methods.  Use {@code Void} for visitors that do not need an
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 *            additional parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * @author Peter von der Ah&eacute;
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * @author Jonathan Gibbons
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * @since 1.6
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
public interface TreeVisitor<R,P> {
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 10
diff changeset
    60
    R visitAnnotatedType(AnnotatedTypeTree node, P p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
    R visitAnnotation(AnnotationTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    R visitMethodInvocation(MethodInvocationTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
    R visitAssert(AssertTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
    R visitAssignment(AssignmentTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
    R visitCompoundAssignment(CompoundAssignmentTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
    R visitBinary(BinaryTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
    R visitBlock(BlockTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
    R visitBreak(BreakTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    R visitCase(CaseTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
    R visitCatch(CatchTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    R visitClass(ClassTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
    R visitConditionalExpression(ConditionalExpressionTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
    R visitContinue(ContinueTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
    R visitDoWhileLoop(DoWhileLoopTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    R visitErroneous(ErroneousTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
    R visitExpressionStatement(ExpressionStatementTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    R visitEnhancedForLoop(EnhancedForLoopTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
    R visitForLoop(ForLoopTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
    R visitIdentifier(IdentifierTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    R visitIf(IfTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    R visitImport(ImportTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    R visitArrayAccess(ArrayAccessTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    R visitLabeledStatement(LabeledStatementTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
    R visitLiteral(LiteralTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    R visitMethod(MethodTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
    R visitModifiers(ModifiersTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    R visitNewArray(NewArrayTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
    R visitNewClass(NewClassTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    R visitParenthesized(ParenthesizedTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    R visitReturn(ReturnTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    R visitMemberSelect(MemberSelectTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    R visitEmptyStatement(EmptyStatementTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    R visitSwitch(SwitchTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
    R visitSynchronized(SynchronizedTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    R visitThrow(ThrowTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
    R visitCompilationUnit(CompilationUnitTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    R visitTry(TryTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
    R visitParameterizedType(ParameterizedTypeTree node, P p);
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
    99
    R visitDisjointType(DisjointTypeTree node, P p);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    R visitArrayType(ArrayTypeTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    R visitTypeCast(TypeCastTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    R visitPrimitiveType(PrimitiveTypeTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    R visitTypeParameter(TypeParameterTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
    R visitInstanceOf(InstanceOfTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    R visitUnary(UnaryTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
    R visitVariable(VariableTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    R visitWhileLoop(WhileLoopTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
    R visitWildcard(WildcardTree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    R visitOther(Tree node, P p);
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
}