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