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