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