CompilationUnit unit = new CompilationUnit();
if (node.pid != null) {
PackageDeclaration pkg = new PackageDeclaration();
fillWithIdentifiers(node.pid, pkg.astParts());
unit.astPackageDeclaration(setPos(node.pid, pkg));
fillList(node.packageAnnotations, pkg.rawAnnotations());
}
for (JCTree def : node.defs) {
if (def instanceof JCImport) {
unit.rawImportDeclarations().addToEnd(toTree(def));