langtools/src/share/classes/com/sun/tools/javac/tree/JCTree.java
author jjg
Thu, 10 Jun 2010 16:08:01 -0700
changeset 5847 1908176fd6e3
parent 5520 86e4b9a9da40
child 6148 3a8158299c51
permissions -rw-r--r--
6944312: Potential rebranding issues in openjdk/langtools repository sources Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
     2
 * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
10
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
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
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
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 5492
diff changeset
    23
 * questions.
10
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.tools.javac.tree;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
import java.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
import java.io.IOException;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
import java.io.StringWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import javax.lang.model.element.Modifier;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import javax.lang.model.type.TypeKind;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import javax.tools.JavaFileObject;
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
import com.sun.tools.javac.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
import com.sun.tools.javac.util.List;
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
import com.sun.tools.javac.code.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
import com.sun.tools.javac.code.Scope;
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
import com.sun.tools.javac.code.Symbol.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
import com.sun.source.tree.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
import static com.sun.tools.javac.code.BoundKind.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * Root class for abstract syntax tree nodes. It provides definitions
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * for specific tree nodes as subclasses nested inside.
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * <p>Each subclass is highly standardized.  It generally contains
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * only tree fields for the syntactic subcomponents of the node.  Some
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * classes that represent identifier uses or definitions also define a
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * Symbol field that denotes the represented identifier.  Classes for
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * non-local jumps also carry the jump target as a field.  The root
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * class Tree itself defines fields for the tree's type and position.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 * No other fields are kept in a tree node; instead parameters are
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 * passed to methods accessing the node.
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
 * <p>Except for the methods defined by com.sun.source, the only
06bc494ca11e Initial load
duke
parents:
diff changeset
    60
 * method defined in subclasses is `visit' which applies a given
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
 * visitor to the tree. The actual tree processing is done by visitor
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
 * classes in other packages. The abstract class Visitor, as well as
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * an Factory interface for trees, are defined as inner classes in
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 * Tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
 * <p>To avoid ambiguities with the Tree API in com.sun.source all sub
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 * classes should, by convention, start with JC (javac).
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
 *
5847
1908176fd6e3 6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents: 5520
diff changeset
    69
 * <p><b>This is NOT part of any supported API.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
 * If you write code that depends on this, you do so at your own risk.
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
 * This code and its internal interfaces are subject to change or
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
 * deletion without notice.</b>
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
 * @see TreeMaker
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
 * @see TreeInfo
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
 * @see TreeTranslator
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
 * @see Pretty
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
    /* Tree tag values, identifying kinds of trees */
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
    /** Toplevel nodes, of type TopLevel, representing entire source files.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    public static final int  TOPLEVEL = 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    /** Import clauses, of type Import.
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    public static final int IMPORT = TOPLEVEL + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    /** Class definitions, of type ClassDef.
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
    public static final int CLASSDEF = IMPORT + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    /** Method definitions, of type MethodDef.
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    public static final int METHODDEF = CLASSDEF + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
    /** Variable definitions, of type VarDef.
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    public static final int VARDEF = METHODDEF + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
    /** The no-op statement ";", of type Skip
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    public static final int SKIP = VARDEF + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    /** Blocks, of type Block.
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
    public static final int BLOCK = SKIP + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
    /** Do-while loops, of type DoLoop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
    public static final int DOLOOP = BLOCK + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    /** While-loops, of type WhileLoop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    public static final int WHILELOOP = DOLOOP + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
    /** For-loops, of type ForLoop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
    public static final int FORLOOP = WHILELOOP + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
    /** Foreach-loops, of type ForeachLoop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
    public static final int FOREACHLOOP = FORLOOP + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
06bc494ca11e Initial load
duke
parents:
diff changeset
   127
    /** Labelled statements, of type Labelled.
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
    public static final int LABELLED = FOREACHLOOP + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
    /** Switch statements, of type Switch.
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
    public static final int SWITCH = LABELLED + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
    /** Case parts in switch statements, of type Case.
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
    public static final int CASE = SWITCH + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
    /** Synchronized statements, of type Synchonized.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public static final int SYNCHRONIZED = CASE + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    /** Try statements, of type Try.
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
    public static final int TRY = SYNCHRONIZED + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
    /** Catch clauses in try statements, of type Catch.
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
    public static final int CATCH = TRY + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    /** Conditional expressions, of type Conditional.
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    public static final int CONDEXPR = CATCH + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
    /** Conditional statements, of type If.
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    public static final int IF = CONDEXPR + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    /** Expression statements, of type Exec.
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
    public static final int EXEC = IF + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
    /** Break statements, of type Break.
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
    public static final int BREAK = EXEC + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
    /** Continue statements, of type Continue.
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
    public static final int CONTINUE = BREAK + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
    /** Return statements, of type Return.
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    public static final int RETURN = CONTINUE + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    /** Throw statements, of type Throw.
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
    public static final int THROW = RETURN + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    /** Assert statements, of type Assert.
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    public static final int ASSERT = THROW + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   182
06bc494ca11e Initial load
duke
parents:
diff changeset
   183
    /** Method invocation expressions, of type Apply.
06bc494ca11e Initial load
duke
parents:
diff changeset
   184
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   185
    public static final int APPLY = ASSERT + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   186
06bc494ca11e Initial load
duke
parents:
diff changeset
   187
    /** Class instance creation expressions, of type NewClass.
06bc494ca11e Initial load
duke
parents:
diff changeset
   188
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   189
    public static final int NEWCLASS = APPLY + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   190
06bc494ca11e Initial load
duke
parents:
diff changeset
   191
    /** Array creation expressions, of type NewArray.
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
    public static final int NEWARRAY = NEWCLASS + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
    /** Parenthesized subexpressions, of type Parens.
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
    public static final int PARENS = NEWARRAY + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
    /** Assignment expressions, of type Assign.
06bc494ca11e Initial load
duke
parents:
diff changeset
   200
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
    public static final int ASSIGN = PARENS + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
    /** Type cast expressions, of type TypeCast.
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   205
    public static final int TYPECAST = ASSIGN + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
    /** Type test expressions, of type TypeTest.
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
    public static final int TYPETEST = TYPECAST + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    /** Indexed array expressions, of type Indexed.
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
    public static final int INDEXED = TYPETEST + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
    /** Selections, of type Select.
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
    public static final int SELECT = INDEXED + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    /** Simple identifiers, of type Ident.
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
    public static final int IDENT = SELECT + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
    /** Literals, of type Literal.
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
    public static final int LITERAL = IDENT + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
    /** Basic type identifiers, of type TypeIdent.
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
    public static final int TYPEIDENT = LITERAL + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
    /** Array types, of type TypeArray.
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
    public static final int TYPEARRAY = TYPEIDENT + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    /** Parameterized types, of type TypeApply.
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   237
    public static final int TYPEAPPLY = TYPEARRAY + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   238
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   239
    /** Disjunctive types, of type TypeDisjoint.
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   240
     */
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   241
    public static final int TYPEDISJOINT = TYPEAPPLY + 1;
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   242
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   243
    /** Formal type parameters, of type TypeParameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
     */
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
   245
    public static final int TYPEPARAMETER = TYPEDISJOINT + 1;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
    /** Type argument.
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    public static final int WILDCARD = TYPEPARAMETER + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    /** Bound kind: extends, super, exact, or unbound
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
    public static final int TYPEBOUNDKIND = WILDCARD + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
    /** metadata: Annotation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   257
    public static final int ANNOTATION = TYPEBOUNDKIND + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
    /** metadata: Modifiers
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   261
    public static final int MODIFIERS = ANNOTATION + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   263
    public static final int ANNOTATED_TYPE = MODIFIERS + 1;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   264
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   265
    /** Error trees, of type Erroneous.
06bc494ca11e Initial load
duke
parents:
diff changeset
   266
     */
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   267
    public static final int ERRONEOUS = ANNOTATED_TYPE + 1;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   268
06bc494ca11e Initial load
duke
parents:
diff changeset
   269
    /** Unary operators, of type Unary.
06bc494ca11e Initial load
duke
parents:
diff changeset
   270
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   271
    public static final int POS = ERRONEOUS + 1;             // +
06bc494ca11e Initial load
duke
parents:
diff changeset
   272
    public static final int NEG = POS + 1;                   // -
06bc494ca11e Initial load
duke
parents:
diff changeset
   273
    public static final int NOT = NEG + 1;                   // !
06bc494ca11e Initial load
duke
parents:
diff changeset
   274
    public static final int COMPL = NOT + 1;                 // ~
06bc494ca11e Initial load
duke
parents:
diff changeset
   275
    public static final int PREINC = COMPL + 1;              // ++ _
06bc494ca11e Initial load
duke
parents:
diff changeset
   276
    public static final int PREDEC = PREINC + 1;             // -- _
06bc494ca11e Initial load
duke
parents:
diff changeset
   277
    public static final int POSTINC = PREDEC + 1;            // _ ++
06bc494ca11e Initial load
duke
parents:
diff changeset
   278
    public static final int POSTDEC = POSTINC + 1;           // _ --
06bc494ca11e Initial load
duke
parents:
diff changeset
   279
06bc494ca11e Initial load
duke
parents:
diff changeset
   280
    /** unary operator for null reference checks, only used internally.
06bc494ca11e Initial load
duke
parents:
diff changeset
   281
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   282
    public static final int NULLCHK = POSTDEC + 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   283
06bc494ca11e Initial load
duke
parents:
diff changeset
   284
    /** Binary operators, of type Binary.
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   286
    public static final int OR = NULLCHK + 1;                // ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
    public static final int AND = OR + 1;                    // &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   288
    public static final int BITOR = AND + 1;                 // |
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
    public static final int BITXOR = BITOR + 1;              // ^
06bc494ca11e Initial load
duke
parents:
diff changeset
   290
    public static final int BITAND = BITXOR + 1;             // &
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
    public static final int EQ = BITAND + 1;                 // ==
06bc494ca11e Initial load
duke
parents:
diff changeset
   292
    public static final int NE = EQ + 1;                     // !=
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
    public static final int LT = NE + 1;                     // <
06bc494ca11e Initial load
duke
parents:
diff changeset
   294
    public static final int GT = LT + 1;                     // >
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
    public static final int LE = GT + 1;                     // <=
06bc494ca11e Initial load
duke
parents:
diff changeset
   296
    public static final int GE = LE + 1;                     // >=
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
    public static final int SL = GE + 1;                     // <<
06bc494ca11e Initial load
duke
parents:
diff changeset
   298
    public static final int SR = SL + 1;                     // >>
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
    public static final int USR = SR + 1;                    // >>>
06bc494ca11e Initial load
duke
parents:
diff changeset
   300
    public static final int PLUS = USR + 1;                  // +
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
    public static final int MINUS = PLUS + 1;                // -
06bc494ca11e Initial load
duke
parents:
diff changeset
   302
    public static final int MUL = MINUS + 1;                 // *
06bc494ca11e Initial load
duke
parents:
diff changeset
   303
    public static final int DIV = MUL + 1;                   // /
06bc494ca11e Initial load
duke
parents:
diff changeset
   304
    public static final int MOD = DIV + 1;                   // %
06bc494ca11e Initial load
duke
parents:
diff changeset
   305
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    /** Assignment operators, of type Assignop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   307
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   308
    public static final int BITOR_ASG = MOD + 1;             // |=
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
    public static final int BITXOR_ASG = BITOR_ASG + 1;      // ^=
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
    public static final int BITAND_ASG = BITXOR_ASG + 1;     // &=
06bc494ca11e Initial load
duke
parents:
diff changeset
   311
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
    public static final int SL_ASG = SL + BITOR_ASG - BITOR; // <<=
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
    public static final int SR_ASG = SL_ASG + 1;             // >>=
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
    public static final int USR_ASG = SR_ASG + 1;            // >>>=
06bc494ca11e Initial load
duke
parents:
diff changeset
   315
    public static final int PLUS_ASG = USR_ASG + 1;          // +=
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
    public static final int MINUS_ASG = PLUS_ASG + 1;        // -=
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
    public static final int MUL_ASG = MINUS_ASG + 1;         // *=
06bc494ca11e Initial load
duke
parents:
diff changeset
   318
    public static final int DIV_ASG = MUL_ASG + 1;           // /=
06bc494ca11e Initial load
duke
parents:
diff changeset
   319
    public static final int MOD_ASG = DIV_ASG + 1;           // %=
06bc494ca11e Initial load
duke
parents:
diff changeset
   320
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
    /** A synthetic let expression, of type LetExpr.
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
    public static final int LETEXPR = MOD_ASG + 1;           // ala scheme
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
    /** The offset between assignment operators and normal operators.
06bc494ca11e Initial load
duke
parents:
diff changeset
   327
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   328
    public static final int ASGOffset = BITOR_ASG - BITOR;
06bc494ca11e Initial load
duke
parents:
diff changeset
   329
06bc494ca11e Initial load
duke
parents:
diff changeset
   330
    /* The (encoded) position in the source file. @see util.Position.
06bc494ca11e Initial load
duke
parents:
diff changeset
   331
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
    public int pos;
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    /* The type of this node.
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    public Type type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
    /* The tag of this node -- one of the constants declared above.
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
    public abstract int getTag();
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
    /** Convert a tree to a pretty-printed string. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
    public String toString() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
        StringWriter s = new StringWriter();
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
            new Pretty(s, false).printExpr(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        catch (IOException e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
            // should never happen, because StringWriter is defined
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
            // never to throw any IOExceptions
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
            throw new AssertionError(e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
        return s.toString();
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
    /** Set position field and return this tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
    public JCTree setPos(int pos) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
        this.pos = pos;
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
        return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
    /** Set type field and return this tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   365
    public JCTree setType(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   366
        this.type = type;
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
        return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   369
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
    /** Visit this tree with a given visitor.
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   372
    public abstract void accept(Visitor v);
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
06bc494ca11e Initial load
duke
parents:
diff changeset
   374
    public abstract <R,D> R accept(TreeVisitor<R,D> v, D d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   375
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
    /** Return a shallow copy of this tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   378
    public Object clone() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   379
        try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   380
            return super.clone();
06bc494ca11e Initial load
duke
parents:
diff changeset
   381
        } catch(CloneNotSupportedException e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   382
            throw new RuntimeException(e);
06bc494ca11e Initial load
duke
parents:
diff changeset
   383
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
    /** Get a default position for this tree node.
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
    public DiagnosticPosition pos() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
        return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
    // for default DiagnosticPosition
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
    public JCTree getTree() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
        return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   395
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   396
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
    // for default DiagnosticPosition
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
    public int getStartPosition() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
        return TreeInfo.getStartPos(this);
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
    // for default DiagnosticPosition
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
    public int getPreferredPosition() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
        return pos;
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   406
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
    // for default DiagnosticPosition
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
    public int getEndPosition(Map<JCTree, Integer> endPosTable) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
        return TreeInfo.getEndPos(this, endPosTable);
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
     * Everything in one source file is kept in a TopLevel structure.
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
     * @param pid              The tree representing the package clause.
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
     * @param sourcefile       The source file name.
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
     * @param defs             All definitions in this file (ClassDef, Import, and Skip)
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
     * @param packge           The package it belongs to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
     * @param namedImportScope A scope for all named imports.
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
     * @param starImportScope  A scope for all import-on-demands.
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
     * @param lineMap          Line starting positions, defined only
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
     *                         if option -g is set.
06bc494ca11e Initial load
duke
parents:
diff changeset
   422
     * @param docComments      A hashtable that stores all documentation comments
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
     *                         indexed by the tree nodes they refer to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
     *                         defined only if option -s is set.
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
     * @param endPositions     A hashtable that stores ending positions of source
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
     *                         ranges indexed by the tree nodes they belong to.
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
     *                         Defined only if option -Xjcov is set.
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
    public static class JCCompilationUnit extends JCTree implements CompilationUnitTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
        public List<JCAnnotation> packageAnnotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
        public JCExpression pid;
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
        public List<JCTree> defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
        public JavaFileObject sourcefile;
06bc494ca11e Initial load
duke
parents:
diff changeset
   434
        public PackageSymbol packge;
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
        public Scope namedImportScope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
        public Scope starImportScope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
        public long flags;
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
        public Position.LineMap lineMap = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
        public Map<JCTree, String> docComments = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
        public Map<JCTree, Integer> endPositions = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
        protected JCCompilationUnit(List<JCAnnotation> packageAnnotations,
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
                        JCExpression pid,
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
                        List<JCTree> defs,
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
                        JavaFileObject sourcefile,
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
                        PackageSymbol packge,
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                        Scope namedImportScope,
06bc494ca11e Initial load
duke
parents:
diff changeset
   447
                        Scope starImportScope) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   448
            this.packageAnnotations = packageAnnotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
   449
            this.pid = pid;
06bc494ca11e Initial load
duke
parents:
diff changeset
   450
            this.defs = defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   451
            this.sourcefile = sourcefile;
06bc494ca11e Initial load
duke
parents:
diff changeset
   452
            this.packge = packge;
06bc494ca11e Initial load
duke
parents:
diff changeset
   453
            this.namedImportScope = namedImportScope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
            this.starImportScope = starImportScope;
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
        public void accept(Visitor v) { v.visitTopLevel(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
        public Kind getKind() { return Kind.COMPILATION_UNIT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
        public List<JCAnnotation> getPackageAnnotations() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
            return packageAnnotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
        public List<JCImport> getImports() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
            ListBuffer<JCImport> imports = new ListBuffer<JCImport>();
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
            for (JCTree tree : defs) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
                if (tree.getTag() == IMPORT)
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
                    imports.append((JCImport)tree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
                else
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
            return imports.toList();
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
        public JCExpression getPackageName() { return pid; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
        public JavaFileObject getSourceFile() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
            return sourcefile;
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
        public Position.LineMap getLineMap() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
            return lineMap;
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
        public List<JCTree> getTypeDecls() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
            List<JCTree> typeDefs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
            for (typeDefs = defs; !typeDefs.isEmpty(); typeDefs = typeDefs.tail)
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
                if (typeDefs.head.getTag() != IMPORT)
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
                    break;
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
            return typeDefs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   487
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   488
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   489
            return v.visitCompilationUnit(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   490
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   491
06bc494ca11e Initial load
duke
parents:
diff changeset
   492
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   493
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   494
            return TOPLEVEL;
06bc494ca11e Initial load
duke
parents:
diff changeset
   495
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   496
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   497
06bc494ca11e Initial load
duke
parents:
diff changeset
   498
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   499
     * An import clause.
06bc494ca11e Initial load
duke
parents:
diff changeset
   500
     * @param qualid    The imported class(es).
06bc494ca11e Initial load
duke
parents:
diff changeset
   501
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   502
    public static class JCImport extends JCTree implements ImportTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
        public boolean staticImport;
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
        public JCTree qualid;
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
        protected JCImport(JCTree qualid, boolean importStatic) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
            this.qualid = qualid;
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
            this.staticImport = importStatic;
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   509
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   510
        public void accept(Visitor v) { v.visitImport(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   511
06bc494ca11e Initial load
duke
parents:
diff changeset
   512
        public boolean isStatic() { return staticImport; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   513
        public JCTree getQualifiedIdentifier() { return qualid; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   514
06bc494ca11e Initial load
duke
parents:
diff changeset
   515
        public Kind getKind() { return Kind.IMPORT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   516
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   517
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   518
            return v.visitImport(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   519
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   520
06bc494ca11e Initial load
duke
parents:
diff changeset
   521
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   522
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
            return IMPORT;
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   525
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
    public static abstract class JCStatement extends JCTree implements StatementTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
        public JCStatement setType(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
            super.setType(type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
        public JCStatement setPos(int pos) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
            super.setPos(pos);
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
    public static abstract class JCExpression extends JCTree implements ExpressionTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
        public JCExpression setType(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
            super.setType(type);
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   545
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   547
        public JCExpression setPos(int pos) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
            super.setPos(pos);
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   552
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   554
     * A class definition.
06bc494ca11e Initial load
duke
parents:
diff changeset
   555
     * @param modifiers the modifiers
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
     * @param name the name of the class
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
     * @param typarams formal class parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
     * @param extending the classes this class extends
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
     * @param implementing the interfaces implemented by this class
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
     * @param defs all variables and methods defined in this class
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
     * @param sym the symbol
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
    public static class JCClassDecl extends JCStatement implements ClassTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   564
        public JCModifiers mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   565
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   566
        public List<JCTypeParameter> typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
        public JCTree extending;
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
        public List<JCExpression> implementing;
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
        public List<JCTree> defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
        public ClassSymbol sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
        protected JCClassDecl(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
                           Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   573
                           List<JCTypeParameter> typarams,
06bc494ca11e Initial load
duke
parents:
diff changeset
   574
                           JCTree extending,
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
                           List<JCExpression> implementing,
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
                           List<JCTree> defs,
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
                           ClassSymbol sym)
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
            this.mods = mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
            this.typarams = typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
            this.extending = extending;
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
            this.implementing = implementing;
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
            this.defs = defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
            this.sym = sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   586
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
        public void accept(Visitor v) { v.visitClassDef(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
        public Kind getKind() { return Kind.CLASS; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
        public JCModifiers getModifiers() { return mods; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
        public Name getSimpleName() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
        public List<JCTypeParameter> getTypeParameters() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   594
            return typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   596
        public JCTree getExtendsClause() { return extending; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
        public List<JCExpression> getImplementsClause() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
            return implementing;
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
        public List<JCTree> getMembers() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
            return defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
   602
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   603
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
            return v.visitClass(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   606
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   607
06bc494ca11e Initial load
duke
parents:
diff changeset
   608
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   609
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   610
            return CLASSDEF;
06bc494ca11e Initial load
duke
parents:
diff changeset
   611
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   612
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   613
06bc494ca11e Initial load
duke
parents:
diff changeset
   614
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   615
     * A method definition.
06bc494ca11e Initial load
duke
parents:
diff changeset
   616
     * @param modifiers method modifiers
06bc494ca11e Initial load
duke
parents:
diff changeset
   617
     * @param name method name
06bc494ca11e Initial load
duke
parents:
diff changeset
   618
     * @param restype type of method return value
06bc494ca11e Initial load
duke
parents:
diff changeset
   619
     * @param typarams type parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
   620
     * @param params value parameters
06bc494ca11e Initial load
duke
parents:
diff changeset
   621
     * @param thrown exceptions thrown by this method
06bc494ca11e Initial load
duke
parents:
diff changeset
   622
     * @param stats statements in the method
06bc494ca11e Initial load
duke
parents:
diff changeset
   623
     * @param sym method symbol
06bc494ca11e Initial load
duke
parents:
diff changeset
   624
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   625
    public static class JCMethodDecl extends JCTree implements MethodTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   626
        public JCModifiers mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   627
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   628
        public JCExpression restype;
06bc494ca11e Initial load
duke
parents:
diff changeset
   629
        public List<JCTypeParameter> typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   630
        public List<JCVariableDecl> params;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   631
        public List<JCTypeAnnotation> receiverAnnotations;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   632
        public List<JCExpression> thrown;
06bc494ca11e Initial load
duke
parents:
diff changeset
   633
        public JCBlock body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   634
        public JCExpression defaultValue; // for annotation types
06bc494ca11e Initial load
duke
parents:
diff changeset
   635
        public MethodSymbol sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   636
        protected JCMethodDecl(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
   637
                            Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   638
                            JCExpression restype,
06bc494ca11e Initial load
duke
parents:
diff changeset
   639
                            List<JCTypeParameter> typarams,
06bc494ca11e Initial load
duke
parents:
diff changeset
   640
                            List<JCVariableDecl> params,
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   641
                            List<JCTypeAnnotation> receiver,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   642
                            List<JCExpression> thrown,
06bc494ca11e Initial load
duke
parents:
diff changeset
   643
                            JCBlock body,
06bc494ca11e Initial load
duke
parents:
diff changeset
   644
                            JCExpression defaultValue,
06bc494ca11e Initial load
duke
parents:
diff changeset
   645
                            MethodSymbol sym)
06bc494ca11e Initial load
duke
parents:
diff changeset
   646
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
   647
            this.mods = mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   648
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   649
            this.restype = restype;
06bc494ca11e Initial load
duke
parents:
diff changeset
   650
            this.typarams = typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   651
            this.params = params;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   652
            this.receiverAnnotations = (receiver != null ? receiver : List.<JCTypeAnnotation>nil());
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   653
            this.thrown = thrown;
06bc494ca11e Initial load
duke
parents:
diff changeset
   654
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   655
            this.defaultValue = defaultValue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   656
            this.sym = sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   657
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   658
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   659
        public void accept(Visitor v) { v.visitMethodDef(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   660
06bc494ca11e Initial load
duke
parents:
diff changeset
   661
        public Kind getKind() { return Kind.METHOD; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   662
        public JCModifiers getModifiers() { return mods; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   663
        public Name getName() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   664
        public JCTree getReturnType() { return restype; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   665
        public List<JCTypeParameter> getTypeParameters() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   666
            return typarams;
06bc494ca11e Initial load
duke
parents:
diff changeset
   667
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   668
        public List<JCVariableDecl> getParameters() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
            return params;
06bc494ca11e Initial load
duke
parents:
diff changeset
   670
        }
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
   671
        public List<JCTypeAnnotation> getReceiverAnnotations() { return receiverAnnotations; }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   672
        public List<JCExpression> getThrows() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   673
            return thrown;
06bc494ca11e Initial load
duke
parents:
diff changeset
   674
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   675
        public JCBlock getBody() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   676
        public JCTree getDefaultValue() { // for annotation types
06bc494ca11e Initial load
duke
parents:
diff changeset
   677
            return defaultValue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   678
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   679
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   680
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   681
            return v.visitMethod(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   682
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   683
06bc494ca11e Initial load
duke
parents:
diff changeset
   684
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   685
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   686
            return METHODDEF;
06bc494ca11e Initial load
duke
parents:
diff changeset
   687
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   688
  }
06bc494ca11e Initial load
duke
parents:
diff changeset
   689
06bc494ca11e Initial load
duke
parents:
diff changeset
   690
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   691
     * A variable definition.
06bc494ca11e Initial load
duke
parents:
diff changeset
   692
     * @param modifiers variable modifiers
06bc494ca11e Initial load
duke
parents:
diff changeset
   693
     * @param name variable name
06bc494ca11e Initial load
duke
parents:
diff changeset
   694
     * @param vartype type of the variable
06bc494ca11e Initial load
duke
parents:
diff changeset
   695
     * @param init variables initial value
06bc494ca11e Initial load
duke
parents:
diff changeset
   696
     * @param sym symbol
06bc494ca11e Initial load
duke
parents:
diff changeset
   697
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   698
    public static class JCVariableDecl extends JCStatement implements VariableTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   699
        public JCModifiers mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   700
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   701
        public JCExpression vartype;
06bc494ca11e Initial load
duke
parents:
diff changeset
   702
        public JCExpression init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   703
        public VarSymbol sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   704
        protected JCVariableDecl(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
   705
                         Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
   706
                         JCExpression vartype,
06bc494ca11e Initial load
duke
parents:
diff changeset
   707
                         JCExpression init,
06bc494ca11e Initial load
duke
parents:
diff changeset
   708
                         VarSymbol sym) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   709
            this.mods = mods;
06bc494ca11e Initial load
duke
parents:
diff changeset
   710
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
   711
            this.vartype = vartype;
06bc494ca11e Initial load
duke
parents:
diff changeset
   712
            this.init = init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   713
            this.sym = sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
   714
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   715
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   716
        public void accept(Visitor v) { v.visitVarDef(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   717
06bc494ca11e Initial load
duke
parents:
diff changeset
   718
        public Kind getKind() { return Kind.VARIABLE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   719
        public JCModifiers getModifiers() { return mods; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   720
        public Name getName() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   721
        public JCTree getType() { return vartype; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   722
        public JCExpression getInitializer() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   723
            return init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   724
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   725
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   726
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   727
            return v.visitVariable(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   728
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   729
06bc494ca11e Initial load
duke
parents:
diff changeset
   730
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   731
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   732
            return VARDEF;
06bc494ca11e Initial load
duke
parents:
diff changeset
   733
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   734
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   735
06bc494ca11e Initial load
duke
parents:
diff changeset
   736
      /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   737
     * A no-op statement ";".
06bc494ca11e Initial load
duke
parents:
diff changeset
   738
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   739
    public static class JCSkip extends JCStatement implements EmptyStatementTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   740
        protected JCSkip() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   741
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   742
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   743
        public void accept(Visitor v) { v.visitSkip(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   744
06bc494ca11e Initial load
duke
parents:
diff changeset
   745
        public Kind getKind() { return Kind.EMPTY_STATEMENT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   746
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   747
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   748
            return v.visitEmptyStatement(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   749
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   750
06bc494ca11e Initial load
duke
parents:
diff changeset
   751
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   752
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   753
            return SKIP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   754
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   755
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   756
06bc494ca11e Initial load
duke
parents:
diff changeset
   757
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   758
     * A statement block.
06bc494ca11e Initial load
duke
parents:
diff changeset
   759
     * @param stats statements
06bc494ca11e Initial load
duke
parents:
diff changeset
   760
     * @param flags flags
06bc494ca11e Initial load
duke
parents:
diff changeset
   761
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   762
    public static class JCBlock extends JCStatement implements BlockTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   763
        public long flags;
06bc494ca11e Initial load
duke
parents:
diff changeset
   764
        public List<JCStatement> stats;
06bc494ca11e Initial load
duke
parents:
diff changeset
   765
        /** Position of closing brace, optional. */
06bc494ca11e Initial load
duke
parents:
diff changeset
   766
        public int endpos = Position.NOPOS;
06bc494ca11e Initial load
duke
parents:
diff changeset
   767
        protected JCBlock(long flags, List<JCStatement> stats) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   768
            this.stats = stats;
06bc494ca11e Initial load
duke
parents:
diff changeset
   769
            this.flags = flags;
06bc494ca11e Initial load
duke
parents:
diff changeset
   770
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   771
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   772
        public void accept(Visitor v) { v.visitBlock(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   773
06bc494ca11e Initial load
duke
parents:
diff changeset
   774
        public Kind getKind() { return Kind.BLOCK; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   775
        public List<JCStatement> getStatements() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   776
            return stats;
06bc494ca11e Initial load
duke
parents:
diff changeset
   777
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   778
        public boolean isStatic() { return (flags & Flags.STATIC) != 0; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   779
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   780
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   781
            return v.visitBlock(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   782
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   783
06bc494ca11e Initial load
duke
parents:
diff changeset
   784
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   785
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   786
            return BLOCK;
06bc494ca11e Initial load
duke
parents:
diff changeset
   787
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   788
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   789
06bc494ca11e Initial load
duke
parents:
diff changeset
   790
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   791
     * A do loop
06bc494ca11e Initial load
duke
parents:
diff changeset
   792
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   793
    public static class JCDoWhileLoop extends JCStatement implements DoWhileLoopTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   794
        public JCStatement body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   795
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   796
        protected JCDoWhileLoop(JCStatement body, JCExpression cond) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   797
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   798
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   799
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   800
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   801
        public void accept(Visitor v) { v.visitDoLoop(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   802
06bc494ca11e Initial load
duke
parents:
diff changeset
   803
        public Kind getKind() { return Kind.DO_WHILE_LOOP; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   804
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   805
        public JCStatement getStatement() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   806
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   807
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   808
            return v.visitDoWhileLoop(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   809
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   810
06bc494ca11e Initial load
duke
parents:
diff changeset
   811
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   812
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   813
            return DOLOOP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   814
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   815
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   816
06bc494ca11e Initial load
duke
parents:
diff changeset
   817
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   818
     * A while loop
06bc494ca11e Initial load
duke
parents:
diff changeset
   819
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   820
    public static class JCWhileLoop extends JCStatement implements WhileLoopTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   821
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   822
        public JCStatement body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   823
        protected JCWhileLoop(JCExpression cond, JCStatement body) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   824
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   825
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   826
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   827
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   828
        public void accept(Visitor v) { v.visitWhileLoop(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   829
06bc494ca11e Initial load
duke
parents:
diff changeset
   830
        public Kind getKind() { return Kind.WHILE_LOOP; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   831
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   832
        public JCStatement getStatement() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   833
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   834
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   835
            return v.visitWhileLoop(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   836
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   837
06bc494ca11e Initial load
duke
parents:
diff changeset
   838
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   839
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   840
            return WHILELOOP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   841
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   842
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   843
06bc494ca11e Initial load
duke
parents:
diff changeset
   844
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   845
     * A for loop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   846
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   847
    public static class JCForLoop extends JCStatement implements ForLoopTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   848
        public List<JCStatement> init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   849
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   850
        public List<JCExpressionStatement> step;
06bc494ca11e Initial load
duke
parents:
diff changeset
   851
        public JCStatement body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   852
        protected JCForLoop(List<JCStatement> init,
06bc494ca11e Initial load
duke
parents:
diff changeset
   853
                          JCExpression cond,
06bc494ca11e Initial load
duke
parents:
diff changeset
   854
                          List<JCExpressionStatement> update,
06bc494ca11e Initial load
duke
parents:
diff changeset
   855
                          JCStatement body)
06bc494ca11e Initial load
duke
parents:
diff changeset
   856
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
   857
            this.init = init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   858
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
   859
            this.step = update;
06bc494ca11e Initial load
duke
parents:
diff changeset
   860
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   861
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   862
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   863
        public void accept(Visitor v) { v.visitForLoop(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   864
06bc494ca11e Initial load
duke
parents:
diff changeset
   865
        public Kind getKind() { return Kind.FOR_LOOP; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   866
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   867
        public JCStatement getStatement() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   868
        public List<JCStatement> getInitializer() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   869
            return init;
06bc494ca11e Initial load
duke
parents:
diff changeset
   870
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   871
        public List<JCExpressionStatement> getUpdate() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   872
            return step;
06bc494ca11e Initial load
duke
parents:
diff changeset
   873
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   874
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   875
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   876
            return v.visitForLoop(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   877
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   878
06bc494ca11e Initial load
duke
parents:
diff changeset
   879
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   880
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   881
            return FORLOOP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   882
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   883
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   884
06bc494ca11e Initial load
duke
parents:
diff changeset
   885
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   886
     * The enhanced for loop.
06bc494ca11e Initial load
duke
parents:
diff changeset
   887
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   888
    public static class JCEnhancedForLoop extends JCStatement implements EnhancedForLoopTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   889
        public JCVariableDecl var;
06bc494ca11e Initial load
duke
parents:
diff changeset
   890
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   891
        public JCStatement body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   892
        protected JCEnhancedForLoop(JCVariableDecl var, JCExpression expr, JCStatement body) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   893
            this.var = var;
06bc494ca11e Initial load
duke
parents:
diff changeset
   894
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
   895
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   896
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   897
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   898
        public void accept(Visitor v) { v.visitForeachLoop(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   899
06bc494ca11e Initial load
duke
parents:
diff changeset
   900
        public Kind getKind() { return Kind.ENHANCED_FOR_LOOP; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   901
        public JCVariableDecl getVariable() { return var; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   902
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   903
        public JCStatement getStatement() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   904
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   905
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   906
            return v.visitEnhancedForLoop(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   907
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   908
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   909
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   910
            return FOREACHLOOP;
06bc494ca11e Initial load
duke
parents:
diff changeset
   911
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   912
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   913
06bc494ca11e Initial load
duke
parents:
diff changeset
   914
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   915
     * A labelled expression or statement.
06bc494ca11e Initial load
duke
parents:
diff changeset
   916
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   917
    public static class JCLabeledStatement extends JCStatement implements LabeledStatementTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   918
        public Name label;
06bc494ca11e Initial load
duke
parents:
diff changeset
   919
        public JCStatement body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   920
        protected JCLabeledStatement(Name label, JCStatement body) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   921
            this.label = label;
06bc494ca11e Initial load
duke
parents:
diff changeset
   922
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   923
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   924
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   925
        public void accept(Visitor v) { v.visitLabelled(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   926
        public Kind getKind() { return Kind.LABELED_STATEMENT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   927
        public Name getLabel() { return label; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   928
        public JCStatement getStatement() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   929
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   930
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   931
            return v.visitLabeledStatement(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   932
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   933
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   934
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   935
            return LABELLED;
06bc494ca11e Initial load
duke
parents:
diff changeset
   936
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   937
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   938
06bc494ca11e Initial load
duke
parents:
diff changeset
   939
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   940
     * A "switch ( ) { }" construction.
06bc494ca11e Initial load
duke
parents:
diff changeset
   941
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   942
    public static class JCSwitch extends JCStatement implements SwitchTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   943
        public JCExpression selector;
06bc494ca11e Initial load
duke
parents:
diff changeset
   944
        public List<JCCase> cases;
06bc494ca11e Initial load
duke
parents:
diff changeset
   945
        protected JCSwitch(JCExpression selector, List<JCCase> cases) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   946
            this.selector = selector;
06bc494ca11e Initial load
duke
parents:
diff changeset
   947
            this.cases = cases;
06bc494ca11e Initial load
duke
parents:
diff changeset
   948
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   949
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   950
        public void accept(Visitor v) { v.visitSwitch(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   951
06bc494ca11e Initial load
duke
parents:
diff changeset
   952
        public Kind getKind() { return Kind.SWITCH; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   953
        public JCExpression getExpression() { return selector; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   954
        public List<JCCase> getCases() { return cases; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   955
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   956
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   957
            return v.visitSwitch(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   958
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   959
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   960
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   961
            return SWITCH;
06bc494ca11e Initial load
duke
parents:
diff changeset
   962
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   963
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   964
06bc494ca11e Initial load
duke
parents:
diff changeset
   965
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   966
     * A "case  :" of a switch.
06bc494ca11e Initial load
duke
parents:
diff changeset
   967
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   968
    public static class JCCase extends JCStatement implements CaseTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   969
        public JCExpression pat;
06bc494ca11e Initial load
duke
parents:
diff changeset
   970
        public List<JCStatement> stats;
06bc494ca11e Initial load
duke
parents:
diff changeset
   971
        protected JCCase(JCExpression pat, List<JCStatement> stats) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   972
            this.pat = pat;
06bc494ca11e Initial load
duke
parents:
diff changeset
   973
            this.stats = stats;
06bc494ca11e Initial load
duke
parents:
diff changeset
   974
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   975
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   976
        public void accept(Visitor v) { v.visitCase(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
   977
06bc494ca11e Initial load
duke
parents:
diff changeset
   978
        public Kind getKind() { return Kind.CASE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   979
        public JCExpression getExpression() { return pat; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   980
        public List<JCStatement> getStatements() { return stats; }
06bc494ca11e Initial load
duke
parents:
diff changeset
   981
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   982
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   983
            return v.visitCase(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
   984
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   985
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
   986
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   987
            return CASE;
06bc494ca11e Initial load
duke
parents:
diff changeset
   988
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   989
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   990
06bc494ca11e Initial load
duke
parents:
diff changeset
   991
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   992
     * A synchronized block.
06bc494ca11e Initial load
duke
parents:
diff changeset
   993
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   994
    public static class JCSynchronized extends JCStatement implements SynchronizedTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
   995
        public JCExpression lock;
06bc494ca11e Initial load
duke
parents:
diff changeset
   996
        public JCBlock body;
06bc494ca11e Initial load
duke
parents:
diff changeset
   997
        protected JCSynchronized(JCExpression lock, JCBlock body) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   998
            this.lock = lock;
06bc494ca11e Initial load
duke
parents:
diff changeset
   999
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1000
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1001
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1002
        public void accept(Visitor v) { v.visitSynchronized(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1003
06bc494ca11e Initial load
duke
parents:
diff changeset
  1004
        public Kind getKind() { return Kind.SYNCHRONIZED; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1005
        public JCExpression getExpression() { return lock; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1006
        public JCBlock getBlock() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1007
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1008
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1009
            return v.visitSynchronized(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1010
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1011
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1012
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1013
            return SYNCHRONIZED;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1014
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1015
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1016
06bc494ca11e Initial load
duke
parents:
diff changeset
  1017
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1018
     * A "try { } catch ( ) { } finally { }" block.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1019
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1020
    public static class JCTry extends JCStatement implements TryTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1021
        public JCBlock body;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1022
        public List<JCCatch> catchers;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1023
        public JCBlock finalizer;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1024
        protected JCTry(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1025
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1026
            this.catchers = catchers;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1027
            this.finalizer = finalizer;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1028
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1029
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1030
        public void accept(Visitor v) { v.visitTry(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1031
06bc494ca11e Initial load
duke
parents:
diff changeset
  1032
        public Kind getKind() { return Kind.TRY; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1033
        public JCBlock getBlock() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1034
        public List<JCCatch> getCatches() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1035
            return catchers;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1036
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1037
        public JCBlock getFinallyBlock() { return finalizer; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1038
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1039
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1040
            return v.visitTry(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1041
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1042
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1043
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1044
            return TRY;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1045
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1046
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1047
06bc494ca11e Initial load
duke
parents:
diff changeset
  1048
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1049
     * A catch block.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1050
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1051
    public static class JCCatch extends JCTree implements CatchTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1052
        public JCVariableDecl param;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1053
        public JCBlock body;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1054
        protected JCCatch(JCVariableDecl param, JCBlock body) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1055
            this.param = param;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1056
            this.body = body;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1057
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1058
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1059
        public void accept(Visitor v) { v.visitCatch(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1060
06bc494ca11e Initial load
duke
parents:
diff changeset
  1061
        public Kind getKind() { return Kind.CATCH; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1062
        public JCVariableDecl getParameter() { return param; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1063
        public JCBlock getBlock() { return body; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1064
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1065
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1066
            return v.visitCatch(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1067
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1068
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1069
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1070
            return CATCH;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1071
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1072
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1073
06bc494ca11e Initial load
duke
parents:
diff changeset
  1074
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1075
     * A ( ) ? ( ) : ( ) conditional expression
06bc494ca11e Initial load
duke
parents:
diff changeset
  1076
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1077
    public static class JCConditional extends JCExpression implements ConditionalExpressionTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1078
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1079
        public JCExpression truepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1080
        public JCExpression falsepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1081
        protected JCConditional(JCExpression cond,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1082
                              JCExpression truepart,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1083
                              JCExpression falsepart)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1084
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1085
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1086
            this.truepart = truepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1087
            this.falsepart = falsepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1088
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1089
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1090
        public void accept(Visitor v) { v.visitConditional(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1091
06bc494ca11e Initial load
duke
parents:
diff changeset
  1092
        public Kind getKind() { return Kind.CONDITIONAL_EXPRESSION; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1093
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1094
        public JCExpression getTrueExpression() { return truepart; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1095
        public JCExpression getFalseExpression() { return falsepart; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1096
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1097
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1098
            return v.visitConditionalExpression(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1099
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1100
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1101
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1102
            return CONDEXPR;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1103
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1104
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1105
06bc494ca11e Initial load
duke
parents:
diff changeset
  1106
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1107
     * An "if ( ) { } else { }" block
06bc494ca11e Initial load
duke
parents:
diff changeset
  1108
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1109
    public static class JCIf extends JCStatement implements IfTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1110
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1111
        public JCStatement thenpart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1112
        public JCStatement elsepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1113
        protected JCIf(JCExpression cond,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1114
                     JCStatement thenpart,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1115
                     JCStatement elsepart)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1116
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1117
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1118
            this.thenpart = thenpart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1119
            this.elsepart = elsepart;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1120
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1121
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1122
        public void accept(Visitor v) { v.visitIf(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1123
06bc494ca11e Initial load
duke
parents:
diff changeset
  1124
        public Kind getKind() { return Kind.IF; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1125
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1126
        public JCStatement getThenStatement() { return thenpart; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1127
        public JCStatement getElseStatement() { return elsepart; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1128
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1129
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1130
            return v.visitIf(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1131
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1132
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1133
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1134
            return IF;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1135
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1136
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1137
06bc494ca11e Initial load
duke
parents:
diff changeset
  1138
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1139
     * an expression statement
06bc494ca11e Initial load
duke
parents:
diff changeset
  1140
     * @param expr expression structure
06bc494ca11e Initial load
duke
parents:
diff changeset
  1141
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1142
    public static class JCExpressionStatement extends JCStatement implements ExpressionStatementTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1143
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1144
        protected JCExpressionStatement(JCExpression expr)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1145
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1146
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1147
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1148
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1149
        public void accept(Visitor v) { v.visitExec(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1150
06bc494ca11e Initial load
duke
parents:
diff changeset
  1151
        public Kind getKind() { return Kind.EXPRESSION_STATEMENT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1152
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1153
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1154
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1155
            return v.visitExpressionStatement(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1156
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1157
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1158
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1159
            return EXEC;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1160
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1161
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1162
06bc494ca11e Initial load
duke
parents:
diff changeset
  1163
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1164
     * A break from a loop or switch.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1165
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1166
    public static class JCBreak extends JCStatement implements BreakTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1167
        public Name label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1168
        public JCTree target;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1169
        protected JCBreak(Name label, JCTree target) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1170
            this.label = label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1171
            this.target = target;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1172
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1173
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1174
        public void accept(Visitor v) { v.visitBreak(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1175
06bc494ca11e Initial load
duke
parents:
diff changeset
  1176
        public Kind getKind() { return Kind.BREAK; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1177
        public Name getLabel() { return label; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1178
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1179
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1180
            return v.visitBreak(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1181
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1182
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1183
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1184
            return BREAK;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1185
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1186
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1187
06bc494ca11e Initial load
duke
parents:
diff changeset
  1188
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1189
     * A continue of a loop.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1190
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1191
    public static class JCContinue extends JCStatement implements ContinueTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1192
        public Name label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1193
        public JCTree target;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1194
        protected JCContinue(Name label, JCTree target) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1195
            this.label = label;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1196
            this.target = target;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1197
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1198
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1199
        public void accept(Visitor v) { v.visitContinue(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1200
06bc494ca11e Initial load
duke
parents:
diff changeset
  1201
        public Kind getKind() { return Kind.CONTINUE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1202
        public Name getLabel() { return label; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1203
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1204
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1205
            return v.visitContinue(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1206
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1207
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1208
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1209
            return CONTINUE;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1210
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1211
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1212
06bc494ca11e Initial load
duke
parents:
diff changeset
  1213
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1214
     * A return statement.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1215
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1216
    public static class JCReturn extends JCStatement implements ReturnTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1217
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1218
        protected JCReturn(JCExpression expr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1219
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1220
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1221
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1222
        public void accept(Visitor v) { v.visitReturn(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1223
06bc494ca11e Initial load
duke
parents:
diff changeset
  1224
        public Kind getKind() { return Kind.RETURN; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1225
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1226
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1227
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1228
            return v.visitReturn(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1229
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1230
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1231
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1232
            return RETURN;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1233
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1234
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1235
06bc494ca11e Initial load
duke
parents:
diff changeset
  1236
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1237
     * A throw statement.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1238
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1239
    public static class JCThrow extends JCStatement implements ThrowTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1240
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1241
        protected JCThrow(JCTree expr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1242
            this.expr = (JCExpression)expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1243
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1244
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1245
        public void accept(Visitor v) { v.visitThrow(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1246
06bc494ca11e Initial load
duke
parents:
diff changeset
  1247
        public Kind getKind() { return Kind.THROW; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1248
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1249
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1250
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1251
            return v.visitThrow(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1252
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1253
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1254
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1255
            return THROW;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1256
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1257
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1258
06bc494ca11e Initial load
duke
parents:
diff changeset
  1259
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1260
     * An assert statement.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1261
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1262
    public static class JCAssert extends JCStatement implements AssertTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1263
        public JCExpression cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1264
        public JCExpression detail;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1265
        protected JCAssert(JCExpression cond, JCExpression detail) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1266
            this.cond = cond;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1267
            this.detail = detail;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1268
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1269
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1270
        public void accept(Visitor v) { v.visitAssert(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1271
06bc494ca11e Initial load
duke
parents:
diff changeset
  1272
        public Kind getKind() { return Kind.ASSERT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1273
        public JCExpression getCondition() { return cond; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1274
        public JCExpression getDetail() { return detail; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1275
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1276
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1277
            return v.visitAssert(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1278
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1279
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1280
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1281
            return ASSERT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1282
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1283
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1284
06bc494ca11e Initial load
duke
parents:
diff changeset
  1285
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1286
     * A method invocation
06bc494ca11e Initial load
duke
parents:
diff changeset
  1287
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1288
    public static class JCMethodInvocation extends JCExpression implements MethodInvocationTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1289
        public List<JCExpression> typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1290
        public JCExpression meth;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1291
        public List<JCExpression> args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1292
        public Type varargsElement;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1293
        protected JCMethodInvocation(List<JCExpression> typeargs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1294
                        JCExpression meth,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1295
                        List<JCExpression> args)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1296
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1297
            this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
06bc494ca11e Initial load
duke
parents:
diff changeset
  1298
                                               : typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1299
            this.meth = meth;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1300
            this.args = args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1301
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1302
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1303
        public void accept(Visitor v) { v.visitApply(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1304
06bc494ca11e Initial load
duke
parents:
diff changeset
  1305
        public Kind getKind() { return Kind.METHOD_INVOCATION; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1306
        public List<JCExpression> getTypeArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1307
            return typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1308
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1309
        public JCExpression getMethodSelect() { return meth; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1310
        public List<JCExpression> getArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1311
            return args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1312
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1313
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1314
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1315
            return v.visitMethodInvocation(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1316
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1317
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1318
        public JCMethodInvocation setType(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1319
            super.setType(type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1320
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1321
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1322
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1323
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1324
            return(APPLY);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1325
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1326
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1327
06bc494ca11e Initial load
duke
parents:
diff changeset
  1328
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1329
     * A new(...) operation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1330
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1331
    public static class JCNewClass extends JCExpression implements NewClassTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1332
        public JCExpression encl;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1333
        public List<JCExpression> typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1334
        public JCExpression clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1335
        public List<JCExpression> args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1336
        public JCClassDecl def;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1337
        public Symbol constructor;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1338
        public Type varargsElement;
1791
d378f023c36d 6723444: javac fails to substitute type variables into a constructor's throws clause
mcimadamore
parents: 1264
diff changeset
  1339
        public Type constructorType;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1340
        protected JCNewClass(JCExpression encl,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1341
                           List<JCExpression> typeargs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1342
                           JCExpression clazz,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1343
                           List<JCExpression> args,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1344
                           JCClassDecl def)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1345
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1346
            this.encl = encl;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1347
            this.typeargs = (typeargs == null) ? List.<JCExpression>nil()
06bc494ca11e Initial load
duke
parents:
diff changeset
  1348
                                               : typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1349
            this.clazz = clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1350
            this.args = args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1351
            this.def = def;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1352
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1353
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1354
        public void accept(Visitor v) { v.visitNewClass(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1355
06bc494ca11e Initial load
duke
parents:
diff changeset
  1356
        public Kind getKind() { return Kind.NEW_CLASS; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1357
        public JCExpression getEnclosingExpression() { // expr.new C< ... > ( ... )
06bc494ca11e Initial load
duke
parents:
diff changeset
  1358
            return encl;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1359
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1360
        public List<JCExpression> getTypeArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1361
            return typeargs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1362
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1363
        public JCExpression getIdentifier() { return clazz; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1364
        public List<JCExpression> getArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1365
            return args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1366
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1367
        public JCClassDecl getClassBody() { return def; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1368
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1369
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1370
            return v.visitNewClass(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1371
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1372
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1373
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1374
            return NEWCLASS;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1375
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1376
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1377
06bc494ca11e Initial load
duke
parents:
diff changeset
  1378
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1379
     * A new[...] operation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1380
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1381
    public static class JCNewArray extends JCExpression implements NewArrayTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1382
        public JCExpression elemtype;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1383
        public List<JCExpression> dims;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1384
        public List<JCTypeAnnotation> annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1385
        public List<List<JCTypeAnnotation>> dimAnnotations;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1386
        public List<JCExpression> elems;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1387
        protected JCNewArray(JCExpression elemtype,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1388
                           List<JCExpression> dims,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1389
                           List<JCExpression> elems)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1390
        {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1391
            this.elemtype = elemtype;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1392
            this.dims = dims;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1393
            this.annotations = List.nil();
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1394
            this.dimAnnotations = List.nil();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1395
            this.elems = elems;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1396
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1397
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1398
        public void accept(Visitor v) { v.visitNewArray(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1399
06bc494ca11e Initial load
duke
parents:
diff changeset
  1400
        public Kind getKind() { return Kind.NEW_ARRAY; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1401
        public JCExpression getType() { return elemtype; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1402
        public List<JCExpression> getDimensions() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1403
            return dims;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1404
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1405
        public List<JCExpression> getInitializers() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1406
            return elems;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1407
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1408
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1409
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1410
            return v.visitNewArray(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1411
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1412
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1413
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1414
            return NEWARRAY;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1415
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1416
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1417
06bc494ca11e Initial load
duke
parents:
diff changeset
  1418
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1419
     * A parenthesized subexpression ( ... )
06bc494ca11e Initial load
duke
parents:
diff changeset
  1420
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1421
    public static class JCParens extends JCExpression implements ParenthesizedTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1422
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1423
        protected JCParens(JCExpression expr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1424
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1425
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1426
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1427
        public void accept(Visitor v) { v.visitParens(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1428
06bc494ca11e Initial load
duke
parents:
diff changeset
  1429
        public Kind getKind() { return Kind.PARENTHESIZED; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1430
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1431
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1432
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1433
            return v.visitParenthesized(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1434
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1435
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1436
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1437
            return PARENS;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1438
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1439
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1440
06bc494ca11e Initial load
duke
parents:
diff changeset
  1441
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1442
     * A assignment with "=".
06bc494ca11e Initial load
duke
parents:
diff changeset
  1443
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1444
    public static class JCAssign extends JCExpression implements AssignmentTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1445
        public JCExpression lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1446
        public JCExpression rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1447
        protected JCAssign(JCExpression lhs, JCExpression rhs) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1448
            this.lhs = lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1449
            this.rhs = rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1450
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1451
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1452
        public void accept(Visitor v) { v.visitAssign(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1453
06bc494ca11e Initial load
duke
parents:
diff changeset
  1454
        public Kind getKind() { return Kind.ASSIGNMENT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1455
        public JCExpression getVariable() { return lhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1456
        public JCExpression getExpression() { return rhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1457
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1458
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1459
            return v.visitAssignment(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1460
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1461
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1462
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1463
            return ASSIGN;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1464
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1465
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1466
06bc494ca11e Initial load
duke
parents:
diff changeset
  1467
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1468
     * An assignment with "+=", "|=" ...
06bc494ca11e Initial load
duke
parents:
diff changeset
  1469
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1470
    public static class JCAssignOp extends JCExpression implements CompoundAssignmentTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1471
        private int opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1472
        public JCExpression lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1473
        public JCExpression rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1474
        public Symbol operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1475
        protected JCAssignOp(int opcode, JCTree lhs, JCTree rhs, Symbol operator) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1476
            this.opcode = opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1477
            this.lhs = (JCExpression)lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1478
            this.rhs = (JCExpression)rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1479
            this.operator = operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1480
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1481
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1482
        public void accept(Visitor v) { v.visitAssignop(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1483
06bc494ca11e Initial load
duke
parents:
diff changeset
  1484
        public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1485
        public JCExpression getVariable() { return lhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1486
        public JCExpression getExpression() { return rhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1487
        public Symbol getOperator() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1488
            return operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1489
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1490
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1491
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1492
            return v.visitCompoundAssignment(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1493
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1494
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1495
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1496
            return opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1497
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1498
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1499
06bc494ca11e Initial load
duke
parents:
diff changeset
  1500
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1501
     * A unary operation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1502
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1503
    public static class JCUnary extends JCExpression implements UnaryTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1504
        private int opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1505
        public JCExpression arg;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1506
        public Symbol operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1507
        protected JCUnary(int opcode, JCExpression arg) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1508
            this.opcode = opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1509
            this.arg = arg;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1510
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1511
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1512
        public void accept(Visitor v) { v.visitUnary(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1513
06bc494ca11e Initial load
duke
parents:
diff changeset
  1514
        public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1515
        public JCExpression getExpression() { return arg; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1516
        public Symbol getOperator() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1517
            return operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1518
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1519
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1520
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1521
            return v.visitUnary(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1522
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1523
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1524
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1525
            return opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1526
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1527
06bc494ca11e Initial load
duke
parents:
diff changeset
  1528
        public void setTag(int tag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1529
            opcode = tag;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1530
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1531
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1532
06bc494ca11e Initial load
duke
parents:
diff changeset
  1533
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1534
     * A binary operation.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1535
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1536
    public static class JCBinary extends JCExpression implements BinaryTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1537
        private int opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1538
        public JCExpression lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1539
        public JCExpression rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1540
        public Symbol operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1541
        protected JCBinary(int opcode,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1542
                         JCExpression lhs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1543
                         JCExpression rhs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  1544
                         Symbol operator) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1545
            this.opcode = opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1546
            this.lhs = lhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1547
            this.rhs = rhs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1548
            this.operator = operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1549
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1550
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1551
        public void accept(Visitor v) { v.visitBinary(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1552
06bc494ca11e Initial load
duke
parents:
diff changeset
  1553
        public Kind getKind() { return TreeInfo.tagToKind(getTag()); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1554
        public JCExpression getLeftOperand() { return lhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1555
        public JCExpression getRightOperand() { return rhs; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1556
        public Symbol getOperator() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1557
            return operator;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1558
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1559
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1560
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1561
            return v.visitBinary(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1562
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1563
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1564
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1565
            return opcode;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1566
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1567
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1568
06bc494ca11e Initial load
duke
parents:
diff changeset
  1569
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1570
     * A type cast.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1571
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1572
    public static class JCTypeCast extends JCExpression implements TypeCastTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1573
        public JCTree clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1574
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1575
        protected JCTypeCast(JCTree clazz, JCExpression expr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1576
            this.clazz = clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1577
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1578
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1579
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1580
        public void accept(Visitor v) { v.visitTypeCast(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1581
06bc494ca11e Initial load
duke
parents:
diff changeset
  1582
        public Kind getKind() { return Kind.TYPE_CAST; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1583
        public JCTree getType() { return clazz; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1584
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1585
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1586
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1587
            return v.visitTypeCast(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1588
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1589
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1590
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1591
            return TYPECAST;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1592
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1593
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1594
06bc494ca11e Initial load
duke
parents:
diff changeset
  1595
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1596
     * A type test.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1597
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1598
    public static class JCInstanceOf extends JCExpression implements InstanceOfTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1599
        public JCExpression expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1600
        public JCTree clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1601
        protected JCInstanceOf(JCExpression expr, JCTree clazz) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1602
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1603
            this.clazz = clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1604
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1605
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1606
        public void accept(Visitor v) { v.visitTypeTest(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1607
06bc494ca11e Initial load
duke
parents:
diff changeset
  1608
        public Kind getKind() { return Kind.INSTANCE_OF; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1609
        public JCTree getType() { return clazz; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1610
        public JCExpression getExpression() { return expr; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1611
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1612
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1613
            return v.visitInstanceOf(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1614
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1615
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1616
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1617
            return TYPETEST;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1618
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1619
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1620
06bc494ca11e Initial load
duke
parents:
diff changeset
  1621
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1622
     * An array selection
06bc494ca11e Initial load
duke
parents:
diff changeset
  1623
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1624
    public static class JCArrayAccess extends JCExpression implements ArrayAccessTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1625
        public JCExpression indexed;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1626
        public JCExpression index;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1627
        protected JCArrayAccess(JCExpression indexed, JCExpression index) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1628
            this.indexed = indexed;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1629
            this.index = index;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1630
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1631
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1632
        public void accept(Visitor v) { v.visitIndexed(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1633
06bc494ca11e Initial load
duke
parents:
diff changeset
  1634
        public Kind getKind() { return Kind.ARRAY_ACCESS; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1635
        public JCExpression getExpression() { return indexed; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1636
        public JCExpression getIndex() { return index; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1637
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1638
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1639
            return v.visitArrayAccess(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1640
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1641
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1642
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1643
            return INDEXED;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1644
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1645
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1646
06bc494ca11e Initial load
duke
parents:
diff changeset
  1647
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1648
     * Selects through packages and classes
06bc494ca11e Initial load
duke
parents:
diff changeset
  1649
     * @param selected selected Tree hierarchie
06bc494ca11e Initial load
duke
parents:
diff changeset
  1650
     * @param selector name of field to select thru
06bc494ca11e Initial load
duke
parents:
diff changeset
  1651
     * @param sym symbol of the selected class
06bc494ca11e Initial load
duke
parents:
diff changeset
  1652
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1653
    public static class JCFieldAccess extends JCExpression implements MemberSelectTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1654
        public JCExpression selected;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1655
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1656
        public Symbol sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1657
        protected JCFieldAccess(JCExpression selected, Name name, Symbol sym) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1658
            this.selected = selected;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1659
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1660
            this.sym = sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1661
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1662
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1663
        public void accept(Visitor v) { v.visitSelect(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1664
06bc494ca11e Initial load
duke
parents:
diff changeset
  1665
        public Kind getKind() { return Kind.MEMBER_SELECT; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1666
        public JCExpression getExpression() { return selected; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1667
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1668
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1669
            return v.visitMemberSelect(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1670
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1671
        public Name getIdentifier() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1672
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1673
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1674
            return SELECT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1675
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1676
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1677
06bc494ca11e Initial load
duke
parents:
diff changeset
  1678
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1679
     * An identifier
06bc494ca11e Initial load
duke
parents:
diff changeset
  1680
     * @param idname the name
06bc494ca11e Initial load
duke
parents:
diff changeset
  1681
     * @param sym the symbol
06bc494ca11e Initial load
duke
parents:
diff changeset
  1682
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1683
    public static class JCIdent extends JCExpression implements IdentifierTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1684
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1685
        public Symbol sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1686
        protected JCIdent(Name name, Symbol sym) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1687
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1688
            this.sym = sym;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1689
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1690
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1691
        public void accept(Visitor v) { v.visitIdent(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1692
06bc494ca11e Initial load
duke
parents:
diff changeset
  1693
        public Kind getKind() { return Kind.IDENTIFIER; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1694
        public Name getName() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1695
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1696
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1697
            return v.visitIdentifier(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1698
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1699
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1700
            return IDENT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1701
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1702
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1703
06bc494ca11e Initial load
duke
parents:
diff changeset
  1704
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1705
     * A constant value given literally.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1706
     * @param value value representation
06bc494ca11e Initial load
duke
parents:
diff changeset
  1707
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1708
    public static class JCLiteral extends JCExpression implements LiteralTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1709
        public int typetag;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1710
        public Object value;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1711
        protected JCLiteral(int typetag, Object value) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1712
            this.typetag = typetag;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1713
            this.value = value;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1714
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1715
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1716
        public void accept(Visitor v) { v.visitLiteral(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1717
06bc494ca11e Initial load
duke
parents:
diff changeset
  1718
        public Kind getKind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1719
            switch (typetag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1720
            case TypeTags.INT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1721
                return Kind.INT_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1722
            case TypeTags.LONG:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1723
                return Kind.LONG_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1724
            case TypeTags.FLOAT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1725
                return Kind.FLOAT_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1726
            case TypeTags.DOUBLE:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1727
                return Kind.DOUBLE_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1728
            case TypeTags.BOOLEAN:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1729
                return Kind.BOOLEAN_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1730
            case TypeTags.CHAR:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1731
                return Kind.CHAR_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1732
            case TypeTags.CLASS:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1733
                return Kind.STRING_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1734
            case TypeTags.BOT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1735
                return Kind.NULL_LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1736
            default:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1737
                throw new AssertionError("unknown literal kind " + this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1738
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1739
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1740
        public Object getValue() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1741
            switch (typetag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1742
                case TypeTags.BOOLEAN:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1743
                    int bi = (Integer) value;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1744
                    return (bi != 0);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1745
                case TypeTags.CHAR:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1746
                    int ci = (Integer) value;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1747
                    char c = (char) ci;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1748
                    if (c != ci)
06bc494ca11e Initial load
duke
parents:
diff changeset
  1749
                        throw new AssertionError("bad value for char literal");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1750
                    return c;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1751
                default:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1752
                    return value;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1753
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1754
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1755
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1756
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1757
            return v.visitLiteral(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1758
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1759
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1760
        public JCLiteral setType(Type type) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1761
            super.setType(type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1762
            return this;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1763
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1764
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1765
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1766
            return LITERAL;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1767
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1768
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1769
06bc494ca11e Initial load
duke
parents:
diff changeset
  1770
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1771
     * Identifies a basic type.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1772
     * @param tag the basic type id
06bc494ca11e Initial load
duke
parents:
diff changeset
  1773
     * @see TypeTags
06bc494ca11e Initial load
duke
parents:
diff changeset
  1774
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1775
    public static class JCPrimitiveTypeTree extends JCExpression implements PrimitiveTypeTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1776
        public int typetag;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1777
        protected JCPrimitiveTypeTree(int typetag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1778
            this.typetag = typetag;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1779
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1780
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1781
        public void accept(Visitor v) { v.visitTypeIdent(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1782
06bc494ca11e Initial load
duke
parents:
diff changeset
  1783
        public Kind getKind() { return Kind.PRIMITIVE_TYPE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1784
        public TypeKind getPrimitiveTypeKind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1785
            switch (typetag) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1786
            case TypeTags.BOOLEAN:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1787
                return TypeKind.BOOLEAN;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1788
            case TypeTags.BYTE:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1789
                return TypeKind.BYTE;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1790
            case TypeTags.SHORT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1791
                return TypeKind.SHORT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1792
            case TypeTags.INT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1793
                return TypeKind.INT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1794
            case TypeTags.LONG:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1795
                return TypeKind.LONG;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1796
            case TypeTags.CHAR:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1797
                return TypeKind.CHAR;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1798
            case TypeTags.FLOAT:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1799
                return TypeKind.FLOAT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1800
            case TypeTags.DOUBLE:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1801
                return TypeKind.DOUBLE;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1802
            case TypeTags.VOID:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1803
                return TypeKind.VOID;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1804
            default:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1805
                throw new AssertionError("unknown primitive type " + this);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1806
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1807
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1808
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1809
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1810
            return v.visitPrimitiveType(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1811
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1812
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1813
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1814
            return TYPEIDENT;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1815
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1816
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1817
06bc494ca11e Initial load
duke
parents:
diff changeset
  1818
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1819
     * An array type, A[]
06bc494ca11e Initial load
duke
parents:
diff changeset
  1820
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1821
    public static class JCArrayTypeTree extends JCExpression implements ArrayTypeTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1822
        public JCExpression elemtype;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1823
        protected JCArrayTypeTree(JCExpression elemtype) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1824
            this.elemtype = elemtype;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1825
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1826
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1827
        public void accept(Visitor v) { v.visitTypeArray(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1828
06bc494ca11e Initial load
duke
parents:
diff changeset
  1829
        public Kind getKind() { return Kind.ARRAY_TYPE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1830
        public JCTree getType() { return elemtype; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1831
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1832
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1833
            return v.visitArrayType(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1834
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1835
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1836
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1837
            return TYPEARRAY;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1838
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1839
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1840
06bc494ca11e Initial load
duke
parents:
diff changeset
  1841
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
  1842
     * A parameterized type, T<...>
06bc494ca11e Initial load
duke
parents:
diff changeset
  1843
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1844
    public static class JCTypeApply extends JCExpression implements ParameterizedTypeTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1845
        public JCExpression clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1846
        public List<JCExpression> arguments;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1847
        protected JCTypeApply(JCExpression clazz, List<JCExpression> arguments) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1848
            this.clazz = clazz;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1849
            this.arguments = arguments;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1850
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1851
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1852
        public void accept(Visitor v) { v.visitTypeApply(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1853
06bc494ca11e Initial load
duke
parents:
diff changeset
  1854
        public Kind getKind() { return Kind.PARAMETERIZED_TYPE; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1855
        public JCTree getType() { return clazz; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1856
        public List<JCExpression> getTypeArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1857
            return arguments;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1858
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1859
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1860
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1861
            return v.visitParameterizedType(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1862
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1863
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1864
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1865
            return TYPEAPPLY;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1866
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1867
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1868
06bc494ca11e Initial load
duke
parents:
diff changeset
  1869
    /**
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1870
     * A disjoint type, T1 | T2 | ... Tn (used in multicatch statements)
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1871
     */
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1872
    public static class JCTypeDisjoint extends JCExpression implements DisjointTypeTree {
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1873
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1874
        public List<JCExpression> components;
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1875
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1876
        protected JCTypeDisjoint(List<JCExpression> components) {
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1877
            this.components = components;
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1878
        }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1879
        @Override
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1880
        public void accept(Visitor v) { v.visitTypeDisjoint(this); }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1881
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1882
        public Kind getKind() { return Kind.DISJOINT_TYPE; }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1883
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1884
        public List<JCExpression> getTypeComponents() {
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1885
            return components;
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1886
        }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1887
        @Override
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1888
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1889
            return v.visitDisjointType(this, d);
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1890
        }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1891
        @Override
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1892
        public int getTag() {
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1893
            return TYPEDISJOINT;
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1894
        }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1895
    }
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1896
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  1897
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1898
     * A formal class parameter.
06bc494ca11e Initial load
duke
parents:
diff changeset
  1899
     * @param name name
06bc494ca11e Initial load
duke
parents:
diff changeset
  1900
     * @param bounds bounds
06bc494ca11e Initial load
duke
parents:
diff changeset
  1901
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  1902
    public static class JCTypeParameter extends JCTree implements TypeParameterTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1903
        public Name name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1904
        public List<JCExpression> bounds;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1905
        public List<JCTypeAnnotation> annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1906
        protected JCTypeParameter(Name name, List<JCExpression> bounds, List<JCTypeAnnotation> annotations) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1907
            this.name = name;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1908
            this.bounds = bounds;
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1909
            this.annotations = annotations;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1910
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1911
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1912
        public void accept(Visitor v) { v.visitTypeParameter(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1913
06bc494ca11e Initial load
duke
parents:
diff changeset
  1914
        public Kind getKind() { return Kind.TYPE_PARAMETER; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1915
        public Name getName() { return name; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1916
        public List<JCExpression> getBounds() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1917
            return bounds;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1918
        }
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1919
        public List<JCTypeAnnotation> getAnnotations() {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1920
            return annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  1921
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  1922
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1923
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1924
            return v.visitTypeParameter(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1925
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1926
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1927
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1928
            return TYPEPARAMETER;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1929
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1930
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1931
06bc494ca11e Initial load
duke
parents:
diff changeset
  1932
    public static class JCWildcard extends JCExpression implements WildcardTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1933
        public TypeBoundKind kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1934
        public JCTree inner;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1935
        protected JCWildcard(TypeBoundKind kind, JCTree inner) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1936
            kind.getClass(); // null-check
06bc494ca11e Initial load
duke
parents:
diff changeset
  1937
            this.kind = kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1938
            this.inner = inner;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1939
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1940
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1941
        public void accept(Visitor v) { v.visitWildcard(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1942
06bc494ca11e Initial load
duke
parents:
diff changeset
  1943
        public Kind getKind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1944
            switch (kind.kind) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1945
            case UNBOUND:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1946
                return Kind.UNBOUNDED_WILDCARD;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1947
            case EXTENDS:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1948
                return Kind.EXTENDS_WILDCARD;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1949
            case SUPER:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1950
                return Kind.SUPER_WILDCARD;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1951
            default:
06bc494ca11e Initial load
duke
parents:
diff changeset
  1952
                throw new AssertionError("Unknown wildcard bound " + kind);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1953
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1954
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1955
        public JCTree getBound() { return inner; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1956
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1957
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1958
            return v.visitWildcard(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  1959
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1960
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1961
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1962
            return WILDCARD;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1963
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1964
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1965
06bc494ca11e Initial load
duke
parents:
diff changeset
  1966
    public static class TypeBoundKind extends JCTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1967
        public BoundKind kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1968
        protected TypeBoundKind(BoundKind kind) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1969
            this.kind = kind;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1970
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1971
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1972
        public void accept(Visitor v) { v.visitTypeBoundKind(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1973
06bc494ca11e Initial load
duke
parents:
diff changeset
  1974
        public Kind getKind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1975
            throw new AssertionError("TypeBoundKind is not part of a public API");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1976
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1977
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1978
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1979
            throw new AssertionError("TypeBoundKind is not part of a public API");
06bc494ca11e Initial load
duke
parents:
diff changeset
  1980
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1981
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1982
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1983
            return TYPEBOUNDKIND;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1984
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1985
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1986
06bc494ca11e Initial load
duke
parents:
diff changeset
  1987
    public static class JCAnnotation extends JCExpression implements AnnotationTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1988
        public JCTree annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1989
        public List<JCExpression> args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1990
        protected JCAnnotation(JCTree annotationType, List<JCExpression> args) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  1991
            this.annotationType = annotationType;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1992
            this.args = args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  1993
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1994
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  1995
        public void accept(Visitor v) { v.visitAnnotation(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1996
06bc494ca11e Initial load
duke
parents:
diff changeset
  1997
        public Kind getKind() { return Kind.ANNOTATION; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1998
        public JCTree getAnnotationType() { return annotationType; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  1999
        public List<JCExpression> getArguments() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2000
            return args;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2001
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2002
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2003
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2004
            return v.visitAnnotation(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2005
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2006
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2007
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2008
            return ANNOTATION;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2009
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2010
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2011
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2012
    public static class JCTypeAnnotation extends JCAnnotation {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2013
        public TypeAnnotationPosition annotation_position;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2014
        public Attribute.TypeCompound attribute_field;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2015
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2016
        protected JCTypeAnnotation(JCTree annotationType, List<JCExpression> args) {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2017
            super(annotationType, args);
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2018
            this.annotation_position = new TypeAnnotationPosition();
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2019
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2020
    }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2021
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2022
    public static class JCModifiers extends JCTree implements com.sun.source.tree.ModifiersTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2023
        public long flags;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2024
        public List<JCAnnotation> annotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2025
        protected JCModifiers(long flags, List<JCAnnotation> annotations) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2026
            this.flags = flags;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2027
            this.annotations = annotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2028
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2029
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2030
        public void accept(Visitor v) { v.visitModifiers(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2031
06bc494ca11e Initial load
duke
parents:
diff changeset
  2032
        public Kind getKind() { return Kind.MODIFIERS; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2033
        public Set<Modifier> getFlags() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2034
            return Flags.asModifierSet(flags);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2035
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2036
        public List<JCAnnotation> getAnnotations() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2037
            return annotations;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2038
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2039
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2040
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2041
            return v.visitModifiers(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2042
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2043
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2044
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2045
            return MODIFIERS;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2046
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2047
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2048
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2049
    public static class JCAnnotatedType extends JCExpression implements com.sun.source.tree.AnnotatedTypeTree {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2050
        public List<JCTypeAnnotation> annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2051
        public JCExpression underlyingType;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2052
        protected JCAnnotatedType(List<JCTypeAnnotation> annotations, JCExpression underlyingType) {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2053
            this.annotations = annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2054
            this.underlyingType = underlyingType;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2055
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2056
        @Override
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2057
        public void accept(Visitor v) { v.visitAnnotatedType(this); }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2058
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2059
        public Kind getKind() { return Kind.ANNOTATED_TYPE; }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2060
        public List<JCTypeAnnotation> getAnnotations() {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2061
            return annotations;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2062
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2063
        public JCExpression getUnderlyingType() {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2064
            return underlyingType;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2065
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2066
        @Override
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2067
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2068
            return v.visitAnnotatedType(this, d);
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2069
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2070
        @Override
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2071
        public int getTag() {
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2072
            return ANNOTATED_TYPE;
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2073
        }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2074
    }
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2075
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2076
    public static class JCErroneous extends JCExpression
06bc494ca11e Initial load
duke
parents:
diff changeset
  2077
            implements com.sun.source.tree.ErroneousTree {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2078
        public List<? extends JCTree> errs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2079
        protected JCErroneous(List<? extends JCTree> errs) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2080
            this.errs = errs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2081
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2082
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2083
        public void accept(Visitor v) { v.visitErroneous(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2084
06bc494ca11e Initial load
duke
parents:
diff changeset
  2085
        public Kind getKind() { return Kind.ERRONEOUS; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2086
06bc494ca11e Initial load
duke
parents:
diff changeset
  2087
        public List<? extends JCTree> getErrorTrees() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2088
            return errs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2089
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2090
06bc494ca11e Initial load
duke
parents:
diff changeset
  2091
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2092
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2093
            return v.visitErroneous(this, d);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2094
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2095
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2096
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2097
            return ERRONEOUS;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2098
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2099
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2100
06bc494ca11e Initial load
duke
parents:
diff changeset
  2101
    /** (let int x = 3; in x+2) */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2102
    public static class LetExpr extends JCExpression {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2103
        public List<JCVariableDecl> defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2104
        public JCTree expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2105
        protected LetExpr(List<JCVariableDecl> defs, JCTree expr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2106
            this.defs = defs;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2107
            this.expr = expr;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2108
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2109
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2110
        public void accept(Visitor v) { v.visitLetExpr(this); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2111
06bc494ca11e Initial load
duke
parents:
diff changeset
  2112
        public Kind getKind() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2113
            throw new AssertionError("LetExpr is not part of a public API");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2114
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2115
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2116
        public <R,D> R accept(TreeVisitor<R,D> v, D d) {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2117
            throw new AssertionError("LetExpr is not part of a public API");
06bc494ca11e Initial load
duke
parents:
diff changeset
  2118
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2119
        @Override
06bc494ca11e Initial load
duke
parents:
diff changeset
  2120
        public int getTag() {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2121
            return LETEXPR;
06bc494ca11e Initial load
duke
parents:
diff changeset
  2122
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2123
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2124
06bc494ca11e Initial load
duke
parents:
diff changeset
  2125
    /** An interface for tree factories
06bc494ca11e Initial load
duke
parents:
diff changeset
  2126
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2127
    public interface Factory {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2128
        JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2129
                                   JCExpression pid,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2130
                                   List<JCTree> defs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2131
        JCImport Import(JCTree qualid, boolean staticImport);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2132
        JCClassDecl ClassDef(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2133
                          Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2134
                          List<JCTypeParameter> typarams,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2135
                          JCTree extending,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2136
                          List<JCExpression> implementing,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2137
                          List<JCTree> defs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2138
        JCMethodDecl MethodDef(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2139
                            Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2140
                            JCExpression restype,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2141
                            List<JCTypeParameter> typarams,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2142
                            List<JCVariableDecl> params,
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2143
                            List<JCTypeAnnotation> receiver,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2144
                            List<JCExpression> thrown,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2145
                            JCBlock body,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2146
                            JCExpression defaultValue);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2147
        JCVariableDecl VarDef(JCModifiers mods,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2148
                      Name name,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2149
                      JCExpression vartype,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2150
                      JCExpression init);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2151
        JCSkip Skip();
06bc494ca11e Initial load
duke
parents:
diff changeset
  2152
        JCBlock Block(long flags, List<JCStatement> stats);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2153
        JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2154
        JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2155
        JCForLoop ForLoop(List<JCStatement> init,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2156
                        JCExpression cond,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2157
                        List<JCExpressionStatement> step,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2158
                        JCStatement body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2159
        JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2160
        JCLabeledStatement Labelled(Name label, JCStatement body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2161
        JCSwitch Switch(JCExpression selector, List<JCCase> cases);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2162
        JCCase Case(JCExpression pat, List<JCStatement> stats);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2163
        JCSynchronized Synchronized(JCExpression lock, JCBlock body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2164
        JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2165
        JCCatch Catch(JCVariableDecl param, JCBlock body);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2166
        JCConditional Conditional(JCExpression cond,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2167
                                JCExpression thenpart,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2168
                                JCExpression elsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2169
        JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2170
        JCExpressionStatement Exec(JCExpression expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2171
        JCBreak Break(Name label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2172
        JCContinue Continue(Name label);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2173
        JCReturn Return(JCExpression expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2174
        JCThrow Throw(JCTree expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2175
        JCAssert Assert(JCExpression cond, JCExpression detail);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2176
        JCMethodInvocation Apply(List<JCExpression> typeargs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2177
                    JCExpression fn,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2178
                    List<JCExpression> args);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2179
        JCNewClass NewClass(JCExpression encl,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2180
                          List<JCExpression> typeargs,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2181
                          JCExpression clazz,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2182
                          List<JCExpression> args,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2183
                          JCClassDecl def);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2184
        JCNewArray NewArray(JCExpression elemtype,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2185
                          List<JCExpression> dims,
06bc494ca11e Initial load
duke
parents:
diff changeset
  2186
                          List<JCExpression> elems);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2187
        JCParens Parens(JCExpression expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2188
        JCAssign Assign(JCExpression lhs, JCExpression rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2189
        JCAssignOp Assignop(int opcode, JCTree lhs, JCTree rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2190
        JCUnary Unary(int opcode, JCExpression arg);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2191
        JCBinary Binary(int opcode, JCExpression lhs, JCExpression rhs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2192
        JCTypeCast TypeCast(JCTree expr, JCExpression type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2193
        JCInstanceOf TypeTest(JCExpression expr, JCTree clazz);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2194
        JCArrayAccess Indexed(JCExpression indexed, JCExpression index);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2195
        JCFieldAccess Select(JCExpression selected, Name selector);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2196
        JCIdent Ident(Name idname);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2197
        JCLiteral Literal(int tag, Object value);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2198
        JCPrimitiveTypeTree TypeIdent(int typetag);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2199
        JCArrayTypeTree TypeArray(JCExpression elemtype);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2200
        JCTypeApply TypeApply(JCExpression clazz, List<JCExpression> arguments);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2201
        JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2202
        JCWildcard Wildcard(TypeBoundKind kind, JCTree type);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2203
        TypeBoundKind TypeBoundKind(BoundKind kind);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2204
        JCAnnotation Annotation(JCTree annotationType, List<JCExpression> args);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2205
        JCModifiers Modifiers(long flags, List<JCAnnotation> annotations);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2206
        JCErroneous Erroneous(List<? extends JCTree> errs);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2207
        LetExpr LetExpr(List<JCVariableDecl> defs, JCTree expr);
06bc494ca11e Initial load
duke
parents:
diff changeset
  2208
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2209
06bc494ca11e Initial load
duke
parents:
diff changeset
  2210
    /** A generic visitor class for trees.
06bc494ca11e Initial load
duke
parents:
diff changeset
  2211
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
  2212
    public static abstract class Visitor {
06bc494ca11e Initial load
duke
parents:
diff changeset
  2213
        public void visitTopLevel(JCCompilationUnit that)    { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2214
        public void visitImport(JCImport that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2215
        public void visitClassDef(JCClassDecl that)          { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2216
        public void visitMethodDef(JCMethodDecl that)        { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2217
        public void visitVarDef(JCVariableDecl that)         { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2218
        public void visitSkip(JCSkip that)                   { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2219
        public void visitBlock(JCBlock that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2220
        public void visitDoLoop(JCDoWhileLoop that)          { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2221
        public void visitWhileLoop(JCWhileLoop that)         { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2222
        public void visitForLoop(JCForLoop that)             { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2223
        public void visitForeachLoop(JCEnhancedForLoop that) { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2224
        public void visitLabelled(JCLabeledStatement that)   { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2225
        public void visitSwitch(JCSwitch that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2226
        public void visitCase(JCCase that)                   { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2227
        public void visitSynchronized(JCSynchronized that)   { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2228
        public void visitTry(JCTry that)                     { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2229
        public void visitCatch(JCCatch that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2230
        public void visitConditional(JCConditional that)     { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2231
        public void visitIf(JCIf that)                       { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2232
        public void visitExec(JCExpressionStatement that)    { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2233
        public void visitBreak(JCBreak that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2234
        public void visitContinue(JCContinue that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2235
        public void visitReturn(JCReturn that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2236
        public void visitThrow(JCThrow that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2237
        public void visitAssert(JCAssert that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2238
        public void visitApply(JCMethodInvocation that)      { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2239
        public void visitNewClass(JCNewClass that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2240
        public void visitNewArray(JCNewArray that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2241
        public void visitParens(JCParens that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2242
        public void visitAssign(JCAssign that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2243
        public void visitAssignop(JCAssignOp that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2244
        public void visitUnary(JCUnary that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2245
        public void visitBinary(JCBinary that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2246
        public void visitTypeCast(JCTypeCast that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2247
        public void visitTypeTest(JCInstanceOf that)         { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2248
        public void visitIndexed(JCArrayAccess that)         { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2249
        public void visitSelect(JCFieldAccess that)          { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2250
        public void visitIdent(JCIdent that)                 { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2251
        public void visitLiteral(JCLiteral that)             { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2252
        public void visitTypeIdent(JCPrimitiveTypeTree that) { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2253
        public void visitTypeArray(JCArrayTypeTree that)     { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2254
        public void visitTypeApply(JCTypeApply that)         { visitTree(that); }
5492
515e4b33b335 6943289: Project Coin: Improved Exception Handling for Java (aka 'multicatch')
mcimadamore
parents: 3149
diff changeset
  2255
        public void visitTypeDisjoint(JCTypeDisjoint that)   { visitTree(that); }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2256
        public void visitTypeParameter(JCTypeParameter that) { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2257
        public void visitWildcard(JCWildcard that)           { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2258
        public void visitTypeBoundKind(TypeBoundKind that)   { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2259
        public void visitAnnotation(JCAnnotation that)       { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2260
        public void visitModifiers(JCModifiers that)         { visitTree(that); }
3149
0cd06d598d6f 6843077: JSR 308: Annotations on types
jjg
parents: 2212
diff changeset
  2261
        public void visitAnnotatedType(JCAnnotatedType that) { visitTree(that); }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
  2262
        public void visitErroneous(JCErroneous that)         { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2263
        public void visitLetExpr(LetExpr that)               { visitTree(that); }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2264
06bc494ca11e Initial load
duke
parents:
diff changeset
  2265
        public void visitTree(JCTree that)                   { assert false; }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2266
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
  2267
06bc494ca11e Initial load
duke
parents:
diff changeset
  2268
}