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