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