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