Fri, 27 Aug 2010 17:21:17 -0700
6570730: com.sun.source.tree.ModifiersTree.getFlags() should return class type
Reviewed-by: mcimadamore
duke@1 | 1 | /* |
ohair@554 | 2 | * Copyright (c) 2005, 2006, 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 | |
jjg@308 | 49 | ANNOTATED_TYPE(AnnotatedTypeTree.class), |
jjg@308 | 50 | |
duke@1 | 51 | /** |
duke@1 | 52 | * Used for instances of {@link AnnotationTree}. |
duke@1 | 53 | */ |
duke@1 | 54 | ANNOTATION(AnnotationTree.class), |
duke@1 | 55 | |
duke@1 | 56 | /** |
duke@1 | 57 | * Used for instances of {@link ArrayAccessTree}. |
duke@1 | 58 | */ |
duke@1 | 59 | ARRAY_ACCESS(ArrayAccessTree.class), |
duke@1 | 60 | |
duke@1 | 61 | /** |
duke@1 | 62 | * Used for instances of {@link ArrayTypeTree}. |
duke@1 | 63 | */ |
duke@1 | 64 | ARRAY_TYPE(ArrayTypeTree.class), |
duke@1 | 65 | |
duke@1 | 66 | /** |
duke@1 | 67 | * Used for instances of {@link AssertTree}. |
duke@1 | 68 | */ |
duke@1 | 69 | ASSERT(AssertTree.class), |
duke@1 | 70 | |
duke@1 | 71 | /** |
duke@1 | 72 | * Used for instances of {@link AssignmentTree}. |
duke@1 | 73 | */ |
duke@1 | 74 | ASSIGNMENT(AssignmentTree.class), |
duke@1 | 75 | |
duke@1 | 76 | /** |
duke@1 | 77 | * Used for instances of {@link BlockTree}. |
duke@1 | 78 | */ |
duke@1 | 79 | BLOCK(BlockTree.class), |
duke@1 | 80 | |
duke@1 | 81 | /** |
duke@1 | 82 | * Used for instances of {@link BreakTree}. |
duke@1 | 83 | */ |
duke@1 | 84 | BREAK(BreakTree.class), |
duke@1 | 85 | |
duke@1 | 86 | /** |
duke@1 | 87 | * Used for instances of {@link CaseTree}. |
duke@1 | 88 | */ |
duke@1 | 89 | CASE(CaseTree.class), |
duke@1 | 90 | |
duke@1 | 91 | /** |
duke@1 | 92 | * Used for instances of {@link CatchTree}. |
duke@1 | 93 | */ |
duke@1 | 94 | CATCH(CatchTree.class), |
duke@1 | 95 | |
duke@1 | 96 | /** |
jjg@662 | 97 | * Used for instances of {@link ClassTree} representing classes. |
duke@1 | 98 | */ |
duke@1 | 99 | CLASS(ClassTree.class), |
duke@1 | 100 | |
duke@1 | 101 | /** |
duke@1 | 102 | * Used for instances of {@link CompilationUnitTree}. |
duke@1 | 103 | */ |
duke@1 | 104 | COMPILATION_UNIT(CompilationUnitTree.class), |
duke@1 | 105 | |
duke@1 | 106 | /** |
duke@1 | 107 | * Used for instances of {@link ConditionalExpressionTree}. |
duke@1 | 108 | */ |
duke@1 | 109 | CONDITIONAL_EXPRESSION(ConditionalExpressionTree.class), |
duke@1 | 110 | |
duke@1 | 111 | /** |
duke@1 | 112 | * Used for instances of {@link ContinueTree}. |
duke@1 | 113 | */ |
duke@1 | 114 | CONTINUE(ContinueTree.class), |
duke@1 | 115 | |
duke@1 | 116 | /** |
duke@1 | 117 | * Used for instances of {@link DoWhileLoopTree}. |
duke@1 | 118 | */ |
duke@1 | 119 | DO_WHILE_LOOP(DoWhileLoopTree.class), |
duke@1 | 120 | |
duke@1 | 121 | /** |
duke@1 | 122 | * Used for instances of {@link EnhancedForLoopTree}. |
duke@1 | 123 | */ |
duke@1 | 124 | ENHANCED_FOR_LOOP(EnhancedForLoopTree.class), |
duke@1 | 125 | |
duke@1 | 126 | /** |
duke@1 | 127 | * Used for instances of {@link ExpressionStatementTree}. |
duke@1 | 128 | */ |
duke@1 | 129 | EXPRESSION_STATEMENT(ExpressionStatementTree.class), |
duke@1 | 130 | |
duke@1 | 131 | /** |
duke@1 | 132 | * Used for instances of {@link MemberSelectTree}. |
duke@1 | 133 | */ |
duke@1 | 134 | MEMBER_SELECT(MemberSelectTree.class), |
duke@1 | 135 | |
duke@1 | 136 | /** |
duke@1 | 137 | * Used for instances of {@link ForLoopTree}. |
duke@1 | 138 | */ |
duke@1 | 139 | FOR_LOOP(ForLoopTree.class), |
duke@1 | 140 | |
duke@1 | 141 | /** |
duke@1 | 142 | * Used for instances of {@link IdentifierTree}. |
duke@1 | 143 | */ |
duke@1 | 144 | IDENTIFIER(IdentifierTree.class), |
duke@1 | 145 | |
duke@1 | 146 | /** |
duke@1 | 147 | * Used for instances of {@link IfTree}. |
duke@1 | 148 | */ |
duke@1 | 149 | IF(IfTree.class), |
duke@1 | 150 | |
duke@1 | 151 | /** |
duke@1 | 152 | * Used for instances of {@link ImportTree}. |
duke@1 | 153 | */ |
duke@1 | 154 | IMPORT(ImportTree.class), |
duke@1 | 155 | |
duke@1 | 156 | /** |
duke@1 | 157 | * Used for instances of {@link InstanceOfTree}. |
duke@1 | 158 | */ |
duke@1 | 159 | INSTANCE_OF(InstanceOfTree.class), |
duke@1 | 160 | |
duke@1 | 161 | /** |
duke@1 | 162 | * Used for instances of {@link LabeledStatementTree}. |
duke@1 | 163 | */ |
duke@1 | 164 | LABELED_STATEMENT(LabeledStatementTree.class), |
duke@1 | 165 | |
duke@1 | 166 | /** |
duke@1 | 167 | * Used for instances of {@link MethodTree}. |
duke@1 | 168 | */ |
duke@1 | 169 | METHOD(MethodTree.class), |
duke@1 | 170 | |
duke@1 | 171 | /** |
duke@1 | 172 | * Used for instances of {@link MethodInvocationTree}. |
duke@1 | 173 | */ |
duke@1 | 174 | METHOD_INVOCATION(MethodInvocationTree.class), |
duke@1 | 175 | |
duke@1 | 176 | /** |
duke@1 | 177 | * Used for instances of {@link ModifiersTree}. |
duke@1 | 178 | */ |
duke@1 | 179 | MODIFIERS(ModifiersTree.class), |
duke@1 | 180 | |
duke@1 | 181 | /** |
duke@1 | 182 | * Used for instances of {@link NewArrayTree}. |
duke@1 | 183 | */ |
duke@1 | 184 | NEW_ARRAY(NewArrayTree.class), |
duke@1 | 185 | |
duke@1 | 186 | /** |
duke@1 | 187 | * Used for instances of {@link NewClassTree}. |
duke@1 | 188 | */ |
duke@1 | 189 | NEW_CLASS(NewClassTree.class), |
duke@1 | 190 | |
duke@1 | 191 | /** |
duke@1 | 192 | * Used for instances of {@link ParenthesizedTree}. |
duke@1 | 193 | */ |
duke@1 | 194 | PARENTHESIZED(ParenthesizedTree.class), |
duke@1 | 195 | |
duke@1 | 196 | /** |
duke@1 | 197 | * Used for instances of {@link PrimitiveTypeTree}. |
duke@1 | 198 | */ |
duke@1 | 199 | PRIMITIVE_TYPE(PrimitiveTypeTree.class), |
duke@1 | 200 | |
duke@1 | 201 | /** |
duke@1 | 202 | * Used for instances of {@link ReturnTree}. |
duke@1 | 203 | */ |
duke@1 | 204 | RETURN(ReturnTree.class), |
duke@1 | 205 | |
duke@1 | 206 | /** |
duke@1 | 207 | * Used for instances of {@link EmptyStatementTree}. |
duke@1 | 208 | */ |
duke@1 | 209 | EMPTY_STATEMENT(EmptyStatementTree.class), |
duke@1 | 210 | |
duke@1 | 211 | /** |
duke@1 | 212 | * Used for instances of {@link SwitchTree}. |
duke@1 | 213 | */ |
duke@1 | 214 | SWITCH(SwitchTree.class), |
duke@1 | 215 | |
duke@1 | 216 | /** |
duke@1 | 217 | * Used for instances of {@link SynchronizedTree}. |
duke@1 | 218 | */ |
duke@1 | 219 | SYNCHRONIZED(SynchronizedTree.class), |
duke@1 | 220 | |
duke@1 | 221 | /** |
duke@1 | 222 | * Used for instances of {@link ThrowTree}. |
duke@1 | 223 | */ |
duke@1 | 224 | THROW(ThrowTree.class), |
duke@1 | 225 | |
duke@1 | 226 | /** |
duke@1 | 227 | * Used for instances of {@link TryTree}. |
duke@1 | 228 | */ |
duke@1 | 229 | TRY(TryTree.class), |
duke@1 | 230 | |
duke@1 | 231 | /** |
duke@1 | 232 | * Used for instances of {@link ParameterizedTypeTree}. |
duke@1 | 233 | */ |
duke@1 | 234 | PARAMETERIZED_TYPE(ParameterizedTypeTree.class), |
duke@1 | 235 | |
duke@1 | 236 | /** |
mcimadamore@550 | 237 | * Used for instances of {@link DisjointTypeTree}. |
mcimadamore@550 | 238 | */ |
mcimadamore@550 | 239 | DISJOINT_TYPE(DisjointTypeTree.class), |
mcimadamore@550 | 240 | |
mcimadamore@550 | 241 | /** |
duke@1 | 242 | * Used for instances of {@link TypeCastTree}. |
duke@1 | 243 | */ |
duke@1 | 244 | TYPE_CAST(TypeCastTree.class), |
duke@1 | 245 | |
duke@1 | 246 | /** |
duke@1 | 247 | * Used for instances of {@link TypeParameterTree}. |
duke@1 | 248 | */ |
duke@1 | 249 | TYPE_PARAMETER(TypeParameterTree.class), |
duke@1 | 250 | |
duke@1 | 251 | /** |
duke@1 | 252 | * Used for instances of {@link VariableTree}. |
duke@1 | 253 | */ |
duke@1 | 254 | VARIABLE(VariableTree.class), |
duke@1 | 255 | |
duke@1 | 256 | /** |
duke@1 | 257 | * Used for instances of {@link WhileLoopTree}. |
duke@1 | 258 | */ |
duke@1 | 259 | WHILE_LOOP(WhileLoopTree.class), |
duke@1 | 260 | |
duke@1 | 261 | /** |
duke@1 | 262 | * Used for instances of {@link UnaryTree} representing postfix |
duke@1 | 263 | * increment operator {@code ++}. |
duke@1 | 264 | */ |
duke@1 | 265 | POSTFIX_INCREMENT(UnaryTree.class), |
duke@1 | 266 | |
duke@1 | 267 | /** |
duke@1 | 268 | * Used for instances of {@link UnaryTree} representing postfix |
duke@1 | 269 | * decrement operator {@code --}. |
duke@1 | 270 | */ |
duke@1 | 271 | POSTFIX_DECREMENT(UnaryTree.class), |
duke@1 | 272 | |
duke@1 | 273 | /** |
duke@1 | 274 | * Used for instances of {@link UnaryTree} representing prefix |
duke@1 | 275 | * increment operator {@code ++}. |
duke@1 | 276 | */ |
duke@1 | 277 | PREFIX_INCREMENT(UnaryTree.class), |
duke@1 | 278 | |
duke@1 | 279 | /** |
duke@1 | 280 | * Used for instances of {@link UnaryTree} representing prefix |
duke@1 | 281 | * decrement operator {@code --}. |
duke@1 | 282 | */ |
duke@1 | 283 | PREFIX_DECREMENT(UnaryTree.class), |
duke@1 | 284 | |
duke@1 | 285 | /** |
duke@1 | 286 | * Used for instances of {@link UnaryTree} representing unary plus |
duke@1 | 287 | * operator {@code +}. |
duke@1 | 288 | */ |
duke@1 | 289 | UNARY_PLUS(UnaryTree.class), |
duke@1 | 290 | |
duke@1 | 291 | /** |
duke@1 | 292 | * Used for instances of {@link UnaryTree} representing unary minus |
duke@1 | 293 | * operator {@code -}. |
duke@1 | 294 | */ |
duke@1 | 295 | UNARY_MINUS(UnaryTree.class), |
duke@1 | 296 | |
duke@1 | 297 | /** |
duke@1 | 298 | * Used for instances of {@link UnaryTree} representing bitwise |
duke@1 | 299 | * complement operator {@code ~}. |
duke@1 | 300 | */ |
duke@1 | 301 | BITWISE_COMPLEMENT(UnaryTree.class), |
duke@1 | 302 | |
duke@1 | 303 | /** |
duke@1 | 304 | * Used for instances of {@link UnaryTree} representing logical |
duke@1 | 305 | * complement operator {@code !}. |
duke@1 | 306 | */ |
duke@1 | 307 | LOGICAL_COMPLEMENT(UnaryTree.class), |
duke@1 | 308 | |
duke@1 | 309 | /** |
duke@1 | 310 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 311 | * multiplication {@code *}. |
duke@1 | 312 | */ |
duke@1 | 313 | MULTIPLY(BinaryTree.class), |
duke@1 | 314 | |
duke@1 | 315 | /** |
duke@1 | 316 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 317 | * division {@code /}. |
duke@1 | 318 | */ |
duke@1 | 319 | DIVIDE(BinaryTree.class), |
duke@1 | 320 | |
duke@1 | 321 | /** |
duke@1 | 322 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 323 | * remainder {@code %}. |
duke@1 | 324 | */ |
duke@1 | 325 | REMAINDER(BinaryTree.class), |
duke@1 | 326 | |
duke@1 | 327 | /** |
duke@1 | 328 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 329 | * addition or string concatenation {@code +}. |
duke@1 | 330 | */ |
duke@1 | 331 | PLUS(BinaryTree.class), |
duke@1 | 332 | |
duke@1 | 333 | /** |
duke@1 | 334 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 335 | * subtraction {@code -}. |
duke@1 | 336 | */ |
duke@1 | 337 | MINUS(BinaryTree.class), |
duke@1 | 338 | |
duke@1 | 339 | /** |
duke@1 | 340 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 341 | * left shift {@code <<}. |
duke@1 | 342 | */ |
duke@1 | 343 | LEFT_SHIFT(BinaryTree.class), |
duke@1 | 344 | |
duke@1 | 345 | /** |
duke@1 | 346 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 347 | * right shift {@code >>}. |
duke@1 | 348 | */ |
duke@1 | 349 | RIGHT_SHIFT(BinaryTree.class), |
duke@1 | 350 | |
duke@1 | 351 | /** |
duke@1 | 352 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 353 | * unsigned right shift {@code >>>}. |
duke@1 | 354 | */ |
duke@1 | 355 | UNSIGNED_RIGHT_SHIFT(BinaryTree.class), |
duke@1 | 356 | |
duke@1 | 357 | /** |
duke@1 | 358 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 359 | * less-than {@code <}. |
duke@1 | 360 | */ |
duke@1 | 361 | LESS_THAN(BinaryTree.class), |
duke@1 | 362 | |
duke@1 | 363 | /** |
duke@1 | 364 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 365 | * greater-than {@code >}. |
duke@1 | 366 | */ |
duke@1 | 367 | GREATER_THAN(BinaryTree.class), |
duke@1 | 368 | |
duke@1 | 369 | /** |
duke@1 | 370 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 371 | * less-than-equal {@code <=}. |
duke@1 | 372 | */ |
duke@1 | 373 | LESS_THAN_EQUAL(BinaryTree.class), |
duke@1 | 374 | |
duke@1 | 375 | /** |
duke@1 | 376 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 377 | * greater-than-equal {@code >=}. |
duke@1 | 378 | */ |
duke@1 | 379 | GREATER_THAN_EQUAL(BinaryTree.class), |
duke@1 | 380 | |
duke@1 | 381 | /** |
duke@1 | 382 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 383 | * equal-to {@code ==}. |
duke@1 | 384 | */ |
duke@1 | 385 | EQUAL_TO(BinaryTree.class), |
duke@1 | 386 | |
duke@1 | 387 | /** |
duke@1 | 388 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 389 | * not-equal-to {@code !=}. |
duke@1 | 390 | */ |
duke@1 | 391 | NOT_EQUAL_TO(BinaryTree.class), |
duke@1 | 392 | |
duke@1 | 393 | /** |
duke@1 | 394 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 395 | * bitwise and logical "and" {@code &}. |
duke@1 | 396 | */ |
duke@1 | 397 | AND(BinaryTree.class), |
duke@1 | 398 | |
duke@1 | 399 | /** |
duke@1 | 400 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 401 | * bitwise and logical "xor" {@code ^}. |
duke@1 | 402 | */ |
duke@1 | 403 | XOR(BinaryTree.class), |
duke@1 | 404 | |
duke@1 | 405 | /** |
duke@1 | 406 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 407 | * bitwise and logical "or" {@code |}. |
duke@1 | 408 | */ |
duke@1 | 409 | OR(BinaryTree.class), |
duke@1 | 410 | |
duke@1 | 411 | /** |
duke@1 | 412 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 413 | * conditional-and {@code &&}. |
duke@1 | 414 | */ |
duke@1 | 415 | CONDITIONAL_AND(BinaryTree.class), |
duke@1 | 416 | |
duke@1 | 417 | /** |
duke@1 | 418 | * Used for instances of {@link BinaryTree} representing |
duke@1 | 419 | * conditional-or {@code ||}. |
duke@1 | 420 | */ |
duke@1 | 421 | CONDITIONAL_OR(BinaryTree.class), |
duke@1 | 422 | |
duke@1 | 423 | /** |
duke@1 | 424 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 425 | * multiplication assignment {@code *=}. |
duke@1 | 426 | */ |
duke@1 | 427 | MULTIPLY_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 428 | |
duke@1 | 429 | /** |
duke@1 | 430 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 431 | * division assignment {@code /=}. |
duke@1 | 432 | */ |
duke@1 | 433 | DIVIDE_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 434 | |
duke@1 | 435 | /** |
duke@1 | 436 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 437 | * remainder assignment {@code %=}. |
duke@1 | 438 | */ |
duke@1 | 439 | REMAINDER_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 440 | |
duke@1 | 441 | /** |
duke@1 | 442 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 443 | * addition or string concatenation assignment {@code +=}. |
duke@1 | 444 | */ |
duke@1 | 445 | PLUS_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 446 | |
duke@1 | 447 | /** |
duke@1 | 448 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 449 | * subtraction assignment {@code -=}. |
duke@1 | 450 | */ |
duke@1 | 451 | MINUS_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 452 | |
duke@1 | 453 | /** |
duke@1 | 454 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 455 | * left shift assignment {@code <<=}. |
duke@1 | 456 | */ |
duke@1 | 457 | LEFT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 458 | |
duke@1 | 459 | /** |
duke@1 | 460 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 461 | * right shift assignment {@code >>=}. |
duke@1 | 462 | */ |
duke@1 | 463 | RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 464 | |
duke@1 | 465 | /** |
duke@1 | 466 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 467 | * unsigned right shift assignment {@code >>>=}. |
duke@1 | 468 | */ |
duke@1 | 469 | UNSIGNED_RIGHT_SHIFT_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 470 | |
duke@1 | 471 | /** |
duke@1 | 472 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 473 | * bitwise and logical "and" assignment {@code &=}. |
duke@1 | 474 | */ |
duke@1 | 475 | AND_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 476 | |
duke@1 | 477 | /** |
duke@1 | 478 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 479 | * bitwise and logical "xor" assignment {@code ^=}. |
duke@1 | 480 | */ |
duke@1 | 481 | XOR_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 482 | |
duke@1 | 483 | /** |
duke@1 | 484 | * Used for instances of {@link CompoundAssignmentTree} representing |
duke@1 | 485 | * bitwise and logical "or" assignment {@code |=}. |
duke@1 | 486 | */ |
duke@1 | 487 | OR_ASSIGNMENT(CompoundAssignmentTree.class), |
duke@1 | 488 | |
duke@1 | 489 | /** |
duke@1 | 490 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 491 | * an integral literal expression of type {@code int}. |
duke@1 | 492 | */ |
duke@1 | 493 | INT_LITERAL(LiteralTree.class), |
duke@1 | 494 | |
duke@1 | 495 | /** |
duke@1 | 496 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 497 | * an integral literal expression of type {@code long}. |
duke@1 | 498 | */ |
duke@1 | 499 | LONG_LITERAL(LiteralTree.class), |
duke@1 | 500 | |
duke@1 | 501 | /** |
duke@1 | 502 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 503 | * a floating-point literal expression of type {@code float}. |
duke@1 | 504 | */ |
duke@1 | 505 | FLOAT_LITERAL(LiteralTree.class), |
duke@1 | 506 | |
duke@1 | 507 | /** |
duke@1 | 508 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 509 | * a floating-point literal expression of type {@code double}. |
duke@1 | 510 | */ |
duke@1 | 511 | DOUBLE_LITERAL(LiteralTree.class), |
duke@1 | 512 | |
duke@1 | 513 | /** |
duke@1 | 514 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 515 | * a boolean literal expression of type {@code boolean}. |
duke@1 | 516 | */ |
duke@1 | 517 | BOOLEAN_LITERAL(LiteralTree.class), |
duke@1 | 518 | |
duke@1 | 519 | /** |
duke@1 | 520 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 521 | * a character literal expression of type {@code char}. |
duke@1 | 522 | */ |
duke@1 | 523 | CHAR_LITERAL(LiteralTree.class), |
duke@1 | 524 | |
duke@1 | 525 | /** |
duke@1 | 526 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 527 | * a string literal expression of type {@link String}. |
duke@1 | 528 | */ |
duke@1 | 529 | STRING_LITERAL(LiteralTree.class), |
duke@1 | 530 | |
duke@1 | 531 | /** |
duke@1 | 532 | * Used for instances of {@link LiteralTree} representing |
duke@1 | 533 | * the use of {@code null}. |
duke@1 | 534 | */ |
duke@1 | 535 | NULL_LITERAL(LiteralTree.class), |
duke@1 | 536 | |
duke@1 | 537 | /** |
duke@1 | 538 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 539 | * an unbounded wildcard type argument. |
duke@1 | 540 | */ |
duke@1 | 541 | UNBOUNDED_WILDCARD(WildcardTree.class), |
duke@1 | 542 | |
duke@1 | 543 | /** |
duke@1 | 544 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 545 | * an extends bounded wildcard type argument. |
duke@1 | 546 | */ |
duke@1 | 547 | EXTENDS_WILDCARD(WildcardTree.class), |
duke@1 | 548 | |
duke@1 | 549 | /** |
duke@1 | 550 | * Used for instances of {@link WildcardTree} representing |
duke@1 | 551 | * a super bounded wildcard type argument. |
duke@1 | 552 | */ |
duke@1 | 553 | SUPER_WILDCARD(WildcardTree.class), |
duke@1 | 554 | |
duke@1 | 555 | /** |
duke@1 | 556 | * Used for instances of {@link ErroneousTree}. |
duke@1 | 557 | */ |
duke@1 | 558 | ERRONEOUS(ErroneousTree.class), |
duke@1 | 559 | |
duke@1 | 560 | /** |
jjg@662 | 561 | * Used for instances of {@link ClassTree} representing interfaces. |
jjg@662 | 562 | */ |
jjg@662 | 563 | INTERFACE(ClassTree.class), |
jjg@662 | 564 | |
jjg@662 | 565 | /** |
jjg@662 | 566 | * Used for instances of {@link ClassTree} representing enums. |
jjg@662 | 567 | */ |
jjg@662 | 568 | ENUM(ClassTree.class), |
jjg@662 | 569 | |
jjg@662 | 570 | /** |
jjg@662 | 571 | * Used for instances of {@link ClassTree} representing annotation types. |
jjg@662 | 572 | */ |
jjg@662 | 573 | ANNOTATION_TYPE(ClassTree.class), |
jjg@662 | 574 | |
jjg@662 | 575 | /** |
duke@1 | 576 | * An implementation-reserved node. This is the not the node |
duke@1 | 577 | * you are looking for. |
duke@1 | 578 | */ |
duke@1 | 579 | OTHER(null); |
duke@1 | 580 | |
duke@1 | 581 | |
duke@1 | 582 | Kind(Class<? extends Tree> intf) { |
duke@1 | 583 | associatedInterface = intf; |
duke@1 | 584 | } |
duke@1 | 585 | |
duke@1 | 586 | public Class<? extends Tree> asInterface() { |
duke@1 | 587 | return associatedInterface; |
duke@1 | 588 | } |
duke@1 | 589 | |
duke@1 | 590 | private final Class<? extends Tree> associatedInterface; |
duke@1 | 591 | } |
duke@1 | 592 | |
duke@1 | 593 | /** |
duke@1 | 594 | * Gets the kind of this tree. |
duke@1 | 595 | * |
duke@1 | 596 | * @return the kind of this tree. |
duke@1 | 597 | */ |
duke@1 | 598 | Kind getKind(); |
duke@1 | 599 | |
duke@1 | 600 | /** |
duke@1 | 601 | * Accept method used to implement the visitor pattern. The |
duke@1 | 602 | * visitor pattern is used to implement operations on trees. |
duke@1 | 603 | * |
duke@1 | 604 | * @param <R> result type of this operation. |
duke@1 | 605 | * @param <D> type of additonal data. |
duke@1 | 606 | */ |
duke@1 | 607 | <R,D> R accept(TreeVisitor<R,D> visitor, D data); |
duke@1 | 608 | } |