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