< prev index next >

src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java

Print this page
rev 56510 : 8232684: Make switch expressions final
Reviewed-by: TBD


 223          * Used for instances of {@link PrimitiveTypeTree}.
 224          */
 225         PRIMITIVE_TYPE(PrimitiveTypeTree.class),
 226 
 227         /**
 228          * Used for instances of {@link ReturnTree}.
 229          */
 230         RETURN(ReturnTree.class),
 231 
 232         /**
 233          * Used for instances of {@link EmptyStatementTree}.
 234          */
 235         EMPTY_STATEMENT(EmptyStatementTree.class),
 236 
 237         /**
 238          * Used for instances of {@link SwitchTree}.
 239          */
 240         SWITCH(SwitchTree.class),
 241 
 242         /**
 243          * {@preview Associated with switch expressions, a preview feature of
 244          *           the Java language.
 245          *
 246          *           This enum constant is associated with <i>switch expressions</i>, a preview
 247          *           feature of the Java language. Preview features
 248          *           may be removed in a future release, or upgraded to permanent
 249          *           features of the Java language.}
 250          *
 251          * Used for instances of {@link SwitchExpressionTree}.
 252          *
 253          * @since 12
 254          */
 255         @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
 256         @SuppressWarnings("preview")
 257         SWITCH_EXPRESSION(SwitchExpressionTree.class),
 258 
 259         /**
 260          * Used for instances of {@link SynchronizedTree}.
 261          */
 262         SYNCHRONIZED(SynchronizedTree.class),
 263 
 264         /**
 265          * Used for instances of {@link ThrowTree}.
 266          */
 267         THROW(ThrowTree.class),
 268 
 269         /**
 270          * Used for instances of {@link TryTree}.
 271          */
 272         TRY(TryTree.class),
 273 
 274         /**
 275          * Used for instances of {@link ParameterizedTypeTree}.
 276          */


 645 
 646         /**
 647          * Used for instances of {@link RequiresTree} representing
 648          * requires directives in a module declaration.
 649          */
 650         REQUIRES(RequiresTree.class),
 651 
 652         /**
 653          * Used for instances of {@link UsesTree} representing
 654          * uses directives in a module declaration.
 655          */
 656         USES(UsesTree.class),
 657 
 658         /**
 659          * An implementation-reserved node. This is the not the node
 660          * you are looking for.
 661          */
 662         OTHER(null),
 663 
 664         /**
 665          * {@preview Associated with switch expressions, a preview feature of
 666          *           the Java language.
 667          *
 668          *           This enum constant is associated with <i>switch expressions</i>, a preview
 669          *           feature of the Java language. Preview features
 670          *           may be removed in a future release, or upgraded to permanent
 671          *           features of the Java language.}
 672          *
 673          * Used for instances of {@link YieldTree}.
 674          *
 675          * @since 13
 676          */
 677         @jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.SWITCH_EXPRESSIONS)
 678         @SuppressWarnings("preview")
 679         YIELD(YieldTree.class);
 680 
 681 
 682         Kind(Class<? extends Tree> intf) {
 683             associatedInterface = intf;
 684         }
 685 
 686         /**
 687          * Returns the associated interface type that uses this kind.
 688          * @return the associated interface
 689          */
 690         public Class<? extends Tree> asInterface() {
 691             return associatedInterface;
 692         }
 693 
 694         private final Class<? extends Tree> associatedInterface;
 695     }
 696 
 697     /**
 698      * Returns the kind of this tree.


 223          * Used for instances of {@link PrimitiveTypeTree}.
 224          */
 225         PRIMITIVE_TYPE(PrimitiveTypeTree.class),
 226 
 227         /**
 228          * Used for instances of {@link ReturnTree}.
 229          */
 230         RETURN(ReturnTree.class),
 231 
 232         /**
 233          * Used for instances of {@link EmptyStatementTree}.
 234          */
 235         EMPTY_STATEMENT(EmptyStatementTree.class),
 236 
 237         /**
 238          * Used for instances of {@link SwitchTree}.
 239          */
 240         SWITCH(SwitchTree.class),
 241 
 242         /**








 243          * Used for instances of {@link SwitchExpressionTree}.
 244          *
 245          * @since 12
 246          */


 247         SWITCH_EXPRESSION(SwitchExpressionTree.class),
 248 
 249         /**
 250          * Used for instances of {@link SynchronizedTree}.
 251          */
 252         SYNCHRONIZED(SynchronizedTree.class),
 253 
 254         /**
 255          * Used for instances of {@link ThrowTree}.
 256          */
 257         THROW(ThrowTree.class),
 258 
 259         /**
 260          * Used for instances of {@link TryTree}.
 261          */
 262         TRY(TryTree.class),
 263 
 264         /**
 265          * Used for instances of {@link ParameterizedTypeTree}.
 266          */


 635 
 636         /**
 637          * Used for instances of {@link RequiresTree} representing
 638          * requires directives in a module declaration.
 639          */
 640         REQUIRES(RequiresTree.class),
 641 
 642         /**
 643          * Used for instances of {@link UsesTree} representing
 644          * uses directives in a module declaration.
 645          */
 646         USES(UsesTree.class),
 647 
 648         /**
 649          * An implementation-reserved node. This is the not the node
 650          * you are looking for.
 651          */
 652         OTHER(null),
 653 
 654         /**








 655          * Used for instances of {@link YieldTree}.
 656          *
 657          * @since 13
 658          */


 659         YIELD(YieldTree.class);
 660 
 661 
 662         Kind(Class<? extends Tree> intf) {
 663             associatedInterface = intf;
 664         }
 665 
 666         /**
 667          * Returns the associated interface type that uses this kind.
 668          * @return the associated interface
 669          */
 670         public Class<? extends Tree> asInterface() {
 671             return associatedInterface;
 672         }
 673 
 674         private final Class<? extends Tree> associatedInterface;
 675     }
 676 
 677     /**
 678      * Returns the kind of this tree.
< prev index next >