langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeMaker.java
changeset 42828 cce89649f958
parent 42407 f3702cff2933
equal deleted inserted replaced
42827:36468b5fa7f4 42828:cce89649f958
   283         tree.pos = pos;
   283         tree.pos = pos;
   284         return tree;
   284         return tree;
   285     }
   285     }
   286 
   286 
   287     public JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
   287     public JCTry Try(JCBlock body, List<JCCatch> catchers, JCBlock finalizer) {
   288         return Try(List.<JCTree>nil(), body, catchers, finalizer);
   288         return Try(List.nil(), body, catchers, finalizer);
   289     }
   289     }
   290 
   290 
   291     public JCTry Try(List<JCTree> resources,
   291     public JCTry Try(List<JCTree> resources,
   292                      JCBlock body,
   292                      JCBlock body,
   293                      List<JCCatch> catchers,
   293                      List<JCCatch> catchers,
   493         tree.pos = pos;
   493         tree.pos = pos;
   494         return tree;
   494         return tree;
   495     }
   495     }
   496 
   496 
   497     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
   497     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds) {
   498         return TypeParameter(name, bounds, List.<JCAnnotation>nil());
   498         return TypeParameter(name, bounds, List.nil());
   499     }
   499     }
   500 
   500 
   501     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annos) {
   501     public JCTypeParameter TypeParameter(Name name, List<JCExpression> bounds, List<JCAnnotation> annos) {
   502         JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
   502         JCTypeParameter tree = new JCTypeParameter(name, bounds, annos);
   503         tree.pos = pos;
   503         tree.pos = pos;
   534         tree.pos = (noFlags && annotations.isEmpty()) ? Position.NOPOS : pos;
   534         tree.pos = (noFlags && annotations.isEmpty()) ? Position.NOPOS : pos;
   535         return tree;
   535         return tree;
   536     }
   536     }
   537 
   537 
   538     public JCModifiers Modifiers(long flags) {
   538     public JCModifiers Modifiers(long flags) {
   539         return Modifiers(flags, List.<JCAnnotation>nil());
   539         return Modifiers(flags, List.nil());
   540     }
   540     }
   541 
   541 
   542     @Override
   542     @Override
   543     public JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind,
   543     public JCModuleDecl ModuleDef(JCModifiers mods, ModuleKind kind,
   544             JCExpression qualid, List<JCDirective> directives) {
   544             JCExpression qualid, List<JCDirective> directives) {
   587         tree.pos = pos;
   587         tree.pos = pos;
   588         return tree;
   588         return tree;
   589     }
   589     }
   590 
   590 
   591     public JCErroneous Erroneous() {
   591     public JCErroneous Erroneous() {
   592         return Erroneous(List.<JCTree>nil());
   592         return Erroneous(List.nil());
   593     }
   593     }
   594 
   594 
   595     public JCErroneous Erroneous(List<? extends JCTree> errs) {
   595     public JCErroneous Erroneous(List<? extends JCTree> errs) {
   596         JCErroneous tree = new JCErroneous(errs);
   596         JCErroneous tree = new JCErroneous(errs);
   597         tree.pos = pos;
   597         tree.pos = pos;
   611     public JCClassDecl AnonymousClassDef(JCModifiers mods,
   611     public JCClassDecl AnonymousClassDef(JCModifiers mods,
   612                                          List<JCTree> defs)
   612                                          List<JCTree> defs)
   613     {
   613     {
   614         return ClassDef(mods,
   614         return ClassDef(mods,
   615                         names.empty,
   615                         names.empty,
   616                         List.<JCTypeParameter>nil(),
   616                         List.nil(),
   617                         null,
   617                         null,
   618                         List.<JCExpression>nil(),
   618                         List.nil(),
   619                         defs);
   619                         defs);
   620     }
   620     }
   621 
   621 
   622     public LetExpr LetExpr(JCVariableDecl def, JCExpression expr) {
   622     public LetExpr LetExpr(JCVariableDecl def, JCExpression expr) {
   623         LetExpr tree = new LetExpr(List.of(def), expr);
   623         LetExpr tree = new LetExpr(List.of(def), expr);
   712 
   712 
   713     /**
   713     /**
   714      * Create a no-arg method invocation from a method tree
   714      * Create a no-arg method invocation from a method tree
   715      */
   715      */
   716     public JCMethodInvocation App(JCExpression meth) {
   716     public JCMethodInvocation App(JCExpression meth) {
   717         return Apply(null, meth, List.<JCExpression>nil()).setType(meth.type.getReturnType());
   717         return Apply(null, meth, List.nil()).setType(meth.type.getReturnType());
   718     }
   718     }
   719 
   719 
   720     /** Create a method invocation from a method tree and a list of argument trees.
   720     /** Create a method invocation from a method tree and a list of argument trees.
   721      */
   721      */
   722     public JCExpression Create(Symbol ctor, List<JCExpression> args) {
   722     public JCExpression Create(Symbol ctor, List<JCExpression> args) {
   901         }
   901         }
   902         public void visitArray(Attribute.Array array) {
   902         public void visitArray(Attribute.Array array) {
   903             ListBuffer<JCExpression> elems = new ListBuffer<>();
   903             ListBuffer<JCExpression> elems = new ListBuffer<>();
   904             for (int i = 0; i < array.values.length; i++)
   904             for (int i = 0; i < array.values.length; i++)
   905                 elems.append(translate(array.values[i]));
   905                 elems.append(translate(array.values[i]));
   906             result = NewArray(null, List.<JCExpression>nil(), elems.toList()).setType(array.type);
   906             result = NewArray(null, List.nil(), elems.toList()).setType(array.type);
   907         }
   907         }
   908         JCExpression translate(Attribute a) {
   908         JCExpression translate(Attribute a) {
   909             a.accept(this);
   909             a.accept(this);
   910             return result;
   910             return result;
   911         }
   911         }