@Override public void visit(ClassOrInterfaceDeclaration node, Void arg) { super.visit(node, arg); replaceParentClassesForAtomics(node); node.setName(translateQueueName(node.getNameAsString())); if (MPSC_LINKED_ATOMIC_QUEUE_NAME.equals(node.getNameAsString())) { /* * Special case for MPSC */ node.removeModifier(Modifier.ABSTRACT); node.addModifier(Modifier.FINAL); } if (isCommentPresent(node, GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS)) { node.setComment(null); removeStaticFieldsAndInitialisers(node); patchAtomicFieldUpdaterAccessorMethods(node); } for (MethodDeclaration method : node.getMethods()) { if (isCommentPresent(method, GEN_DIRECTIVE_METHOD_IGNORE)) { method.remove(); } } node.setJavadocComment(formatMultilineJavadoc(0, "NOTE: This class was automatically generated by " + JavaParsingAtomicLinkedQueueGenerator.class.getName(), "which can found in the jctools-build module. The original source file is " + sourceFileName + ".") + node.getJavadocComment().orElse(new JavadocComment("")).getContent()); }
@Override public void visit(ClassOrInterfaceDeclaration node, Void arg) { super.visit(node, arg); replaceParentClassesForAtomics(node); node.setName(translateQueueName(node.getNameAsString())); if (isCommentPresent(node, GEN_DIRECTIVE_CLASS_CONTAINS_ORDERED_FIELD_ACCESSORS)) { node.setComment(null); removeStaticFieldsAndInitialisers(node); patchAtomicFieldUpdaterAccessorMethods(node); } for (MethodDeclaration method : node.getMethods()) { if (isCommentPresent(method, GEN_DIRECTIVE_METHOD_IGNORE)) { method.remove(); } } if (!node.getMethodsByName("failFastOffer").isEmpty()) { MethodDeclaration deprecatedMethodRedirect = node.addMethod("weakOffer", Modifier.PUBLIC); patchMethodAsDepreciatedRedirector(deprecatedMethodRedirect, "failFastOffer", PrimitiveType.intType(), new Parameter(classType("E"), "e")); } node.setJavadocComment(formatMultilineJavadoc(0, "NOTE: This class was automatically generated by " + JavaParsingAtomicArrayQueueGenerator.class.getName(), "which can found in the jctools-build module. The original source file is " + sourceFileName + ".") + node.getJavadocComment().orElse(new JavadocComment("")).getContent()); }
/** * Create a JavadocComment, by formatting the text of the Javadoc using the given indentation. */ public JavadocComment toComment(String indentation) { for (char c : indentation.toCharArray()) { if (!Character.isWhitespace(c)) { throw new IllegalArgumentException("The indentation string should be composed only by whitespace characters"); } } StringBuilder sb = new StringBuilder(); sb.append(EOL); final String text = toText(); if (!text.isEmpty()) { for (String line : text.split(EOL)) { sb.append(indentation); sb.append(" * "); sb.append(line); sb.append(EOL); } } sb.append(indentation); sb.append(" "); return new JavadocComment(sb.toString()); }
/** * Create a JavadocComment, by formatting the text of the Javadoc using the given indentation. */ public JavadocComment toComment(String indentation) { for (char c : indentation.toCharArray()) { if (!Character.isWhitespace(c)) { throw new IllegalArgumentException("The indentation string should be composed only by whitespace characters"); } } StringBuilder sb = new StringBuilder(); sb.append(EOL); final String text = toText(); if (!text.isEmpty()) { for (String line : text.split(EOL)) { sb.append(indentation); sb.append(" * "); sb.append(line); sb.append(EOL); } } sb.append(indentation); sb.append(" "); return new JavadocComment(sb.toString()); }
@Override public JavadocComment doMerge(JavadocComment first, JavadocComment second) { JavadocComment comment = new JavadocComment(); if(first.getContent().length() > second.getContent().length()){ comment.setContent(first.getContent()); copyPosition(first,comment); }else { comment.setContent(second.getContent()); copyPosition(second,comment); } return comment; }
public String format() { CompilationUnit cu = new CompilationUnit(); if (fileComment != null) { cu.addOrphanComment(new JavadocComment(fileComment)); } cu.setPackageDeclaration(pkg); for (String imp : imports) { cu.addImport(imp); } cu.addType(type); for (Member member : gatherFinalMembers(members, cu)) { type.addMember(member.getDeclaration()); } return cu.toString(); }