langtools/src/share/classes/com/sun/tools/javac/tree/TreeMaker.java
changeset 24069 dfb8f11542fc
parent 22163 3651128c74eb
child 25440 7f9cedf2e88d
equal deleted inserted replaced
24068:d8a1180faaa9 24069:dfb8f11542fc
   114         return this;
   114         return this;
   115     }
   115     }
   116 
   116 
   117     /**
   117     /**
   118      * Create given tree node at current position.
   118      * Create given tree node at current position.
   119      * @param defs a list of ClassDef, Import, and Skip
   119      * @param defs a list of PackageDef, ClassDef, Import, and Skip
   120      */
   120      */
   121     public JCCompilationUnit TopLevel(List<JCAnnotation> packageAnnotations,
   121     public JCCompilationUnit TopLevel(List<JCTree> defs) {
   122                                       JCExpression pid,
       
   123                                       List<JCTree> defs) {
       
   124         Assert.checkNonNull(packageAnnotations);
       
   125         for (JCTree node : defs)
   122         for (JCTree node : defs)
   126             Assert.check(node instanceof JCClassDecl
   123             Assert.check(node instanceof JCClassDecl
       
   124                 || node instanceof JCPackageDecl
   127                 || node instanceof JCImport
   125                 || node instanceof JCImport
   128                 || node instanceof JCSkip
   126                 || node instanceof JCSkip
   129                 || node instanceof JCErroneous
   127                 || node instanceof JCErroneous
   130                 || (node instanceof JCExpressionStatement
   128                 || (node instanceof JCExpressionStatement
   131                     && ((JCExpressionStatement)node).expr instanceof JCErroneous),
   129                     && ((JCExpressionStatement)node).expr instanceof JCErroneous),
   132                 node.getClass().getSimpleName());
   130                 node.getClass().getSimpleName());
   133         JCCompilationUnit tree = new JCCompilationUnit(packageAnnotations, pid, defs,
   131         JCCompilationUnit tree = new JCCompilationUnit(defs);
   134                                      null, null, null, null);
   132         tree.pos = pos;
       
   133         return tree;
       
   134     }
       
   135 
       
   136     public JCPackageDecl PackageDecl(List<JCAnnotation> annotations,
       
   137                                      JCExpression pid) {
       
   138         Assert.checkNonNull(annotations);
       
   139         Assert.checkNonNull(pid);
       
   140         JCPackageDecl tree = new JCPackageDecl(annotations, pid);
   135         tree.pos = pos;
   141         tree.pos = pos;
   136         return tree;
   142         return tree;
   137     }
   143     }
   138 
   144 
   139     public JCImport Import(JCTree qualid, boolean importStatic) {
   145     public JCImport Import(JCTree qualid, boolean importStatic) {