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