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