Thu, 24 Nov 2011 13:36:20 +0000
7115046: Add AST node for lambda expressions
Summary: Add tree nodes for representing lambda expressions and update relevant visitors interfaces
Reviewed-by: jjg
duke@1 | 1 | /* |
jjg@815 | 2 | * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. |
duke@1 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@1 | 4 | * |
duke@1 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@1 | 6 | * under the terms of the GNU General Public License version 2 only, as |
ohair@554 | 7 | * published by the Free Software Foundation. Oracle designates this |
duke@1 | 8 | * particular file as subject to the "Classpath" exception as provided |
ohair@554 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
duke@1 | 10 | * |
duke@1 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@1 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@1 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@1 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@1 | 15 | * accompanied this code). |
duke@1 | 16 | * |
duke@1 | 17 | * You should have received a copy of the GNU General Public License version |
duke@1 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@1 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@1 | 20 | * |
ohair@554 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
ohair@554 | 22 | * or visit www.oracle.com if you need additional information or have any |
ohair@554 | 23 | * questions. |
duke@1 | 24 | */ |
duke@1 | 25 | |
duke@1 | 26 | package com.sun.source.tree; |
duke@1 | 27 | |
duke@1 | 28 | /** |
duke@1 | 29 | * Common interface for all nodes in an abstract syntax tree. |
duke@1 | 30 | * |
duke@1 | 31 | * <p><b>WARNING:</b> This interface and its sub-interfaces are |
duke@1 | 32 | * subject to change as the Java™ programming language evolves. |
jjg@582 | 33 | * These interfaces are implemented by the JDK Java compiler (javac) |
duke@1 | 34 | * and should not be implemented either directly or indirectly by |
duke@1 | 35 | * other applications. |
duke@1 | 36 | * |
duke@1 | 37 | * @author Peter von der Ahé |
duke@1 | 38 | * @author Jonathan Gibbons |
duke@1 | 39 | * |
duke@1 | 40 | * @since 1.6 |
duke@1 | 41 | */ |
duke@1 | 42 | public interface Tree { |
duke@1 | 43 | |
duke@1 | 44 | /** |
duke@1 | 45 | * Enumerates all kinds of trees. |
duke@1 | 46 | */ |
duke@1 | 47 | public enum Kind { |
jjg@308 | 48 | |
duke@1 | 49 | /** |
duke@1 | 50 | * Used for instances of {@link AnnotationTree}. |
duke@1 | 51 | */ |
duke@1 | 52 | ANNOTATION(AnnotationTree.class), |
duke@1 | 53 | |
duke@1 | 54 | /** |
duke@1 | 55 | * Used for instances of {@link ArrayAccessTree}. |
duke@1 | 56 | */ |
duke@1 | 57 | ARRAY_ACCESS(ArrayAccessTree.class), |
duke@1 | 58 | |
duke@1 | 59 | /** |
duke@1 | 60 | * Used for instances of {@link ArrayTypeTree}. |
duke@1 | 61 | */ |
duke@1 | 62 | ARRAY_TYPE(ArrayTypeTree.class), |
duke@1 | 63 | |
duke@1 | 64 | /** |
duke@1 | 65 | * Used for instances of {@link AssertTree}. |
duke@1 | 66 | */ |
duke@1 | 67 | ASSERT(AssertTree.class), |
duke@1 | 68 | |
duke@1 | 69 | /** |
duke@1 | 70 | * Used for instances of {@link AssignmentTree}. |
duke@1 | 71 | */ |
duke@1 | 72 | ASSIGNMENT(AssignmentTree.class), |
duke@1 | 73 | |
duke@1 | 74 | /** |
duke@1 | 75 | * Used for instances of {@link BlockTree}. |
duke@1 | 76 | */ |
duke@1 | 77 | BLOCK(BlockTree.class), |
duke@1 | 78 | |
duke@1 | 79 | /** |
duke@1 | 80 | * Used for instances of {@link BreakTree}. |
duke@1 | 81 | */ |
duke@1 | 82 | BREAK(BreakTree.class), |
duke@1 | 83 | |
duke@1 | 84 | /** |
duke@1 | 85 | * Used for instances of {@link CaseTree}. |
duke@1 | 86 | */ |
duke@1 | 87 | CASE(CaseTree.class), |
duke@1 | 88 | |
duke@1 | 89 | /** |
duke@1 | 90 | * Used for instances of {@link CatchTree}. |
duke@1 | 91 | */ |
duke@1 | 92 | CATCH(CatchTree.class), |
duke@1 | 93 | |
duke@1 | 94 | /** |
jjg@662 | 95 | * Used for instances of {@link ClassTree} representing classes. |
duke@1 | 96 | */ |
duke@1 | 97 | CLASS(ClassTree.class), |
duke@1 | 98 | |
duke@1 | 99 | /** |
duke@1 | 100 | * Used for instances of {@link CompilationUnitTree}. |
duke@1 | 101 | */ |
duke@1 | 102 | COMPILATION_UNIT(CompilationUnitTree.class), |
duke@1 | 103 | |
duke@1 | 104 | /** |
duke@1 | 105 | * Used for instances of {@link ConditionalExpressionTree}. |
duke@1 | 106 | */ |
duke@1 | 107 | CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class), |
duke@1 | 108 | |
duke@1 | 109 | /** |
duke@1 | 110 | * Used for instances of {@link ContinueTree}. |
duke@1 | 111 | */ |
duke@1 | 112 | CONTINUE(ContinueTree.class), |
duke@1 | 113 | |
duke@1 | 114 | /** |
duke@1 | 115 | * Used for instances of {@link DoWhileLoopTree}. |
duke@1 | 116 | */ |
duke@1 | 117 | DO_WHILE_LOOP(DoWhileLoopTree.class), |
duke@1 | 118 | |
duke@1 | 119 | /** |
duke@1 | 120 | * Used for instances of {@link EnhancedForLoopTree}. |
duke@1 | 121 | */ |
duke@1 | 122 | ENHANCED_FOR_LOOP(EnhancedForLoopTree.class), |
duke@1 | 123 | |
duke@1 | 124 | /** |
duke@1 | 125 | * Used for instances of {@link ExpressionStatementTree}. |
duke@1 | 126 | */ |
duke@1 | 127 | EXPRESSION_STATEMENT(ExpressionStatementTree.class), |
duke@1 | 128 | |
duke@1 | 129 | /** |
duke@1 | 130 | * Used for instances of {@link MemberSelectTree}. |
duke@1 | 131 | */ |
duke@1 | 132 | MEMBER_SELECT(MemberSelectTree.class), |
duke@1 | 133 | |
duke@1 | 134 | /** |
duke@1 | 135 | * Used for instances of {@link ForLoopTree}. |
duke@1 | 136 | */ |
duke@1 | 137 | FOR_LOOP(ForLoopTree.class), |
duke@1 | 138 | |
duke@1 | 139 | /** |
duke@1 | 140 | * Used for instances of {@link IdentifierTree}. |
duke@1 | 141 | */ |
duke@1 | 142 | IDENTIFIER(IdentifierTree.class), |
duke@1 | 143 | |
duke@1 | 144 | /** |
duke@1 | 145 | * Used for instances of {@link IfTree}. |
duke@1 | 146 | */ |
duke@1 | 147 | IF(IfTree.class), |
duke@1 | 148 | |
duke@1 | 149 | /** |
duke@1 | 150 | * Used for instances of {@link ImportTree}. |
duke@1 | 151 | */ |
duke@1 | 152 | IMPORT(ImportTree.class), |
duke@1 | 153 | |
duke@1 | 154 | /** |
duke@1 | 155 | * Used for instances of {@link InstanceOfTree}. |
duke@1 | 156 | */ |
duke@1 | 157 | INSTANCE_OF(InstanceOfTree.class), |
duke@1 | 158 | |
duke@1 | 159 | /** |
duke@1 | 160 | * Used for instances of {@link LabeledStatementTree}. |
duke@1 | 161 | */ |
duke@1 | 162 | LABELED_STATEMENT(LabeledStatementTree.class), |
duke@1 | 163 | |
duke@1 | 164 | /** |
duke@1 | 165 | * Used for instances of {@link MethodTree}. |
duke@1 | 166 | */ |
duke@1 | 167 | METHOD(MethodTree.class), |
duke@1 | 168 | |
duke@1 | 169 | /** |
duke@1 | 170 | * Used for instances of {@link MethodInvocationTree}. |
duke@1 | 171 | */ |
duke@1 | 172 | METHOD_INVOCATION(MethodInvocationTree.class), |
duke@1 | 173 | |
duke@1 | 174 | /** |
duke@1 | 175 | * Used for instances of {@link ModifiersTree}. |
duke@1 | 176 | */ |
duke@1 | 177 | MODIFIERS(ModifiersTree.class), |
duke@1 | 178 | |
duke@1 | 179 | /** |
duke@1 | 180 | * Used for instances of {@link NewArrayTree}. |
duke@1 | 181 | */ |
duke@1 | 182 | NEW_ARRAY(NewArrayTree.class), |
duke@1 | 183 | |
duke@1 | 184 | /** |
duke@1 | 185 | * Used for instances of {@link NewClassTree}. |
duke@1 | 186 | */ |
duke@1 | 187 | NEW_CLASS(NewClassTree.class), |
duke@1 | 188 | |
duke@1 | 189 | /** |
mcimadamore@1142 | 190 | * Used for instances of {@link LambdaExpressionTree}. |
mcimadamore@1142 | 191 | */ |
mcimadamore@1142 | 192 | LAMBDA_EXPRESSION(LambdaExpressionTree.class), |
mcimadamore@1142 | 193 | |
mcimadamore@1142 | 194 | /** |
duke@1 | 195 | * Used for instances of {@link ParenthesizedTree}. |
duke@1 | 196 | */ |
duke@1 | 197 | PARENTHESIZED(ParenthesizedTree.class), |
duke@1 | 198 | |
duke@1 | 199 | /** |
duke@1 | 200 | * Used for instances of {@link PrimitiveTypeTree}. |
duke@1 | 201 | */ |
duke@1 | 202 | PRIMITIVE_TYPE(PrimitiveTypeTree.class), |
duke@1 | 203 | |
duke@1 | 204 | /** |
duke@1 | 205 | * Used for instances of {@link ReturnTree}. |
duke@1 | 206 | */ |
duke@1 | 207 | RETURN(ReturnTree.class), |
duke@1 | 208 | |
duke@1 | 209 | /** |
duke@1 | 210 | * Used for instances of {@link EmptyStatementTree}. |
duke@1 | 211 | */ |
duke@1 | 212 | EMPTY_STATEMENT(EmptyStatementTree.class), |
duke@1 | 213 | |
duke@1 | 214 | /** |
duke@1 | 215 | * Used for instances of {@link SwitchTree}. |
duke@1 | 216 | */ |
duke@1 | 217 | SWITCH(SwitchTree.class), |
duke@1 | 218 | |
duke@1 | 219 | /** |
duke@1 | 220 | * Used for instances of {@link SynchronizedTree}. |
duke@1 | 221 | */ |
duke@1 | 222 | SYNCHRONIZED(SynchronizedTree.class), |
duke@1 | 223 | |
duke@1 | 224 | /** |
duke@1 | 225 | * Used for instances of {@link ThrowTree}. |
duke@1 | 226 | */ |
duke@1 | 227 | THROW(ThrowTree.class), |
duke@1 | 228 | |
duke@1 | 229 | /** |
duke@1 | 230 | * Used for instances of {@link TryTree}. |
duke@1 | 231 | */ |
duke@1 | 232 | TRY(TryTree.class), |
duke@1 | 233 | |
duke@1 | 234 | /** |
duke@1 | 235 | * Used for instances of {@link ParameterizedTypeTree}. |
duke@1 | 236 | */ |
duke@1 | 237 | PARAMETERIZED_TYPE(ParameterizedTypeTree.class), |
duke@1 | 238 | |
duke@1 | 239 | /** |
darcy@969 | 240 | * Used for instances of {@link UnionTypeTree}. |
mcimadamore@550 | 241 | */ |
darcy@969 | 242 | UNION_TYPE(UnionTypeTree.class), |
mcimadamore@550 | 243 | |
mcimadamore@550 | 244 | /** |
duke@1 | 245 | * Used for instances of {@link TypeCastTree}. |
duke@1 | 246 | */ |
duke@1 | 247 | TYPE_CAST(TypeCastTree.class), |
duke@1 | 248 | |
duke@1 | 249 | /** |
duke@1 | 250 | * Used for instances of {@link TypeParameterTree}. |
duke@1 | 251 | */ |
duke@1 | 252 | TYPE_PARAMETER(TypeParameterTree.class), |
duke@1 | 253 | |
duke@1 | 254 | /** |
duke@1 | 255 | * Used for instances of {@link VariableTree}. |
duke@1 | 256 | */ |
duke@1 | 257 | VARIABLE(VariableTree.class), |
duke@1 | 258 | |
duke@1 | 259 | /** |
duke@1 | 260 | * Used for instances of {@link WhileLoopTree}. |
duke@1 | 261 | */ |
duke@1 | 262 | WHILE_LOOP(WhileLoopTree.class), |
duke@1 | 263 | |
duke@1 | 264 | /** |
duke@1 | 265 | * Used for instances of {@link UnaryTree} representing postfix |
duke@1 | 266 | * increment operator {@code ++}. |
duke@1 | 267 | */ |
duke@1 | 268 | POSTFIX_INCREMENT(UnaryTree.class), |
duke@1 | 269 | |
duke@1 | 270 | /** |
duke@1 | 271 | * Used for instances of {@link UnaryTree} representing postfix |
duke@1 | 272 | * decrement operator {@code --}. |
duke@1 | 273 | */ |
duke@1 | 274 | POSTFIX_DECREMENT(UnaryTree.class), |
duke@1 | 275 | |
duke@1 | 276 | /** |
duke@1 | 277 | * Used for instances of {@link UnaryTree} representing prefix |
duke@1 | 278 | * increment operator {@code ++}. |
duke@1 | 279 | */ |
duke@1 | 280 | PREFIX_INCREMENT(UnaryTree.class), |
duke@1 | 281 | |
duke@1 | 282 | /** |
duke@1 | 283 | * Used for instances of {@link UnaryTree} representing prefix |
duke@1 | 284 | * decrement operator {@code --}. |
duke@1 | 285 | */ |
duke@1 | 286 | PREFIX_DECREMENT(UnaryTree.class), |
duke@1 | 287 | |
duke@1 | 288 | /** |
duke@1 | 289 | * Used for instances of {@link UnaryTree} representing unary plus |
duke@1 | 290 | * operator {@code +}. |
duke@1 | 291 | */ |
duke@1 | 292 | UNARY_PLUS(UnaryTree.class), |
duke@1 | 293 | |
duke@1 | 294 | /** |
duke@1 | 295 | * Used for instances of {@link UnaryTree} representing unary minus |
duke@1 | 296 | * operator {@code -}. |
duke@1 | 297 | */ |
duke@1 | 298 | UNARY_MINUS(UnaryTree.class), |
duke@1 | 299 | |
duke@1 | 300 | /** |
duke@1 | 301 | * Used for instances of {@link UnaryTree} representing bitwise |
duke@1 | 302 | * complement operator {@code ~}. |
duke@1 | 303 | */ |
duke@1 | 304 | BITWISE_COMPLEMENT(UnaryTree.class), |
duke@1 | 305 | |
duke@1 | 306 | /** |
duke@1 | 307 | * Used for instances of {@link UnaryTree} representing logical |
duke@1 | 308 | * complement operator {@code !}. |
duke@1 | 309 | */ |
duke@1 | 310 | LOGICAL_COMPLEMENT(UnaryTree.class), |
duke@1 | 311 | |
duke@1 | 312 | /** |
duke@1 | 313 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 314 | * multiplication {@code *}. |
duke@1 | 315 | */ |
duke@1 | 316 | MULTIPLY(BinaryTree.class), |
duke@1 | 317 | |
duke@1 | 318 | /** |
duke@1 | 319 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 320 | * division {@code /}. |
duke@1 | 321 | */ |
duke@1 | 322 | DIVIDE(BinaryTree.class), |
duke@1 | 323 | |
duke@1 | 324 | /** |
duke@1 | 325 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 326 | * remainder {@code %}. |
duke@1 | 327 | */ |
duke@1 | 328 | REMAINDER(BinaryTree.class), |
duke@1 | 329 | |
duke@1 | 330 | /** |
duke@1 | 331 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 332 | * addition or string concatenation {@code +}. |
duke@1 | 333 | */ |
duke@1 | 334 | PLUS(BinaryTree.class), |
duke@1 | 335 | |
duke@1 | 336 | /** |
duke@1 | 337 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 338 | * subtraction {@code -}. |
duke@1 | 339 | */ |
duke@1 | 340 | MINUS(BinaryTree.class), |
duke@1 | 341 | |
duke@1 | 342 | /** |
duke@1 | 343 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 344 | * left shift {@code <<}. |
duke@1 | 345 | */ |
duke@1 | 346 | LEFT_SHIFT(BinaryTree.class), |
duke@1 | 347 | |
duke@1 | 348 | /** |
duke@1 | 349 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 350 | * right shift {@code >>}. |
duke@1 | 351 | */ |
duke@1 | 352 | RIGHT_SHIFT(BinaryTree.class), |
duke@1 | 353 | |
duke@1 | 354 | /** |
duke@1 | 355 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 356 | * unsigned right shift {@code >>>}. |
duke@1 | 357 | */ |
duke@1 | 358 | UNSIGNED_RIGHT_SHIFT(BinaryTree.class), |
duke@1 | 359 | |
duke@1 | 360 | /** |
duke@1 | 361 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 362 | * less-than {@code <}. |
duke@1 | 363 | */ |
duke@1 | 364 | LESS_THAN(BinaryTree.class), |
duke@1 | 365 | |
duke@1 | 366 | /** |
duke@1 | 367 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 368 | * greater-than {@code >}. |
duke@1 | 369 | */ |
duke@1 | 370 | GREATER_THAN(BinaryTree.class), |
duke@1 | 371 | |
duke@1 | 372 | /** |
duke@1 | 373 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 374 | * less-than-equal {@code <=}. |
duke@1 | 375 | */ |
duke@1 | 376 | LESS_THAN_EQUAL(BinaryTree.class), |
duke@1 | 377 | |
duke@1 | 378 | /** |
duke@1 | 379 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 380 | * greater-than-equal {@code >=}. |
duke@1 | 381 | */ |
duke@1 | 382 | GREATER_THAN_EQUAL(BinaryTree.class), |
duke@1 | 383 | |
duke@1 | 384 | /** |
duke@1 | 385 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 386 | * equal-to {@code ==}. |
duke@1 | 387 | */ |
duke@1 | 388 | EQUAL_TO(BinaryTree.class), |
duke@1 | 389 | |
duke@1 | 390 | /** |
duke@1 | 391 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 392 | * not-equal-to {@code !=}. |
duke@1 | 393 | */ |
duke@1 | 394 | NOT_EQUAL_TO(BinaryTree.class), |
duke@1 | 395 | |
duke@1 | 396 | /** |
duke@1 | 397 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 398 | * bitwise and logical "and" {@code &}. |
duke@1 | 399 | */ |
duke@1 | 400 | AND(BinaryTree.class), |
duke@1 | 401 | |
duke@1 | 402 | /** |
duke@1 | 403 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 404 | * bitwise and logical "xor" {@code ^}. |
duke@1 | 405 | */ |
duke@1 | 406 | XOR(BinaryTree.class), |
duke@1 | 407 | |
duke@1 | 408 | /** |
duke@1 | 409 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 410 | * bitwise and logical "or" {@code |}. |
duke@1 | 411 | */ |
duke@1 | 412 | OR(BinaryTree.class), |
duke@1 | 413 | |
duke@1 | 414 | /** |
duke@1 | 415 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 416 | * conditional-and {@code &&}. |
duke@1 | 417 | */ |
duke@1 | 418 | CONDITIONAL_AND(BinaryTree.class), |
duke@1 | 419 | |
duke@1 | 420 | /** |
duke@1 | 421 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 422 | * conditional-or {@code ||}. |
duke@1 | 423 | */ |
duke@1 | 424 | CONDITIONAL_OR(BinaryTree.class), |
duke@1 | 425 | |
duke@1 | 426 | /** |
duke@1 | 427 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 428 | * multiplication assignment {@code *=}. |
duke@1 | 429 | */ |
duke@1 | 430 | MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 431 | |
duke@1 | 432 | /** |
duke@1 | 433 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 434 | * division assignment {@code /=}. |
duke@1 | 435 | */ |
duke@1 | 436 | DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 437 | |
duke@1 | 438 | /** |
duke@1 | 439 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 440 | * remainder assignment {@code %=}. |
duke@1 | 441 | */ |
duke@1 | 442 | REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 443 | |
duke@1 | 444 | /** |
duke@1 | 445 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 446 | * addition or string concatenation assignment {@code +=}. |
duke@1 | 447 | */ |
duke@1 | 448 | PLUS_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 449 | |
duke@1 | 450 | /** |
duke@1 | 451 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 452 | * subtraction assignment {@code -=}. |
duke@1 | 453 | */ |
duke@1 | 454 | MINUS_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 455 | |
duke@1 | 456 | /** |
duke@1 | 457 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 458 | * left shift assignment {@code <<=}. |
duke@1 | 459 | */ |
duke@1 | 460 | LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 461 | |
duke@1 | 462 | /** |
duke@1 | 463 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 464 | * right shift assignment {@code >>=}. |
duke@1 | 465 | */ |
duke@1 | 466 | RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 467 | |
duke@1 | 468 | /** |
duke@1 | 469 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 470 | * unsigned right shift assignment {@code >>>=}. |
duke@1 | 471 | */ |
duke@1 | 472 | UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 473 | |
duke@1 | 474 | /** |
duke@1 | 475 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 476 | * bitwise and logical "and" assignment {@code &=}. |
duke@1 | 477 | */ |
duke@1 | 478 | AND_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 479 | |
duke@1 | 480 | /** |
duke@1 | 481 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 482 | * bitwise and logical "xor" assignment {@code ^=}. |
duke@1 | 483 | */ |
duke@1 | 484 | XOR_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 485 | |
duke@1 | 486 | /** |
duke@1 | 487 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 488 | * bitwise and logical "or" assignment {@code |=}. |
duke@1 | 489 | */ |
duke@1 | 490 | OR_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 491 | |
duke@1 | 492 | /** |
duke@1 | 493 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 494 | * an integral literal expression of type {@code int}. |
duke@1 | 495 | */ |
duke@1 | 496 | INT_LITERAL(LiteralTree.class), |
duke@1 | 497 | |
duke@1 | 498 | /** |
duke@1 | 499 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 500 | * an integral literal expression of type {@code long}. |
duke@1 | 501 | */ |
duke@1 | 502 | LONG_LITERAL(LiteralTree.class), |
duke@1 | 503 | |
duke@1 | 504 | /** |
duke@1 | 505 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 506 | * a floating-point literal expression of type {@code float}. |
duke@1 | 507 | */ |
duke@1 | 508 | FLOAT_LITERAL(LiteralTree.class), |
duke@1 | 509 | |
duke@1 | 510 | /** |
duke@1 | 511 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 512 | * a floating-point literal expression of type {@code double}. |
duke@1 | 513 | */ |
duke@1 | 514 | DOUBLE_LITERAL(LiteralTree.class), |
duke@1 | 515 | |
duke@1 | 516 | /** |
duke@1 | 517 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 518 | * a boolean literal expression of type {@code boolean}. |
duke@1 | 519 | */ |
duke@1 | 520 | BOOLEAN_LITERAL(LiteralTree.class), |
duke@1 | 521 | |
duke@1 | 522 | /** |
duke@1 | 523 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 524 | * a character literal expression of type {@code char}. |
duke@1 | 525 | */ |
duke@1 | 526 | CHAR_LITERAL(LiteralTree.class), |
duke@1 | 527 | |
duke@1 | 528 | /** |
duke@1 | 529 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 530 | * a string literal expression of type {@link String}. |
duke@1 | 531 | */ |
duke@1 | 532 | STRING_LITERAL(LiteralTree.class), |
duke@1 | 533 | |
duke@1 | 534 | /** |
duke@1 | 535 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 536 | * the use of {@code null}. |
duke@1 | 537 | */ |
duke@1 | 538 | NULL_LITERAL(LiteralTree.class), |
duke@1 | 539 | |
duke@1 | 540 | /** |
duke@1 | 541 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 542 | * an unbounded wildcard type argument. |
duke@1 | 543 | */ |
duke@1 | 544 | UNBOUNDED_WILDCARD(WildcardTree.class), |
duke@1 | 545 | |
duke@1 | 546 | /** |
duke@1 | 547 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 548 | * an extends bounded wildcard type argument. |
duke@1 | 549 | */ |
duke@1 | 550 | EXTENDS_WILDCARD(WildcardTree.class), |
duke@1 | 551 | |
duke@1 | 552 | /** |
duke@1 | 553 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 554 | * a super bounded wildcard type argument. |
duke@1 | 555 | */ |
duke@1 | 556 | SUPER_WILDCARD(WildcardTree.class), |
duke@1 | 557 | |
duke@1 | 558 | /** |
duke@1 | 559 | * Used for instances of {@link ErroneousTree}. |
duke@1 | 560 | */ |
duke@1 | 561 | ERRONEOUS(ErroneousTree.class), |
duke@1 | 562 | |
duke@1 | 563 | /** |
jjg@662 | 564 | * Used for instances of {@link ClassTree} representing interfaces. |
jjg@662 | 565 | */ |
jjg@662 | 566 | INTERFACE(ClassTree.class), |
jjg@662 | 567 | |
jjg@662 | 568 | /** |
jjg@662 | 569 | * Used for instances of {@link ClassTree} representing enums. |
jjg@662 | 570 | */ |
jjg@662 | 571 | ENUM(ClassTree.class), |
jjg@662 | 572 | |
jjg@662 | 573 | /** |
jjg@662 | 574 | * Used for instances of {@link ClassTree} representing annotation types. |
jjg@662 | 575 | */ |
jjg@662 | 576 | ANNOTATION_TYPE(ClassTree.class), |
jjg@662 | 577 | |
jjg@662 | 578 | /** |
duke@1 | 579 | * An implementation-reserved node. This is the not the node |
duke@1 | 580 | * you are looking for. |
duke@1 | 581 | */ |
duke@1 | 582 | OTHER(null); |
duke@1 | 583 | |
duke@1 | 584 | |
duke@1 | 585 | Kind(Class<? extends Tree> intf) { |
duke@1 | 586 | associatedInterface = intf; |
duke@1 | 587 | } |
duke@1 | 588 | |
duke@1 | 589 | public Class<? extends Tree> asInterface() { |
duke@1 | 590 | return associatedInterface; |
duke@1 | 591 | } |
duke@1 | 592 | |
duke@1 | 593 | private final Class<? extends Tree> associatedInterface; |
duke@1 | 594 | } |
duke@1 | 595 | |
duke@1 | 596 | /** |
duke@1 | 597 | * Gets the kind of this tree. |
duke@1 | 598 | * |
duke@1 | 599 | * @return the kind of this tree. |
duke@1 | 600 | */ |
duke@1 | 601 | Kind getKind(); |
duke@1 | 602 | |
duke@1 | 603 | /** |
duke@1 | 604 | * Accept method used to implement the visitor pattern. The |
duke@1 | 605 | * visitor pattern is used to implement operations on trees. |
duke@1 | 606 | * |
duke@1 | 607 | * @param <R> result type of this operation. |
duke@1 | 608 | * @param <D> type of additonal data. |
duke@1 | 609 | */ |
duke@1 | 610 | <R,D> R accept(TreeVisitor<R,D> visitor, D data); |
duke@1 | 611 | } |