src/share/classes/com/sun/tools/javac/tree/JCTree.java

Print this page




1004         public Kind getKind() { return Kind.SYNCHRONIZED; }
1005         public JCExpression getExpression() { return lock; }
1006         public JCBlock getBlock() { return body; }
1007         @Override
1008         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1009             return v.visitSynchronized(this, d);
1010         }
1011         @Override
1012         public int getTag() {
1013             return SYNCHRONIZED;
1014         }
1015     }
1016 
1017     /**
1018      * A "try { } catch ( ) { } finally { }" block.
1019      */
1020     public static class JCTry extends JCStatement implements TryTree {
1021         public JCBlock body;
1022         public List<JCCatch> catchers;
1023         public JCBlock finalizer;
1024         protected JCTry(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {




1025             this.body = body;
1026             this.catchers = catchers;
1027             this.finalizer = finalizer;

1028         }
1029         @Override
1030         public void accept(Visitor v) { v.visitTry(this); }
1031 
1032         public Kind getKind() { return Kind.TRY; }
1033         public JCBlock getBlock() { return body; }
1034         public List<JCCatch> getCatches() {
1035             return catchers;
1036         }
1037         public JCBlock getFinallyBlock() { return finalizer; }
1038         @Override
1039         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1040             return v.visitTry(this, d);
1041         }
1042         @Override




1043         public int getTag() {
1044             return TRY;
1045         }
1046     }
1047 
1048     /**
1049      * A catch block.
1050      */
1051     public static class JCCatch extends JCTree implements CatchTree {
1052         public JCVariableDecl param;
1053         public JCBlock body;
1054         protected JCCatch(JCVariableDecl param, JCBlock body) {
1055             this.param = param;
1056             this.body = body;
1057         }
1058         @Override
1059         public void accept(Visitor v) { v.visitCatch(this); }
1060 
1061         public Kind getKind() { return Kind.CATCH; }
1062         public JCVariableDecl getParameter() { return param; }


2145                             JCBlock body,
2146                             JCExpression defaultValue);
2147         JCVariableDecl VarDef(JCModifiers mods,
2148                       Name name,
2149                       JCExpression vartype,
2150                       JCExpression init);
2151         JCSkip Skip();
2152         JCBlock Block(long flags, List<JCStatement> stats);
2153         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
2154         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
2155         JCForLoop ForLoop(List<JCStatement> init,
2156                         JCExpression cond,
2157                         List<JCExpressionStatement> step,
2158                         JCStatement body);
2159         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
2160         JCLabeledStatement Labelled(Name label, JCStatement body);
2161         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
2162         JCCase Case(JCExpression pat, List<JCStatement> stats);
2163         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
2164         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);




2165         JCCatch Catch(JCVariableDecl param, JCBlock body);
2166         JCConditional Conditional(JCExpression cond,
2167                                 JCExpression thenpart,
2168                                 JCExpression elsepart);
2169         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
2170         JCExpressionStatement Exec(JCExpression expr);
2171         JCBreak Break(Name label);
2172         JCContinue Continue(Name label);
2173         JCReturn Return(JCExpression expr);
2174         JCThrow Throw(JCTree expr);
2175         JCAssert Assert(JCExpression cond, JCExpression detail);
2176         JCMethodInvocation Apply(List<JCExpression> typeargs,
2177                     JCExpression fn,
2178                     List<JCExpression> args);
2179         JCNewClass NewClass(JCExpression encl,
2180                           List<JCExpression> typeargs,
2181                           JCExpression clazz,
2182                           List<JCExpression> args,
2183                           JCClassDecl def);
2184         JCNewArray NewArray(JCExpression elemtype,




1004         public Kind getKind() { return Kind.SYNCHRONIZED; }
1005         public JCExpression getExpression() { return lock; }
1006         public JCBlock getBlock() { return body; }
1007         @Override
1008         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1009             return v.visitSynchronized(this, d);
1010         }
1011         @Override
1012         public int getTag() {
1013             return SYNCHRONIZED;
1014         }
1015     }
1016 
1017     /**
1018      * A "try { } catch ( ) { } finally { }" block.
1019      */
1020     public static class JCTry extends JCStatement implements TryTree {
1021         public JCBlock body;
1022         public List<JCCatch> catchers;
1023         public JCBlock finalizer;
1024         public List<JCTree> resources;
1025         protected JCTry(JCBlock body,
1026                         List<JCCatch> catchers,
1027                         JCBlock finalizer,
1028                         List<JCTree> resources) {
1029             this.body = body;
1030             this.catchers = catchers;
1031             this.finalizer = finalizer;
1032             this.resources = resources;
1033         }
1034         @Override
1035         public void accept(Visitor v) { v.visitTry(this); }
1036 
1037         public Kind getKind() { return Kind.TRY; }
1038         public JCBlock getBlock() { return body; }
1039         public List<JCCatch> getCatches() {
1040             return catchers;
1041         }
1042         public JCBlock getFinallyBlock() { return finalizer; }
1043         @Override
1044         public <R,D> R accept(TreeVisitor<R,D> v, D d) {
1045             return v.visitTry(this, d);
1046         }
1047         @Override
1048         public List<? extends JCTree> getResources() {
1049             return resources;
1050         }
1051         @Override
1052         public int getTag() {
1053             return TRY;
1054         }
1055     }
1056 
1057     /**
1058      * A catch block.
1059      */
1060     public static class JCCatch extends JCTree implements CatchTree {
1061         public JCVariableDecl param;
1062         public JCBlock body;
1063         protected JCCatch(JCVariableDecl param, JCBlock body) {
1064             this.param = param;
1065             this.body = body;
1066         }
1067         @Override
1068         public void accept(Visitor v) { v.visitCatch(this); }
1069 
1070         public Kind getKind() { return Kind.CATCH; }
1071         public JCVariableDecl getParameter() { return param; }


2154                             JCBlock body,
2155                             JCExpression defaultValue);
2156         JCVariableDecl VarDef(JCModifiers mods,
2157                       Name name,
2158                       JCExpression vartype,
2159                       JCExpression init);
2160         JCSkip Skip();
2161         JCBlock Block(long flags, List<JCStatement> stats);
2162         JCDoWhileLoop DoLoop(JCStatement body, JCExpression cond);
2163         JCWhileLoop WhileLoop(JCExpression cond, JCStatement body);
2164         JCForLoop ForLoop(List<JCStatement> init,
2165                         JCExpression cond,
2166                         List<JCExpressionStatement> step,
2167                         JCStatement body);
2168         JCEnhancedForLoop ForeachLoop(JCVariableDecl var, JCExpression expr, JCStatement body);
2169         JCLabeledStatement Labelled(Name label, JCStatement body);
2170         JCSwitch Switch(JCExpression selector, List<JCCase> cases);
2171         JCCase Case(JCExpression pat, List<JCStatement> stats);
2172         JCSynchronized Synchronized(JCExpression lock, JCBlock body);
2173         JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer);
2174         JCTry Try(JCBlock body,
2175                   List<JCCatch> catchers,
2176                   JCBlock finalizer,
2177                   List<JCTree> resources);
2178         JCCatch Catch(JCVariableDecl param, JCBlock body);
2179         JCConditional Conditional(JCExpression cond,
2180                                 JCExpression thenpart,
2181                                 JCExpression elsepart);
2182         JCIf If(JCExpression cond, JCStatement thenpart, JCStatement elsepart);
2183         JCExpressionStatement Exec(JCExpression expr);
2184         JCBreak Break(Name label);
2185         JCContinue Continue(Name label);
2186         JCReturn Return(JCExpression expr);
2187         JCThrow Throw(JCTree expr);
2188         JCAssert Assert(JCExpression cond, JCExpression detail);
2189         JCMethodInvocation Apply(List<JCExpression> typeargs,
2190                     JCExpression fn,
2191                     List<JCExpression> args);
2192         JCNewClass NewClass(JCExpression encl,
2193                           List<JCExpression> typeargs,
2194                           JCExpression clazz,
2195                           List<JCExpression> args,
2196                           JCClassDecl def);
2197         JCNewArray NewArray(JCExpression elemtype,