public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) { CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration); if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n); if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n); return posify(unit); }
@Override public void visitCompilationUnitDeclaration(CompilationUnitDeclaration node) { lombok.ast.CompilationUnit unit = new lombok.ast.CompilationUnit(); unit.rawPackageDeclaration(toTree(node.currentPackage, FlagKey.IMPORTDECLARATION_IS_PACKAGE)); if (node.javadoc != null) { lombok.ast.PackageDeclaration lombokJavadoc = unit.astPackageDeclaration(); if (lombokJavadoc != null) { lombokJavadoc.rawJavadoc(toTree(node.javadoc)); } } fillList(node.imports, unit.rawImportDeclarations()); TypeDeclaration[] newTypes = null; if (node.types != null && node.types.length > 0 && CharOperation.equals(EcjTreeBuilder.PACKAGE_INFO, node.types[0].name)) { newTypes = new TypeDeclaration[node.types.length - 1]; System.arraycopy(node.types, 1, newTypes, 0, node.types.length - 1); } else { newTypes = node.types; } fillList(newTypes, unit.rawTypeDeclarations()); set(node, unit); }
@Override public void visitCompilationUnitDeclaration(CompilationUnitDeclaration node) { lombok.ast.CompilationUnit unit = new lombok.ast.CompilationUnit(); unit.rawPackageDeclaration(toTree(node.currentPackage, FlagKey.IMPORTDECLARATION_IS_PACKAGE)); if (node.javadoc != null) { lombok.ast.PackageDeclaration lombokJavadoc = unit.astPackageDeclaration(); if (lombokJavadoc != null) { lombokJavadoc.rawJavadoc(toTree(node.javadoc)); } } fillList(node.imports, unit.rawImportDeclarations()); TypeDeclaration[] newTypes = null; if (node.types != null && node.types.length > 0 && CharOperation.equals(EcjTreeBuilder.PACKAGE_INFO, node.types[0].name)) { newTypes = new TypeDeclaration[node.types.length - 1]; System.arraycopy(node.types, 1, newTypes, 0, node.types.length - 1); } else { newTypes = node.types; } fillList(newTypes, unit.rawTypeDeclarations()); set(node, unit); }
@Override public void visitCompilationUnitDeclaration(CompilationUnitDeclaration node) { lombok.ast.CompilationUnit unit = new lombok.ast.CompilationUnit(); unit.rawPackageDeclaration(toTree(node.currentPackage, FlagKey.IMPORTDECLARATION_IS_PACKAGE)); if (node.javadoc != null) { lombok.ast.PackageDeclaration lombokJavadoc = unit.astPackageDeclaration(); if (lombokJavadoc != null) { lombokJavadoc.rawJavadoc(toTree(node.javadoc)); } } fillList(node.imports, unit.rawImportDeclarations()); TypeDeclaration[] newTypes = null; if (node.types != null && node.types.length > 0 && CharOperation.equals(EcjTreeBuilder.PACKAGE_INFO, node.types[0].name)) { newTypes = new TypeDeclaration[node.types.length - 1]; System.arraycopy(node.types, 1, newTypes, 0, node.types.length - 1); } else { newTypes = node.types; } fillList(newTypes, unit.rawTypeDeclarations()); set(node, unit); }
public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) { CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration); if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n); if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n); return posify(unit); }
public Node createCompilationUnit(Node packageDeclaration, List<Node> importDeclarations, List<Node> typeDeclarations) { CompilationUnit unit = new CompilationUnit().rawPackageDeclaration(packageDeclaration); if (importDeclarations != null) for (Node n : importDeclarations) if (n != null) unit.rawImportDeclarations().addToEnd(n); if (typeDeclarations != null) for (Node n : typeDeclarations) if (n != null) unit.rawTypeDeclarations().addToEnd(n); return posify(unit); }
@Override public void visitTopLevel(JCCompilationUnit node) { 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)); } else { unit.rawTypeDeclarations().addToEnd(toTree(def, FlagKey.SKIP_IS_DECL)); } } setConversionStructureInfo(unit, "converted"); set(node, unit); }
@Override public void visitTopLevel(JCCompilationUnit node) { 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)); } else { unit.rawTypeDeclarations().addToEnd(toTree(def, FlagKey.SKIP_IS_DECL)); } } setConversionStructureInfo(unit, "converted"); set(node, unit); }
@Override public void visitTopLevel(JCCompilationUnit node) { 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)); } else { unit.rawTypeDeclarations().addToEnd(toTree(def, FlagKey.SKIP_IS_DECL)); } } setConversionStructureInfo(unit, "converted"); set(node, unit); }