@Override public void visit(JavadocComment n, Void arg) { out.println("JavadocComment: " + (extended ? n : n.getContent())); super.visit(n, arg); }
@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()); }
if( method.hasComment() && method.getComment() instanceof JavadocComment ){ JavadocComment javaDoc = (JavadocComment)method.getComment(); // now you can get the content using String content = javaDoc.getContent(); }
@Override public boolean doIsEquals(JavadocComment first, JavadocComment second) { return similarity(first.getContent(), second.getContent()) > 0.9d; } }
/** * Get a text description from JavaDoc block comment. * * @param jdoc the javadoc block comment. * @return The description as String. */ public static String extractDescription(JavadocComment jdoc){ String content = jdoc.getContent().replaceAll("\n[ \t]+\\* ?","\n"); //remove the * at the beginning of a line int end = content.indexOf("\n@"); //look for the first annotation //The first charater is always a new line if(end>0) { return content.substring(1, end).trim(); } return content.substring(1).trim(); }
public static Javadoc parse(JavadocComment comment) { return parse(comment.getContent()); }
public static Javadoc parse(JavadocComment comment) { return parse(comment.getContent()); }
@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; }
String content = jdoc.getContent().replaceAll("\n[ \t]+\\* ?","\n"); //remove the * at the beginning of a line Set<String> result = new LinkedHashSet<>();
@Override public void visit(MethodDeclaration n, Void arg) { TestStep step = new TestStep(); step.stepMethod = n.getName().toString(); if (n.getJavadocComment().isPresent()) { step.stepDetails = n.getJavadocComment().get().getContent().replaceAll("\\s*\\*\\s+", "\n").trim(); } else { step.stepDetails = ""; } if (n.getAnnotationByName("Given").isPresent()) { step.stepName = getAnnotationString(n.getAnnotationByName("Given").get()); } else if (n.getAnnotationByName("When").isPresent()) { step.stepName = getAnnotationString(n.getAnnotationByName("When").get()); } else if (n.getAnnotationByName("Then").isPresent()) { step.stepName = getAnnotationString(n.getAnnotationByName("Then").get()); } else { step.stepName = n.getDeclarationAsString().split("throws ")[0].trim(); } steps.add(step); }