final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ANNOTATIONS_PROPERTY) { return annotations(); } if (property == MODULE_DIRECTIVES_PROPERTY) { return moduleStatements(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
@Override final List internalGetChildListProperty(ChildListPropertyDescriptor property) { if (property == ANNOTATIONS_PROPERTY) { return annotations(); } if (property == MODULE_DIRECTIVES_PROPERTY) { return moduleStatements(); } // allow default implementation to flag the error return super.internalGetChildListProperty(property); }
@Override public void endVisit(ModuleDeclaration node) { tryKeepOnOneLine(node, node.getName(), node.moduleStatements(), this.options.keep_type_declaration_on_one_line); }
@Override public boolean visit(ModuleDeclaration node) { // using settings for type declaration and fields for now, add new settings if necessary breakLineBefore(node); handleBracedCode(node, node.getName(), this.options.brace_position_for_type_declaration, this.options.indent_body_declarations_compare_to_type_header, this.options.insert_new_line_in_empty_type_declaration); List<ModuleDirective> statements = node.moduleStatements(); ModuleDirective previous = null; for (ModuleDirective statement : statements) { int blankLines = previous == null ? this.options.blank_lines_before_first_class_body_declaration : previous.getClass().equals(statement.getClass()) ? this.options.blank_lines_before_field : this.options.blank_lines_before_new_chunk; putBlankLinesBefore(statement, blankLines); previous = statement; } this.declarationModifierVisited = false; return true; }
@Override public boolean visit(ModuleDeclaration node) { // using settings for type declaration and fields for now, add new settings if necessary breakLineBefore(node); handleBracedCode(node, node.getName(), this.options.brace_position_for_type_declaration, this.options.indent_body_declarations_compare_to_type_header, this.options.insert_new_line_in_empty_type_declaration); List<ModuleDirective> statements = node.moduleStatements(); ModuleDirective previous = null; for (ModuleDirective statement : statements) { int blankLines = previous == null ? this.options.blank_lines_before_first_class_body_declaration : previous.getClass().equals(statement.getClass()) ? this.options.blank_lines_before_field : this.options.blank_lines_before_new_chunk; putBlankLinesBefore(statement, blankLines); previous = statement; } this.declarationModifierVisited = false; return true; }
@Override public boolean visit(ModuleDeclaration node) { // using settings for type declaration and fields for now, add new settings if necessary breakLineBefore(node); handleBracedCode(node, node.getName(), this.options.brace_position_for_type_declaration, this.options.indent_body_declarations_compare_to_type_header); List<ModuleDirective> statements = node.moduleStatements(); ModuleDirective previous = null; for (ModuleDirective statement : statements) { int blankLines = previous == null ? this.options.blank_lines_before_first_class_body_declaration : previous.getClass().equals(statement.getClass()) ? this.options.blank_lines_before_field : this.options.blank_lines_before_new_chunk; putBlankLinesBefore(statement, blankLines); previous = statement; } this.declarationModifierVisited = false; return true; }
@Override public boolean visit(ModuleDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } printModifiers(node.annotations()); if (node.isOpen()) this.fBuffer.append("open "); //$NON-NLS-1$ this.fBuffer.append("module"); //$NON-NLS-1$ this.fBuffer.append(" "); //$NON-NLS-1$ node.getName().accept(this); this.fBuffer.append(" {\n"); //$NON-NLS-1$ for (ModuleDirective stmt : (List<ModuleDirective>)node.moduleStatements()) { stmt.accept(this); } this.fBuffer.append("}"); //$NON-NLS-1$ return false; }
@Override public boolean visit(ModuleDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } printModifiers(node.annotations()); if (node.isOpen()) this.buffer.append("open "); //$NON-NLS-1$ this.buffer.append("module"); //$NON-NLS-1$ this.buffer.append(" "); //$NON-NLS-1$ node.getName().accept(this); this.buffer.append(" {\n"); //$NON-NLS-1$ this.indent++; for (ModuleDirective stmt : (List<ModuleDirective>)node.moduleStatements()) { stmt.accept(this); } this.indent--; this.buffer.append("}"); //$NON-NLS-1$ return false; }
@Override public boolean visit(ModuleDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); } printModifiers(node.annotations()); if (node.isOpen()) this.buffer.append("open "); //$NON-NLS-1$ this.buffer.append("module"); //$NON-NLS-1$ this.buffer.append(" "); //$NON-NLS-1$ node.getName().accept(this); this.buffer.append(" {\n"); //$NON-NLS-1$ this.indent++; for (ModuleDirective stmt : (List<ModuleDirective>)node.moduleStatements()) { stmt.accept(this); } this.indent--; this.buffer.append("}"); //$NON-NLS-1$ return false; }
@SuppressWarnings("unchecked") @Override ASTNode clone0(AST target) { ModuleDeclaration result = new ModuleDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); result.setJavadoc((Javadoc) ASTNode.copySubtree(target, getJavadoc())); result.setOpen(isOpen()); result.annotations().addAll(ASTNode.copySubtrees(target, annotations())); result.setName((SimpleName) getName().clone(target)); result.moduleStatements().addAll(ASTNode.copySubtrees(target, moduleStatements())); return result; }
@SuppressWarnings("unchecked") @Override ASTNode clone0(AST target) { ModuleDeclaration result = new ModuleDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); result.setJavadoc((Javadoc) ASTNode.copySubtree(target, getJavadoc())); result.setOpen(isOpen()); result.annotations().addAll(ASTNode.copySubtrees(target, annotations())); result.setName((SimpleName) getName().clone(target)); result.moduleStatements().addAll(ASTNode.copySubtrees(target, moduleStatements())); return result; }
/** * Returns whether the given node and the other object match. * <p> * The default implementation provided by this class tests whether the * other object is a node of the same type with structurally isomorphic * child subtrees. Subclasses may override this method as needed. * </p> * * @param node the node * @param other the other object, or <code>null</code> * @return <code>true</code> if the subtree matches, or * <code>false</code> if they do not match or the other object has a * different node type or is <code>null</code> * @since 3.14 */ public boolean match(ModuleDeclaration node, Object other) { if (!(other instanceof ModuleDeclaration)) { return false; } ModuleDeclaration o = (ModuleDeclaration) other; return (safeSubtreeMatch(node.getJavadoc(), o.getJavadoc()) && safeSubtreeListMatch(node.annotations(), o.annotations()) && node.isOpen() == o.isOpen() && safeSubtreeMatch(node.getName(), o.getName()) && safeSubtreeListMatch(node.moduleStatements(), o.moduleStatements())); }
/** * Returns whether the given node and the other object match. * <p> * The default implementation provided by this class tests whether the * other object is a node of the same type with structurally isomorphic * child subtrees. Subclasses may override this method as needed. * </p> * * @param node the node * @param other the other object, or <code>null</code> * @return <code>true</code> if the subtree matches, or * <code>false</code> if they do not match or the other object has a * different node type or is <code>null</code> * @since 3.14 */ public boolean match(ModuleDeclaration node, Object other) { if (!(other instanceof ModuleDeclaration)) { return false; } ModuleDeclaration o = (ModuleDeclaration) other; return (safeSubtreeMatch(node.getJavadoc(), o.getJavadoc()) && safeSubtreeListMatch(node.annotations(), o.annotations()) && node.isOpen() == o.isOpen() && safeSubtreeMatch(node.getName(), o.getName()) && safeSubtreeListMatch(node.moduleStatements(), o.moduleStatements())); }
moduleDecl.setName(moduleName); List<ModuleDirective> stmts = moduleDecl.moduleStatements(); TreeSet<ModuleDirective> tSet = new TreeSet<> (new Comparator() { @Override
moduleDecl.setName(moduleName); List<ModuleDirective> stmts = moduleDecl.moduleStatements(); TreeSet<ModuleDirective> tSet = new TreeSet<> (new Comparator() { public int compare(Object o1, Object o2) {
ListRewrite listRewrite= rewrite.getListRewrite(moduleDecl, ModuleDeclaration.MODULE_DIRECTIVES_PROPERTY); boolean requiresAlreadyPresent= false; List<ModuleDirective> moduleStatements= moduleDecl.moduleStatements(); ModuleDirective lastModuleRequiresDirective= null; if (moduleStatements != null) {