pax_global_header00006660000000000000000000000064140505210270014506gustar00rootroot0000000000000052 comment=54d55175b6500b4742ea3cf142263b2ef955da13 vertx-docgen-0.9.4/000077500000000000000000000000001405052102700141255ustar00rootroot00000000000000vertx-docgen-0.9.4/.editorconfig000066400000000000000000000002231405052102700165770ustar00rootroot00000000000000root = true [*] charset = utf-8 indent_style = space indent_size = 2 trim_trailing_whitespace = true end_of_line = lf insert_final_newline = true vertx-docgen-0.9.4/.gitignore000066400000000000000000000003261405052102700161160ustar00rootroot00000000000000pom.xml.versionsBackup .DS_Store .gradle .idea *.iml *.ipr *.iws .classpath .project .settings .yardoc .yardopts bin build target out test-output Scratch.java ScratchTest.java test-results test-tmp *.class src/gen vertx-docgen-0.9.4/.travis.deploy.artifacts.sh000066400000000000000000000005151405052102700213220ustar00rootroot00000000000000PROJECT_VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:evaluate -Dexpression=project.version -B | grep -v '\[') if [[ "$PROJECT_VERSION" =~ .*SNAPSHOT ]] && [[ "${TRAVIS_BRANCH}" =~ ^master$|^[0-9]+\.[0-9]+$ ]] && [[ "${TRAVIS_PULL_REQUEST}" = "false" ]]; then mvn deploy -s .travis.maven.settings.xml -DskipTests -B; fi vertx-docgen-0.9.4/.travis.maven.settings.xml000066400000000000000000000010201405052102700211720ustar00rootroot00000000000000 false sonatype-nexus-snapshots ${env.SONATYPE_NEXUS_USERNAME} ${env.SONATYPE_NEXUS_PASSWORD} vertx-docgen-0.9.4/.travis.yml000066400000000000000000000013521405052102700162370ustar00rootroot00000000000000language: java branches: only: - master - /^\d+\.\d+$/ cache: directories: - $HOME/.m2 before_cache: - rm -rf $HOME/.m2/repository/io/vertx/ jobs: include: - stage: test name: "OpenJDK 8" jdk: openjdk8 script: mvn -q clean verify -B - stage: deploy name: "Deploy to Sonatype's snapshots repository" if: type != pull_request AND env(SONATYPE_NEXUS_USERNAME) IS present script: bash .travis.deploy.artifacts.sh notifications: email: recipients: - secure: "V2q/8MNZl3n735Yq2ELXXge8Dhhvk2Js3XauNenWZtqLnKoonANcl8RZir5tTnL67+P6GSqxwb4L9DyipuyZXTgoyTPDi/vTD2Qf2BJFdN8nsYJrdf3ABEbLHqU8BoKogt9JD+AWYCsPGeAnXc2GvDmewHhgB0S6UUa5BeEbWxw=" on_success: always on_failure: always vertx-docgen-0.9.4/LICENSE.txt000066400000000000000000000261351405052102700157570ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. vertx-docgen-0.9.4/README.md000066400000000000000000000125471405052102700154150ustar00rootroot00000000000000# Docgen [![Build Status](https://travis-ci.org/vert-x3/vertx-docgen.svg?branch=master?branch=master)](https://travis-ci.org/vert-x3/vertx-docgen) ## Description Create an Asciidoc document from package Javadoc. It comes as an annotation processor that process the various package Javadoc and create a single Asciidoc file during the compilation phase. ## Motivation - The documentation can reference the underlying API doc (Javadoc, Scaladoc, JSdoc, etc…) : when the Asciidoc content is created the `{@link}` are transformed to a link to the API doc - The documentation always point to an existing API, i.e the {@link} references validity are checked and make the compilation fails - Refactoring friendly, when you rename a method the corresponding {@link} are updated, allowing you easily spot the affected doc (using git diff or something) ## Features ### Document declaration `@Document` annotations are processed, each annotated package creates a corresponding asciidoc document. The annotation can specify an optional `fileName` member otherwise the document file name will be generated using the annotated element. File documents can also be processed with the `docgen.source` processor option. ### Document modulalization The `{@link }` Javadoc tag includes or link to the target doc when the target is a package. This can be used to make your documentation modular and split the various chapters of the document accross the API packages. When the package is annotated with `@Document` the link renders to a relative file url, otherwise its content will be literaly included in the document. ### Source inclusion The `{@link }` Javadoc tag includes the referenced elements when this element is annotated with a `io.vertx.docgen.Source` annotation (otherwise it will just create a link). The `@Source` annotation can annotate a single method, a class or a package. By default the source code is translated to the output language. This feature can be disabled with `@Source (translate=false)`. When including source code, the _closest_ (class, package, parent package...) `@Source` annotation is looked up and the value of the `translate` attribute is used. When `translate` is set to `false`, it supports the inclusion of Java file (entire file) in the documentation with the following syntax: ``` [source, java] ---- {@link org.acme.MyClass} ---- ``` ### Lang token The `$lang` token is replaced by the processed language in: - `docgen.output` - processed text (@Source is excluded) The `\$lang` escapes to `$lang`. ### Language-based content You can decided that some content is only applicable for a set of languages. This is doable using: ``` [language, java] ---- This is only for java ---- ``` or ``` [language, ruby, groovy] ---- This is only for ruby and groovy. ---- ``` If the block is only on one line the following syntax is accepted: ``` [language, ruby] This is only for ruby ``` If the block contains a "sub-block" such as code, the `----` must be prepended by a `\`: ``` [language, java] ---- [source] \---- System.out.println("Hello"); \---- ---- ``` ### Referencing program elements The `{@link }` Javadoc tag creates a link to the Javadoc of a program element when the target is a type, a field or a method. ## Configuration The annotation processor can be configured via annotation processing options: - `docgen.output` : path of the file output dir, the path may contain the token `$lang` that will be subsituted by the current language being generated (the `docgen.json` name field) - `docgen.extension` : the file extension to use when file names are generated, defaults to `.adoc` ## Example See the nested [test_proj](https://github.com/vert-x3/vertx-docgen/tree/master/test-proj) project for Maven and Gradle examples. Given the files: ``` /** * = The great project * * include::{@link test.proj.foofeature}[] * */ @io.vertx.docgen.Document(fileName = "index.adoc") package test.proj; ``` ``` /** * == The foo feature. * * The {@link test.proj.foofeature.FooApi api class} * The {@link test.proj.foofeature.FooApi#myMethod api method} * The {@link test.proj.foofeature.FooApi#myField api field} * * * item1 * * item 2 * * item 3 * * Some code: * * [source,java] * ---- * {@link test.proj.foofeature.Examples#fooExample} * ---- * <1> get a Foo * <2> call {@link test.proj.foofeature.FooApi#myMethod api method} * * === A sub section * * {@link test.proj.foofeature.subsection} */ @io.vertx.docgen.Document package test.proj.foofeature; ``` ``` /** * A literaly included section */ package test.proj.foofeature.subsection; ``` Generate the following Asciidoc files: ``` = The great project include::test.proj.foofeature.adoc[] ``` _test.proj.adoc_ ``` == The foo feature. The link:apidocs/test/proj/foofeature/FooApi.html[`api class`] The link:apidocs/test/proj/foofeature/FooApi.html#myMethod-java.lang.String-int-java.util.List-java.util.Set-[`api method`] The link:apidocs/test/proj/foofeature/FooApi.html#myField[`api field`] * item1 * item 2 * item 3 Some code: [source,java] ---- FooApi foo = getFoo(); // <1> List list = new ArrayList<>(); Set set = new HashSet<>(); foo.myMethod("whatever", 0, list, set); // <2> ---- <1> get a Foo <2> call link:apidocs/test/proj/foofeature/FooApi.html#myMethod-java.lang.String-int-java.util.List-java.util.Set-[`api method`] === A sub section A literaly included section ``` _test.proj.foofeature.adoc_ vertx-docgen-0.9.4/pom.xml000066400000000000000000000040061405052102700154420ustar00rootroot00000000000000 io.vertx vertx-parent 19 4.0.0 vertx-docgen 0.9.4 scm:git:git@github.com:vert-x3/vertx-docgen.git scm:git:git@github.com:vert-x3/vertx-docgen.git git@github.com:vert-x3/vertx-docgen.git ${java.home}/../lib/tools.jar com.sun tools 1.8 system ${tools.jar} true junit junit 4.12 test maven-compiler-plugin default-testCompile io/vertx/test/** org.apache.maven.plugins maven-surefire-plugin vertx-docgen-0.9.4/src/000077500000000000000000000000001405052102700147145ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/000077500000000000000000000000001405052102700156405ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/java/000077500000000000000000000000001405052102700165615ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/java/io/000077500000000000000000000000001405052102700171705ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/java/io/vertx/000077500000000000000000000000001405052102700203405ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/000077500000000000000000000000001405052102700215775ustar00rootroot00000000000000vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/BaseProcessor.java000066400000000000000000000615461405052102700252300ustar00rootroot00000000000000package io.vertx.docgen; import com.sun.source.doctree.*; import com.sun.source.doctree.ErroneousTree; import com.sun.source.doctree.LiteralTree; import com.sun.source.util.DocTreeScanner; import com.sun.source.util.DocTrees; import com.sun.source.util.TreePath; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.SourceVersion; import javax.lang.model.element.*; import javax.tools.Diagnostic; import javax.tools.JavaFileObject; import java.io.*; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author Julien Viet */ public abstract class BaseProcessor extends AbstractProcessor { private static final String DOCGEN_OUTPUT = "docgen.output", DOCGEN_EXTENSION = "docgen.extension", DOCGEN_SOURCE = "docgen.source", DOCGEN_SYNTAX = "docgen.syntax"; protected DocTrees docTrees; protected Helper helper; protected List sources; protected Set postProcessors = new LinkedHashSet<>(); protected Map resolutions = new HashMap<>(); protected Syntax syntax; Map failures = new HashMap<>(); @Override public SourceVersion getSupportedSourceVersion() { return SourceVersion.RELEASE_8; } @Override public Set getSupportedOptions() { return new HashSet<>(Arrays.asList(DOCGEN_OUTPUT, DOCGEN_EXTENSION, DOCGEN_SOURCE)); } @Override public Set getSupportedAnnotationTypes() { return Collections.singleton("*"); } public synchronized BaseProcessor registerPostProcessor(PostProcessor postProcessor) { if (getPostProcessor(postProcessor.getName()) != null) { throw new IllegalArgumentException("Post-processor with name '" + postProcessor.getName() + "' is already " + "registered."); } postProcessors.add(postProcessor); return this; } public synchronized PostProcessor getPostProcessor(String name) { for (PostProcessor pp : postProcessors) { if (pp.getName().equalsIgnoreCase(name)) { return pp; } } return null; } @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); String sourceOpt = processingEnv.getOptions().get(DOCGEN_SOURCE); if (sourceOpt != null) { sources = new ArrayList<>(Arrays.asList(sourceOpt.split("\\s*,\\s*"))); } docTrees = DocTrees.instance(processingEnv); helper = new Helper(processingEnv); String syntaxOpt = processingEnv.getOptions().get(DOCGEN_SYNTAX); this.syntax = "markdown".equals(syntaxOpt) ? Syntax.MARKDOWN : Syntax.ASCIIDOC; registerPostProcessor(new LanguageFilterPostProcessor()); } private String render(List trees) { StringBuilder buffer = new StringBuilder(); DocTreeVisitor visitor = new DocTreeScanner() { @Override public Void visitText(TextTree node, Void aVoid) { buffer.append(node.getBody()); return super.visitText(node, aVoid); } }; trees.forEach(tree -> tree.accept(visitor, null)); return buffer.toString(); } private final Map> state = new HashMap<>(); @Override public boolean process(Set annotations, RoundEnvironment roundEnv) { StackTraceElement[] trace = Thread.currentThread().getStackTrace(); for (StackTraceElement elt : trace) { if (elt.getClassName().startsWith("org.jetbrains")) { return true; } } if (failures.isEmpty()) { try { if (!roundEnv.processingOver()) { roundEnv.getElementsAnnotatedWith(Document.class).forEach(elt -> { try { PackageDoc doc = new PackageDoc((PackageElement) elt); state.put(doc, handleGen(doc)); } catch (DocGenException e) { if (e.element == null) { e.element = elt; } throw e; } }); if (sources != null && sources.size() > 0) { for (String source : sources) { // Handle wildcards List files = new ArrayList<>(); File f = new File(source); if (!f.exists()) { if (f.getName().contains("*")) { StringBuilder sb = new StringBuilder(); for (char c : f.getName().toCharArray()) { if (c == '*') { sb.append(".*"); } else { sb.append(Matcher.quoteReplacement(Character.toString(c))); } } Pattern p = Pattern.compile(sb.toString()); File parentFile = f.getParentFile(); File[] children = parentFile.listFiles(); if (children != null) { for (File child : children) { if (p.matcher(child.getName()).matches()) { files.add(child); } } } } else { throw new FileNotFoundException("Cannot process document " + source); } } else { files.add(f); } for (File file : files) { if (file.isFile()) { FileDoc fileDoc = new FileDoc(file, file.getName()); Map m = handleGen(fileDoc); state.put(fileDoc, m); } else if (file.isDirectory()) { Files.walk(file.toPath()) .map(Path::toFile) .filter(File::isFile).forEach(docFile -> { String relativePath = file.toPath().relativize(docFile.toPath()).toString(); FileDoc fileDoc = new FileDoc(docFile, relativePath); Map m = handleGen(fileDoc); state.put(fileDoc, m); }); } else { throw new IOException("Document " + file.getAbsolutePath() + " is not a file nor a dir"); } } } sources.clear(); } Set processed = new HashSet<>(); while (true) { Optional opt = resolutions .values() .stream() .filter(res -> res.elt == null && !processed.contains(res.signature)) .findFirst(); if (opt.isPresent()) { ElementResolution res = opt.get(); processed.add(res.signature); res.tryResolve(); } else { break; } } } else { state.forEach((doc, m) -> { m.forEach((gen, w) -> { String content = postProcess(gen.getName(), w.render()); write(gen, doc, content); }); }); } } catch(Exception e) { Element reportedElt = (e instanceof DocGenException) ? ((DocGenException) e).element : null; String msg = e.getMessage(); if (msg == null) { msg = e.toString(); } e.printStackTrace(); if (reportedElt != null) { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg, reportedElt); if (reportedElt instanceof PackageElement) { failures.put(((PackageElement) reportedElt).getQualifiedName().toString(), msg); } else { throw new UnsupportedOperationException("not implemented"); } } else { processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, msg); } } } return false; } protected abstract Iterable generators(); private Map handleGen(Doc doc) { Map map = new HashMap<>(); for (DocGenerator generator : generators()) { generator.init(processingEnv); DocWriter writer = new DocWriter(); doc.process(generator, writer); map.put(generator, writer); } return map; } /** * @return the extension obtained from processor option {@literal docgen.extension} defaults to {@literal .adoc} * when absent. */ protected String getExtension() { String extension = processingEnv.getOptions().get(DOCGEN_EXTENSION); if (extension != null) { return extension; } return ".adoc"; } protected String resolveLinkToPackageDoc(PackageElement elt) { Document annotation = elt.getAnnotation(Document.class); String fileName = annotation.fileName(); if (fileName.isEmpty()) { return elt.toString() + getExtension(); } else { return fileName; } } private URL getURL(JavaFileObject fileObject) { try { return fileObject.toUri().toURL(); } catch (Exception e) { return null; } } /** * Resolve a label for the specified element, this is used when a link to a program element * does not specify an explicit label.

*

* Subclasses can override it to implement a particular behavior for elements. * * @param elt the elt to resolve a label for * @return the label */ private String resolveLabel(DocGenerator generator, Element elt) { String label = elt.getSimpleName().toString(); if (elt.getModifiers().contains(Modifier.STATIC) && (elt.getKind() == ElementKind.METHOD || elt.getKind() == ElementKind.FIELD)) { label = elt.getEnclosingElement().getSimpleName() + "." + label; } if (elt.getKind() == ElementKind.ANNOTATION_TYPE) { label = "@" +label; } return generator.resolveLabel(elt, label); } private final LinkedList stack = new LinkedList<>(); abstract class Doc { abstract String id(); abstract String resolveRelativeFileName(DocGenerator generator); protected final void process(DocGenerator generator, DocWriter writer) { if (this instanceof PackageDoc) { PackageElement pkgElt = ((PackageDoc) this).elt; for (PackageElement stackElt : stack) { if (pkgElt.getQualifiedName().equals(stackElt.getQualifiedName())) { throw new DocGenException(stack.peekLast(), "Circular include"); } } stack.addLast(pkgElt); String pkgSource = helper.readSource(pkgElt); TreePath pkgPath = docTrees.getPath(pkgElt); DocCommentTree docTree = docTrees.getDocCommentTree(pkgPath); DocTreeVisitor visitor = new DocTreeScanner() { private void copyContent(DocTree node) { int from = (int) docTrees.getSourcePositions().getStartPosition(pkgPath.getCompilationUnit(), docTree, node); int to = (int) docTrees.getSourcePositions().getEndPosition(pkgPath.getCompilationUnit(), docTree, node); writer.append(pkgSource, from, to); } @Override public Void visitUnknownBlockTag(UnknownBlockTagTree node, Void v) { writer.append("@").append(node.getTagName()).append(" "); return super.visitUnknownBlockTag(node, v); } @Override public Void visitDocComment(DocCommentTree node, Void v) { v = scan(node.getFirstSentence(), v); List body = node.getBody(); if (body.size() > 0) { writer.append("\n\n"); writer.resetParagraph(); v = scan(body, v); } List blockTags = node.getBlockTags(); if (blockTags.size() > 0) { writer.append("\n"); v = scan(blockTags, v); } return v; } @Override public Void visitErroneous(ErroneousTree node, Void v) { return visitText(node, v); } @Override public Void visitText(TextTree node, Void v) { String body = node.getBody(); helper.filterLang(body, generator.getName(), writer); return super.visitText(node, v); } /** * Handles both literal and code. We generate the asciidoc output using {@literal `}. */ @Override public Void visitLiteral(LiteralTree node, Void aVoid) { writer.append("`").append(node.getBody().getBody()).append("`"); return super.visitLiteral(node, aVoid); } @Override public Void visitEntity(EntityTree node, Void aVoid) { writer.append(EntityUtils.unescapeEntity(node.getName().toString())); return super.visitEntity(node, aVoid); } @Override public Void visitStartElement(StartElementTree node, Void v) { copyContent(node); return v; } @Override public Void visitEndElement(EndElementTree node, Void v) { writer.write("'); return v; } @Override public Void visitLink(LinkTree node, Void v) { String signature = node.getReference().getSignature(); String label = render(node.getLabel()).trim(); BaseProcessor.this.visitLink(pkgElt, label, signature, generator, writer); return v; } }; docTree.accept(visitor, null); stack.removeLast(); } else { FileDoc fileDoc = (FileDoc) this; try { String content = new String(Files.readAllBytes(fileDoc.file.toPath()), StandardCharsets.UTF_8); StringBuilder intermediate = new StringBuilder(content.length()); helper.filterLang(content, generator.getName(), intermediate); content = intermediate.toString(); Matcher linkMatcher = LINK_PATTERN.matcher(content); int prev = 0; while (linkMatcher.find()) { writer.write(content, prev, linkMatcher.start() - prev); String value = linkMatcher.group(1).trim(); Matcher methodLinkMatcher = METHOD_LINK_PATTERN.matcher(value); if (methodLinkMatcher.find()) { String signature = value.substring(0, methodLinkMatcher.end()); String label = value.substring(methodLinkMatcher.end()).trim(); writer.exec(() -> { BaseProcessor.this.visitLink(null, label, signature, generator, writer); }); } prev = linkMatcher.end(); } writer.append(content, prev, content.length()); } catch (IOException e) { throw new DocGenException(e.getMessage()); } } } } class PackageDoc extends Doc { final PackageElement elt; PackageDoc(PackageElement elt) { this.elt = elt; } @Override public String id() { return elt.getQualifiedName().toString(); } /** * Return the relative file name of a document. * * @param generator the doc generator * @return the relative file name */ public String resolveRelativeFileName(DocGenerator generator) { Document doc = elt.getAnnotation(Document.class); String relativeName = doc.fileName(); if (relativeName.isEmpty()) { relativeName = elt.getQualifiedName() + getExtension(); } return generator.resolveRelativeFileName(elt, relativeName); } } class FileDoc extends Doc { final File file; final String relativePath; FileDoc(File file, String relativePath) { this.file = file; this.relativePath = relativePath; } @Override public String id() { return relativePath; } @Override public String resolveRelativeFileName(DocGenerator generator) { return relativePath; } } private static final Pattern LINK_PATTERN = Pattern.compile("\\{@link\\s([^}]+)\\}"); private static final Pattern METHOD_LINK_PATTERN = Pattern.compile( "^([$_\\w]+\\.)*[$_\\w]+" + "(?:" + "#[$_\\w]+" + "(?:(?:\\([^)]*)\\)|$|(?= ))" + ")?"); private void visitLink(PackageElement pkgElt, String label, String signature, DocGenerator generator, DocWriter writer) { ElementResolution res = resolutions.get(signature); if (res == null) { res = new ElementResolution(signature); resolutions.put(signature, res); } LinkProcessing fut = new LinkProcessing(generator, label); res.add(fut); writer.write(() -> { DocWriter ww = fut.writer; if (ww == null) { throw new DocGenException(pkgElt, "Could not resolve " + signature); } return ww; }); } /** * The resolution of an element. */ class ElementResolution { final String signature; private Element elt; private List handlers = new ArrayList<>(); public ElementResolution(String signature) { this.signature = signature; } boolean tryResolve() { if (elt == null) { doResolve(); } return elt != null; } public boolean equals(Object o) { if (o instanceof ElementResolution) { ElementResolution that = (ElementResolution) o; return signature.equals(that.signature); } else { return false; } } @Override public int hashCode() { return signature.hashCode(); } private void doResolve() { elt = helper.resolveLink(signature); if (elt != null) { for (LinkProcessing fut : handlers) { fut.handle(elt); } handlers.clear(); } } private void add(LinkProcessing fut) { if (elt != null) { fut.handle(elt); } else { handlers.add(fut); } } } class LinkProcessing { final DocGenerator generator; final String label; private DocWriter writer; public LinkProcessing(DocGenerator generator, String label) { this.generator = generator; this.label = label; } void handle(Element elt) { writer = new DocWriter(); if (elt instanceof PackageElement) { PackageElement includedElt = (PackageElement) elt; if (includedElt.getAnnotation(Document.class) == null) { new PackageDoc(includedElt).process(generator, writer); } else { String link = resolveLinkToPackageDoc((PackageElement) elt); writer.append(link); } } else { if (helper.isExample(elt)) { String source = helper.readSource(elt); switch (elt.getKind()) { case CONSTRUCTOR: case METHOD: // Check whether or not the fragment must be translated String fragment; if (helper.hasToBeTranslated(elt)) { // Invoke the custom renderer, this may should the translation to the expected language. fragment = generator.renderSource((ExecutableElement) elt, source); } else { // Do not call the custom rendering process, just use the default / java one. JavaDocGenerator javaGen = new JavaDocGenerator(); javaGen.init(processingEnv); fragment = javaGen.renderSource((ExecutableElement) elt, source); } if (fragment != null) { writer.literalMode(); writer.append(fragment); writer.commentMode(); } return; case CLASS: case INTERFACE: case ENUM: case ANNOTATION_TYPE: TypeElement typeElt = (TypeElement) elt; JavaDocGenerator javaGen = new JavaDocGenerator(); javaGen.init(processingEnv); fragment = javaGen.renderSource(typeElt, source); if (fragment != null) { writer.literalMode(); writer.append(fragment); writer.commentMode(); } return; default: throw new UnsupportedOperationException("unsupported element: " + elt.getKind()); } } String link; switch (elt.getKind()) { case CLASS: case INTERFACE: case ANNOTATION_TYPE: case ENUM: { TypeElement typeElt = (TypeElement) elt; link = generator.resolveTypeLink(typeElt); break; } case METHOD: { ExecutableElement methodElt = (ExecutableElement) elt; TypeElement typeElt = (TypeElement) methodElt.getEnclosingElement(); link = generator.resolveMethodLink(methodElt); break; } case CONSTRUCTOR: { ExecutableElement constructorElt = (ExecutableElement) elt; TypeElement typeElt = (TypeElement) constructorElt.getEnclosingElement(); link = generator.resolveConstructorLink(constructorElt); break; } case FIELD: case ENUM_CONSTANT: { VariableElement variableElt = (VariableElement) elt; TypeElement typeElt = (TypeElement) variableElt.getEnclosingElement(); link = generator.resolveFieldLink(variableElt); break; } default: throw new UnsupportedOperationException("Not yet implemented " + elt + " with kind " + elt.getKind()); } String s; if (label.length() == 0) { s = resolveLabel(generator, elt); } else { s = label; } if (link != null) { syntax.writeLink(link, s, writer); } else { writer.append("`").append(s).append("`"); } } } } protected String postProcess(String name, String content) { String processed = applyVariableSubstitution(content); processed = applyPostProcessors(name, processed); return processed; } protected void write(DocGenerator generator, Doc doc, String content) { String outputOpt = processingEnv.getOptions().get(DOCGEN_OUTPUT); if (outputOpt != null) { outputOpt = outputOpt.replace("$lang", generator.getName()); String relativeName = doc.resolveRelativeFileName(generator); try { File dir = new File(outputOpt); for (int i = relativeName.indexOf('/'); i != -1; i = relativeName.indexOf('/', i + 1)) { dir = new File(dir, relativeName.substring(0, i)); relativeName = relativeName.substring(i + 1); } File file = new File(dir, relativeName); ensureDir(file.getParentFile()); try (FileWriter writer = new FileWriter(file)) { writer.write(content); } } catch (IOException e) { e.printStackTrace(); } } } /** * Apply post-processors. * * @param content the (asciidoc) content * @return the content after post-processing. */ protected String applyPostProcessors(String name2, String content) { final List lines = Arrays.asList(content.split("\r?\n")); StringBuilder processed = new StringBuilder(); Iterator iterator = lines.iterator(); while (iterator.hasNext()) { String line = iterator.next(); String trimmedLine = line.trim(); if (!PostProcessor.isBlockDeclaration(trimmedLine)) { processed.append(line); if (iterator.hasNext()) { processed.append("\n"); } } else { String name = PostProcessor.getProcessorName(trimmedLine); String[] attributes = PostProcessor.getProcessorAttributes(trimmedLine); PostProcessor postProcessor = getPostProcessor(name); if (postProcessor == null) { processed.append(line); if (iterator.hasNext()) { processed.append("\n"); } } else { // Extract content. String block = PostProcessor.getBlockContent(iterator); processed.append(postProcessor.process(name2, block, attributes)); if (iterator.hasNext()) { processed.append("\n"); } } } } return processed.toString(); } private void ensureDir(File dir) { if (dir.exists()) { if (!dir.isDirectory()) { throw new DocGenException("File " + dir.getAbsolutePath() + " is not a dir"); } } else if (!dir.mkdirs()) { throw new DocGenException("could not create dir " + dir.getAbsolutePath()); } } /** * Replace `@{var} by the variable value passed to the annotation processor. * * @param content the content * @return the content with variable values */ public String applyVariableSubstitution(String content) { for (Map.Entry entry : processingEnv.getOptions().entrySet()) { content = content.replace("${" + entry.getKey() + "}", entry.getValue()); } return content; } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/DocGenException.java000066400000000000000000000006011405052102700254550ustar00rootroot00000000000000package io.vertx.docgen; import javax.lang.model.element.Element; /** * @author Julien Viet */ public class DocGenException extends RuntimeException { Element element; public DocGenException(Element element, String msg) { super(msg); this.element = element; } public DocGenException(String msg) { super(msg); } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/DocGenProcessor.java000066400000000000000000000022711405052102700255030ustar00rootroot00000000000000package io.vertx.docgen; import javax.annotation.processing.ProcessingEnvironment; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.ServiceLoader; /** * A doc gen processor that runs multiple generators at once. * * @author Julien Viet */ public class DocGenProcessor extends BaseProcessor { private List generators; public DocGenProcessor() { } public DocGenProcessor(DocGenerator... generators) { this.generators = Arrays.asList(generators.clone()); } @Override public synchronized void init(ProcessingEnvironment processingEnv) { super.init(processingEnv); // Service loader generators if (generators == null) { generators = new ArrayList<>(); Iterator it = ServiceLoader.load(DocGenerator.class, DocGenProcessor.class.getClassLoader()).iterator(); while (it.hasNext()) { try { generators.add(it.next()); } catch (Exception e) { e.printStackTrace(); } } } } @Override protected Iterable generators() { return generators; } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/DocGenerator.java000066400000000000000000000045501405052102700250220ustar00rootroot00000000000000package io.vertx.docgen; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; /** * A doc generator plugin. * * @author Julien Viet */ public interface DocGenerator { /** * Init the generator. * * @param env the processor environment */ void init(ProcessingEnvironment env); /** * @return the generator name */ String getName(); /** * Resolve the relative file name of a document, the default implementation returns the {@literal relativeFileName} * parameter. * * @param docElt the doc element * @param relativeFileName the relative file name original value * @return the relative file name */ default String resolveRelativeFileName(PackageElement docElt, String relativeFileName) { return relativeFileName; } /** * Render the source code of the {@code elt} argument. * * @param elt the element to render * @param source the Java source of the element * @return the rendered source */ String renderSource(ExecutableElement elt, String source); /** * Resolve a constructor link. * * @param elt the element linked to * @return the resolved http link or null if the link cannot be resolved */ String resolveTypeLink(TypeElement elt); /** * Resolve a constructor link. * * @param elt the element linked to * @return the resolved http link or null if the link cannot be resolved */ String resolveConstructorLink(ExecutableElement elt); /** * Resolve a method link. * * @param elt the element linked to * @return the resolved http link or null if the link cannot be resolved */ String resolveMethodLink(ExecutableElement elt); /** * Resolve a field link. * * @param elt the element linked to * @return the resolved http link or null if the link cannot be resolved */ String resolveFieldLink(VariableElement elt); /** * Resolve a label. * * @param elt the labelled element * @param defaultLabel the default label * @return the resolved label or null if a label cannot be resolved */ String resolveLabel(Element elt, String defaultLabel); } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/DocWriter.java000066400000000000000000000076451405052102700243600ustar00rootroot00000000000000package io.vertx.docgen; import java.io.IOException; import java.io.Writer; import java.lang.reflect.UndeclaredThrowableException; import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; /** * @author Julien Viet */ class DocWriter extends Writer { private final StringBuilder delegate; private final List chunks = new ArrayList<>(); private int status; private boolean literal; DocWriter() { this.delegate = new StringBuilder(); this.status = 0; this.literal = false; } String render() { StringBuilder buffer = new StringBuilder(); render(buffer); return buffer.toString(); } private void render(StringBuilder buffer) { chunks.forEach(chunk -> { if (chunk instanceof Supplier) { Supplier consumer = (Supplier) chunk; DocWriter writer = consumer.get(); writer.render(buffer); } else { buffer.append(chunk); } }); buffer.append(delegate); delegate.setLength(0); chunks.clear(); } void exec(Runnable r) { boolean bl = literal; literal = false; status = 0; r.run(); literal = bl; } void resetParagraph() { status = 0; literal = false; } /** * Switch the write to literal mode: appended text is added as is. */ void literalMode() { literal = true; } /** * Switch to comment mode: after a \n char, the first space is skipped. This is needed * because the javadoc text we obtain adds an extra space, except for the first time. */ void commentMode() { literal = false; } void write(Supplier future) { if (delegate.length() > 0) { String s = delegate.toString(); delegate.setLength(0); chunks.add(s); } chunks.add(future); } @Override public void write(int c) { try { super.write(c); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public void write(char[] cbuf) { try { super.write(cbuf); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public void write(String str) { try { super.write(str); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public void write(String str, int off, int len) { try { super.write(str, off, len); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public DocWriter append(CharSequence csq) { try { return (DocWriter) super.append(csq); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public DocWriter append(CharSequence csq, int start, int end) { try { return (DocWriter) super.append(csq, start, end); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public DocWriter append(char c) { try { return (DocWriter) super.append(c); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } @Override public void write(char[] cbuf, int off, int len) { if (literal) { while (off < len) { delegate.append(cbuf[off++]); } } else { while (off < len) { char c = cbuf[off++]; switch (c) { case '\n': status = 1; delegate.append(c); break; case ' ': if (status == 1) { status = 2; } else { delegate.append(c); } break; default: delegate.append(c); if (status == 1) { status = 2; } break; } } } } @Override public void flush() throws IOException { } @Override public void close() throws IOException { } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/Document.java000066400000000000000000000011141405052102700242150ustar00rootroot00000000000000package io.vertx.docgen; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Declare a document to process. * * @author Julien Viet */ @Target(ElementType.PACKAGE) @Retention(RetentionPolicy.CLASS) public @interface Document { /** * @return the file name of this document, when no name is specified, the name will be generated * using the annotated package element. */ String fileName() default ""; } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/EntityUtils.java000066400000000000000000000035431405052102700247440ustar00rootroot00000000000000package io.vertx.docgen; /** * An utility class to handle entities. */ public final class EntityUtils { private EntityUtils() { // Avoid direct instantiation. } /** * Computes the character represented by the given entity. The entity can be given as {@code #xx} or as * {@code uXXXX}. Other form are wrapped into `&` and `;`. This wrapping is allowed as Asciidoctor * supports HTML entities, so we don't have to maintain a translation table. * * @param input the entity * @return the represented character */ public static String unescapeEntity(String input) { if (input == null || input.trim().length() == 0) { return ""; } if (input.startsWith("#")) { // The reference number can be either in hex or decimal: € or €. String withoutPrefix = input.substring(1); if (! withoutPrefix.isEmpty() && withoutPrefix.startsWith("x")) { withoutPrefix = withoutPrefix.substring(1); return parseAsHexa(input, withoutPrefix); } else { return parseAsDecimal(input, withoutPrefix); } } if (input.startsWith("u")) { String withoutPrefix = input.substring(1); return parseAsHexa(input, withoutPrefix); } return "&" + input + ";"; } private static String parseAsDecimal(String input, String withoutPrefix) { try { int parsed = Integer.parseInt(withoutPrefix); return Character.toString((char) parsed); } catch (NumberFormatException e) { // Invalid format - just return the input return input; } } private static String parseAsHexa(String input, String withoutPrefix) { try { int parsed = (int) Long.parseLong(withoutPrefix, 16); return Character.toString((char) parsed); } catch (NumberFormatException e) { // Invalid format - just return the input return input; } } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/Helper.java000066400000000000000000000244201405052102700236630ustar00rootroot00000000000000package io.vertx.docgen; import com.sun.source.tree.CompilationUnitTree; import com.sun.source.util.DocTrees; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.TypeParameterElement; import javax.lang.model.type.ArrayType; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.ExecutableType; import javax.lang.model.type.PrimitiveType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeVariable; import javax.lang.model.util.Elements; import javax.lang.model.util.Types; import java.io.IOException; import java.io.Reader; import java.lang.reflect.UndeclaredThrowableException; import java.util.Arrays; import java.util.List; import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author Julien Viet */ class Helper { static final Pattern LANG_PATTERN = Pattern.compile("(\\\\)?\\$lang"); final Types typeUtils; final Elements elementUtils; final DocTrees docTrees; public Helper(ProcessingEnvironment env) { typeUtils = env.getTypeUtils(); elementUtils = env.getElementUtils(); docTrees = DocTrees.instance(env); } boolean matchesConstructor(Element elt, String memberName, Predicate parametersMatcher) { if (elt.getKind() == ElementKind.CONSTRUCTOR) { ExecutableElement constructorElt = (ExecutableElement) elt; TypeElement typeElt = (TypeElement) constructorElt.getEnclosingElement(); return typeElt.getSimpleName().toString().equals(memberName) && parametersMatcher.test(constructorElt); } return false; } boolean matchesMethod(Element elt, String memberName, Predicate parametersMatcher) { if (elt.getKind() == ElementKind.METHOD) { ExecutableElement methodElt = (ExecutableElement) elt; return methodElt.getSimpleName().toString().equals(memberName) && parametersMatcher.test(methodElt); } return false; } boolean matchesFieldOrEnumConstant(Element elt, String memberName) { ElementKind kind = elt.getKind(); return (kind == ElementKind.FIELD || kind == ElementKind.ENUM_CONSTANT) && elt.getSimpleName().toString().equals(memberName); } private static final Pattern P = Pattern.compile("#(\\p{javaJavaIdentifierStart}(?:\\p{javaJavaIdentifierPart})*)(?:\\((.*)\\))?$"); public Element resolveLink(String signature) { Matcher signatureMatcher = P.matcher(signature); if (signatureMatcher.find()) { String memberName = signatureMatcher.group(1); String typeName = signature.substring(0, signatureMatcher.start()); TypeElement typeElt = elementUtils.getTypeElement(typeName); if (typeElt == null) { return null; } Predicate memberMatcher; if (signatureMatcher.group(2) != null) { String t = signatureMatcher.group(2).trim(); Predicate parametersMatcher; if (t.length() == 0) { parametersMatcher = exeElt -> exeElt.getParameters().isEmpty(); } else { parametersMatcher = parametersMatcher(t.split("\\s*,\\s*")); } memberMatcher = elt -> matchesConstructor(elt, memberName, parametersMatcher) || matchesMethod(elt, memberName, parametersMatcher); } else { memberMatcher = elt -> matchesConstructor(elt, memberName, exeElt -> true) || matchesMethod(elt, memberName, exeElt -> true) || matchesFieldOrEnumConstant(elt, memberName); } // The order of kinds is important for (ElementKind kind : Arrays.asList(ElementKind.FIELD, ElementKind.ENUM_CONSTANT, ElementKind.CONSTRUCTOR, ElementKind.METHOD)) { for (Element memberElt : elementUtils.getAllMembers(typeElt)) { if(memberElt.getKind() == kind && memberMatcher.test(memberElt)) { return memberElt; } } } return null; } else { Element elt = elementUtils.getTypeElement(signature); if (elt == null) { elt = elementUtils.getPackageElement(signature); } return elt; } } /** * Return a matcher for parameters, given the parameter type signature of an executable element. The parameter signature * is a list of parameter types formatted as a signature, i.e all types are raw, or primitive, or arrays. Unqualified * types are resolved against the import of the specified {@code compilationUnitTree} argument. * * @param parameterSignature the parameter type names * @return the matcher */ Predicate parametersMatcher(String[] parameterSignature) { return exeElt -> { if (exeElt.getParameters().size() == parameterSignature.length) { TypeMirror tm2 = exeElt.asType(); ExecutableType tm3 = (ExecutableType) typeUtils.erasure(tm2); for (int j = 0;j < parameterSignature.length;j++) { String t1 = toString(tm3.getParameterTypes().get(j)); String t2 = parameterSignature[j]; if (t2.indexOf('.') == -1) { t1 = t1.substring(t1.lastIndexOf('.') + 1); } else if (t1.indexOf('.') == -1) { t2 = t2.substring(t2.lastIndexOf('.') + 1); } if (!t1.equals(t2)) { return false; } } return true; } else { return false; } }; } /** * Check the element is an example or not. * * @param elt the elt to check * @return true when the checked element is an example */ boolean isExample(Element elt) { return elt.getAnnotation(Source.class) != null || elt.getEnclosingElement() != null && isExample(elt.getEnclosingElement()); } /** * Check the element is an example or not. * * @param elt the elt to check * @return true when the checked element is an example */ boolean hasToBeTranslated(Element elt) { // Find the closest source annotation // We are sure to have at least one as this method **must** be called after isExample. Element current = elt; Source source = current.getAnnotation(Source.class); while (source == null) { current = current.getEnclosingElement(); source = current.getAnnotation(Source.class); } return source.translate(); } /** * Read the source code of the provided element, this returns the source of the entire related compilation unit. * * @param elt the element to load * @return the source */ String readSource(Element elt) { CompilationUnitTree unit = docTrees.getPath(elt).getCompilationUnit(); StringBuilder source = new StringBuilder(); try(Reader reader = unit.getSourceFile().openReader(true)) { char[] buffer = new char[256]; while (true) { int len = reader.read(buffer); if (len == -1) { break; } source.append(buffer, 0, len); } return source.toString(); } catch (IOException e) { throw new DocGenException(elt, "Could not read source code of element " + elt); } } /** * Compute the string representation of a type mirror. * * @param mirror the type mirror * @return the string representation */ static String toString(TypeMirror mirror) { StringBuilder buffer = new StringBuilder(); toString(mirror, buffer); return buffer.toString(); } /** * Compute the string representation of a type mirror. * * @param mirror the type mirror * @param buffer the buffer appended with the string representation */ static void toString(TypeMirror mirror, StringBuilder buffer) { if (mirror instanceof DeclaredType) { DeclaredType dt = (DeclaredType) mirror; TypeElement elt = (TypeElement) dt.asElement(); buffer.append(elt.getQualifiedName().toString()); List args = dt.getTypeArguments(); if (args.size() > 0) { buffer.append("<"); for (int i = 0;i < args.size();i++) { if (i > 0) { buffer.append(","); } toString(args.get(i), buffer); } buffer.append(">"); } } else if (mirror instanceof PrimitiveType) { PrimitiveType pm = (PrimitiveType) mirror; buffer.append(pm.getKind().name().toLowerCase()); } else if (mirror instanceof javax.lang.model.type.WildcardType) { javax.lang.model.type.WildcardType wt = (javax.lang.model.type.WildcardType) mirror; buffer.append("?"); if (wt.getSuperBound() != null) { buffer.append(" super "); toString(wt.getSuperBound(), buffer); } else if (wt.getExtendsBound() != null) { buffer.append(" extends "); toString(wt.getExtendsBound(), buffer); } } else if (mirror instanceof javax.lang.model.type.TypeVariable) { javax.lang.model.type.TypeVariable tv = (TypeVariable) mirror; TypeParameterElement elt = (TypeParameterElement) tv.asElement(); buffer.append(elt.getSimpleName().toString()); if (tv.getUpperBound() != null && !tv.getUpperBound().toString().equals("java.lang.Object")) { buffer.append(" extends "); toString(tv.getUpperBound(), buffer); } else if (tv.getLowerBound() != null && tv.getLowerBound().getKind() != TypeKind.NULL) { buffer.append(" super "); toString(tv.getUpperBound(), buffer); } } else if (mirror instanceof javax.lang.model.type.ArrayType) { javax.lang.model.type.ArrayType at = (ArrayType) mirror; toString(at.getComponentType(), buffer); buffer.append("[]"); } else { throw new UnsupportedOperationException("todo " + mirror + " " + mirror.getKind()); } } public void filterLang(CharSequence csq, String lang, Appendable dst) { try { Matcher matcher = Helper.LANG_PATTERN.matcher(csq); int prev = 0; while (matcher.find()) { dst.append(csq, prev, matcher.start()); if (matcher.group(1) != null) { // \$lang dst.append("$lang"); } else { dst.append(lang); } prev = matcher.end(); } dst.append(csq, prev, csq.length()); } catch (IOException e) { throw new UndeclaredThrowableException(e); } } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/JavaDocGenProcessor.java000066400000000000000000000006451405052102700263100ustar00rootroot00000000000000package io.vertx.docgen; import java.util.Collections; /** * Processor specialized for Java. * * @author Julien Viet */ public class JavaDocGenProcessor extends BaseProcessor { @Override protected Iterable generators() { return Collections.singleton(generator()); } protected DocGenerator generator() { return new JavaDocGenerator(); } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/JavaDocGenerator.java000066400000000000000000000131061405052102700256210ustar00rootroot00000000000000package io.vertx.docgen; import com.sun.source.tree.BlockTree; import com.sun.source.tree.ClassTree; import com.sun.source.tree.CompilationUnitTree; import com.sun.source.tree.LineMap; import com.sun.source.tree.MethodTree; import com.sun.source.tree.StatementTree; import com.sun.source.tree.Tree; import com.sun.source.util.DocTrees; import com.sun.source.util.TreePath; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.ExecutableType; import javax.lang.model.type.TypeMirror; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * @author Julien Viet */ public class JavaDocGenerator implements DocGenerator { protected DocTrees docTrees; protected ProcessingEnvironment processingEnv; @Override public void init(ProcessingEnvironment env) { docTrees = DocTrees.instance(env); processingEnv = env; } @Override public String getName() { return "java"; } @Override public String resolveTypeLink(TypeElement elt) { return "../../apidocs/" + elt.getQualifiedName().toString().replace('.', '/') + ".html"; } @Override public String resolveConstructorLink(ExecutableElement elt) { return toExecutableLink(elt, elt.getEnclosingElement().getSimpleName().toString()); } @Override public String resolveMethodLink(ExecutableElement elt) { return toExecutableLink(elt, elt.getSimpleName().toString()); } @Override public String resolveLabel(Element elt, String defaultLabel) { return defaultLabel; } private String toExecutableLink(ExecutableElement elt, String name) { TypeElement typeElt = (TypeElement) elt.getEnclosingElement(); String link = resolveTypeLink(typeElt); StringBuilder anchor = new StringBuilder("#"); anchor.append(name).append('-'); TypeMirror type = elt.asType(); ExecutableType methodType = (ExecutableType) processingEnv.getTypeUtils().erasure(type); List parameterTypes = methodType.getParameterTypes(); for (int i = 0; i < parameterTypes.size(); i++) { if (i > 0) { anchor.append('-'); } // We need to check whether or not the parameter is annotated. In this case, we must use the unannotated type. TypeMirror typeOfParameter = parameterTypes.get(i); String s = typeOfParameter.toString(); Matcher matcher = A.matcher(s); if (matcher.matches()) { String t = matcher.group(1); anchor.append(t); } else { anchor.append(s); } } anchor.append('-'); return link + anchor; } private static final Pattern A = Pattern.compile("^\\(@[^ ]+ :: ([^\\\\]+)\\)$"); @Override public String resolveFieldLink(VariableElement elt) { TypeElement typeElt = (TypeElement) elt.getEnclosingElement(); String link = resolveTypeLink(typeElt); return link + "#" + elt.getSimpleName(); } /** * Render the source fragment for the Java language. Java being the pivot language, we consider this method as the * _default_ behavior. This method is final as it must not be overridden by any extension. * * @param elt the element * @param source the source * @return the fragment */ @Override public String renderSource(ExecutableElement elt, String source) { // Get block TreePath path = docTrees.getPath(elt); MethodTree methodTree = (MethodTree) path.getLeaf(); BlockTree blockTree = methodTree.getBody(); List statements = blockTree.getStatements(); if (statements.size() > 0) { return renderSource(path, statements, source); } else { return null; } } public String renderSource(TypeElement elt, String source) { TreePath path = docTrees.getPath(elt); ClassTree classTree = (ClassTree) path.getLeaf(); return renderSource(path, Collections.singletonList(classTree), source); } public String renderSource(TreePath path, List trees, String source) { CompilationUnitTree unit = path.getCompilationUnit(); int from = (int) docTrees.getSourcePositions().getStartPosition(unit, trees.get(0)); int to = (int) docTrees.getSourcePositions().getEndPosition(unit, trees.get(trees.size() - 1)); // Correct boundaries while (from > 1 && source.charAt(from - 1) != '\n') { from--; } while (to < source.length() && source.charAt(to) != '\n') { to++; } String block = source.substring(from, to); // Determine margin int blockMargin = Integer.MAX_VALUE; LineMap lineMap = unit.getLineMap(); for (Tree statement : trees) { int statementStart = (int) docTrees.getSourcePositions().getStartPosition(unit, statement); int lineStart = statementStart; while (lineMap.getLineNumber(statementStart) == lineMap.getLineNumber(lineStart - 1)) { lineStart--; } blockMargin = Math.min(blockMargin, statementStart - lineStart); } // Crop the fragment StringBuilder fragment = new StringBuilder(); for (Iterator sc = new Scanner(block).useDelimiter("\n"); sc.hasNext(); ) { String line = sc.next(); int margin = Math.min(blockMargin, line.length()); line = line.substring(margin); fragment.append(line); if (sc.hasNext()) { fragment.append('\n'); } } return fragment.toString(); } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/LanguageFilterPostProcessor.java000066400000000000000000000013741405052102700301060ustar00rootroot00000000000000package io.vertx.docgen; /** * A post processor filtering out content not matching the current processor language. */ public class LanguageFilterPostProcessor implements PostProcessor { @Override public String getName() { return "language"; } @Override public String process(String name, String content, String... args) { if (args.length == 0) { throw new IllegalArgumentException("The post-processor '" + getName() + "' requires at least one argument"); } if (matches(name, args)) { return content; } return EMPTY_CONTENT; } private boolean matches(String lang, String[] args) { for (String arg : args) { if (lang.equalsIgnoreCase(arg)) { return true; } } return false; } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/PostProcessor.java000066400000000000000000000037161405052102700252760ustar00rootroot00000000000000package io.vertx.docgen; import java.util.Arrays; import java.util.Iterator; import java.util.regex.Pattern; /** * Post processor interface. */ public interface PostProcessor { String EMPTY_CONTENT = ""; Pattern BLOCK_DECLARATION = Pattern.compile("\\[.+\\]"); String getName(); String process(String name, String content, String... args); static boolean isBlockDeclaration(String line) { return BLOCK_DECLARATION.matcher(line).matches(); } static String getProcessorName(String line) { // The line starts and ends with "[" and "]". int indexOfComma = line.indexOf(","); return line.substring(1, indexOfComma != -1 ? indexOfComma : line.length() - 1).trim(); } static String[] getProcessorAttributes(String line) { // The line starts and ends with "[" and "]". int indexOfComma = line.indexOf(","); if (indexOfComma == -1) { return new String[0]; } else { return Arrays.stream(line.substring(indexOfComma + 1, line.length() - 1).split(",")).map(String::trim) .toArray(String[]::new); } } static String getBlockContent(Iterator iterator) { StringBuilder content = new StringBuilder(); boolean startOfBlock = false; boolean endOfBlock = false; while (iterator.hasNext() && !endOfBlock) { String line = iterator.next().trim(); if (line.equals("----") && !startOfBlock) { startOfBlock = true; } else if (line.equals("\\----") && startOfBlock) { // Escaped nested block. If the content is using a nested block such as [source], it must "escape" it with // \---- instead of ----. content.append("----").append("\n"); } else if (line.equals("----") && startOfBlock) { endOfBlock = true; } else if (!line.equals("----") && !startOfBlock) { // Block without delimiters (1 line only) return line; } else { content.append(line).append("\n"); } } return content.toString(); } } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/Source.java000066400000000000000000000013501405052102700237010ustar00rootroot00000000000000package io.vertx.docgen; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Define a scope for source code inclusion: any link ref in this scope should include the content instead * of linking to it. * * @author Julien Viet */ @Target({ElementType.TYPE, ElementType.PACKAGE, ElementType.METHOD}) @Retention(RetentionPolicy.CLASS) public @interface Source { /** * Enables or disables the translation of the annotated example. * When set to `false`, it also enable the inclusion of Java file (entire file) in the documentation */ boolean translate() default true; } vertx-docgen-0.9.4/src/main/java/io/vertx/docgen/Syntax.java000066400000000000000000000007261405052102700237350ustar00rootroot00000000000000package io.vertx.docgen; enum Syntax { ASCIIDOC() { @Override void writeLink(String link, String s, DocWriter writer) { writer.append("`link:").append(link).append("[").append(s).append("]`"); } }, MARKDOWN() { @Override void writeLink(String link, String s, DocWriter writer) { writer.append("[`").append(s).append("`](").append(link).append(")"); } }; abstract void writeLink(String link, String s, DocWriter writer); } vertx-docgen-0.9.4/src/test/000077500000000000000000000000001405052102700156735ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/000077500000000000000000000000001405052102700166145ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/000077500000000000000000000000001405052102700172235ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/000077500000000000000000000000001405052102700203735ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/000077500000000000000000000000001405052102700216325ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/BaseProcessorTest.java000066400000000000000000000652611405052102700261210ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Test; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; import javax.annotation.processing.Processor; import javax.annotation.processing.RoundEnvironment; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; import javax.tools.JavaFileObject; import java.io.File; import java.io.IOException; import java.io.Writer; import java.net.URL; import java.nio.file.FileVisitResult; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.*; /** * @author Julien Viet */ public class BaseProcessorTest { @Test public void testIncludePkg() throws Exception { assertEquals("before_includesub_contentafter_include", assertDoc("io.vertx.test.includepkg")); } @Test public void testIncludeNonExisting() throws Exception { assertTrue(failDoc("io.vertx.test.includenonexisting").containsKey("io.vertx.test.includenonexisting")); } @Test public void testIncludeCircular() throws Exception { assertTrue(failDoc("io.vertx.test.includecircular").containsKey("io.vertx.test.includecircular.sub1")); } @Test public void testLinkToClass() throws Exception { assertEquals("`link:type[TheClass]`", assertDoc("io.vertx.test.linktoclass")); assertEquals("[`TheClass`](type)", assertMarkdownDoc("io.vertx.test.linktoclass")); } @Test public void testLinkToAnnotation() throws Exception { assertEquals("`link:annotation[@TheAnnotation]`", assertDoc("io.vertx.test.linktoannotation")); assertEquals("[`@TheAnnotation`](annotation)", assertMarkdownDoc("io.vertx.test.linktoannotation")); } @Test public void testLinkToEnum() throws Exception { assertEquals("`link:enum[TheEnum]`", assertDoc("io.vertx.test.linktoenum")); assertEquals("[`TheEnum`](enum)", assertMarkdownDoc("io.vertx.test.linktoenum")); } @Test public void testLinkToField() throws Exception { assertEquals("`link:field[f1]`", assertDoc("io.vertx.test.linktofield")); assertEquals("[`f1`](field)", assertMarkdownDoc("io.vertx.test.linktofield")); } @Test public void testLinkToEnumConstant() throws Exception { assertEquals("`link:enumConstant[THE_CONSTANT]`", assertDoc("io.vertx.test.linktoenumconstant")); assertEquals("[`THE_CONSTANT`](enumConstant)", assertMarkdownDoc("io.vertx.test.linktoenumconstant")); } @Test public void testLinkToStaticField() throws Exception { assertEquals("`link:field[TheClass.f1]`", assertDoc("io.vertx.test.linktostaticfield")); assertEquals("[`TheClass.f1`](field)", assertMarkdownDoc("io.vertx.test.linktostaticfield")); } @Test public void testLinkToMethodMember() throws Exception { assertEquals("`link:method[m]`", assertDoc("io.vertx.test.linktomethodmember")); assertEquals("[`m`](method)", assertMarkdownDoc("io.vertx.test.linktomethodmember")); } @Test public void testLinkToMethod() throws Exception { assertEquals( "`link:method[m1]`\n" + "`link:method[m1]`\n" + "`link:method[m2]`\n" + "`link:method[m2]`\n" + "`link:method[m2]`\n" + "`link:method[m3]`\n" + "`link:method[m3]`\n" + "`link:method[m3]`\n" + "`link:method[m4]`\n" + "`link:method[m5]`\n" + "`link:method[m6]`\n" + "`link:method[m7]`\n" + "`link:method[m8]`\n" + "`link:method[m9]`\n" + "`link:method[m10]`\n" + "`link:method[m11]`\n" + "`link:method[m12]`\n" + "`link:method[m13]`\n" + "`link:method[m14]`\n" + "`link:method[m15]`\n" + "`link:method[m16]`\n" + "`link:method[m17]`\n" + "`link:method[m18]`" + "", assertDoc("io.vertx.test.linktomethod")); assertEquals( "[`m1`](method)\n" + "[`m1`](method)\n" + "[`m2`](method)\n" + "[`m2`](method)\n" + "[`m2`](method)\n" + "[`m3`](method)\n" + "[`m3`](method)\n" + "[`m3`](method)\n" + "[`m4`](method)\n" + "[`m5`](method)\n" + "[`m6`](method)\n" + "[`m7`](method)\n" + "[`m8`](method)\n" + "[`m9`](method)\n" + "[`m10`](method)\n" + "[`m11`](method)\n" + "[`m12`](method)\n" + "[`m13`](method)\n" + "[`m14`](method)\n" + "[`m15`](method)\n" + "[`m16`](method)\n" + "[`m17`](method)\n" + "[`m18`](method)" + "", assertMarkdownDoc("io.vertx.test.linktomethod")); } @Test public void testLinkToStaticMethod() throws Exception { assertEquals("`link:method[TheClass.m]`", assertDoc("io.vertx.test.linktostaticmethod")); assertEquals("[`TheClass.m`](method)", assertMarkdownDoc("io.vertx.test.linktostaticmethod")); } @Test public void testLinkToMethodWithSimpleTypeName() throws Exception { assertEquals( "`link:method[m1]`\n" + "`link:method[m2]`\n" + "`link:method[m3]`\n" + "`link:method[m4]`" + "", assertDoc("io.vertx.test.linktomethodwithsimpletypename")); assertEquals( "[`m1`](method)\n" + "[`m2`](method)\n" + "[`m3`](method)\n" + "[`m4`](method)" + "", assertMarkdownDoc("io.vertx.test.linktomethodwithsimpletypename")); } @Test public void testLinkToMethodWithUnresolvableType() throws Exception { assertTrue(failDoc("io.vertx.test.linktomethodwithunresolvabletype").containsKey("io.vertx.test.linktomethodwithunresolvabletype")); } @Test public void testLinkToConstructor() throws Exception { assertEquals("`link:constructor[]`\n`link:constructor[]`", assertDoc("io.vertx.test.linktoconstructor")); assertEquals("[``](constructor)\n[``](constructor)", assertMarkdownDoc("io.vertx.test.linktoconstructor")); } @Test public void testLinkToSameNameFieldAndMethod() throws Exception { assertEquals("`link:field[member]`\n`link:method[member]`", assertDoc("io.vertx.test.linktosamenamefieldandmethod")); assertEquals("[`member`](field)\n[`member`](method)", assertMarkdownDoc("io.vertx.test.linktosamenamefieldandmethod")); } @Test public void testLinkToSameNameConstructorAndMethod() throws Exception { assertEquals("`link:constructor[]`\n`link:constructor[]`\n`link:constructor[]`", assertDoc("io.vertx.test.linktosamenameconstructorandmethod")); assertEquals("[``](constructor)\n[``](constructor)\n[``](constructor)", assertMarkdownDoc("io.vertx.test.linktosamenameconstructorandmethod")); } @Test public void testLinkWithLabel() throws Exception { assertEquals("`link:method[the label value]`", assertDoc("io.vertx.test.linkwithlabel")); assertEquals("[`the label value`](method)", assertMarkdownDoc("io.vertx.test.linkwithlabel")); } @Test public void testMargin() throws Exception { assertEquals("A\nB\nC", assertDoc("io.vertx.test.margin")); } @Test public void testCommentStructure() throws Exception { assertEquals("the_first_sentence\n\nthe_body", assertDoc("io.vertx.test.commentstructure")); } @Test public void testIncludeMethodFromAnnotatedClass() throws Exception { assertEquals( "Map map = new HashMap<>();\n" + "// Some comment\n" + "\n" + "if (true) {\n" + " // Indented 1\n" + " if (false) {\n" + " // Indented 2\n" + " }\n" + "}\n" + "map.put(\"abc\", \"def\");\n" + "map.get(\"abc\"); // Beyond last statement", assertDoc("io.vertx.test.includemethodfromannotatedclass")); } @Test public void testIncludeMethodFromAnnotatedMethod() throws Exception { assertEquals( "int a = 0;", assertDoc("io.vertx.test.includemethodfromannotatedmethod")); } @Test public void testIncludeMethodFromAnnotatedPackage() throws Exception { assertEquals( "int a = 0;", assertDoc("io.vertx.test.includemethodfromannotatedpkg")); } @Test public void testIncludeAnnotatedClass() throws Exception { assertEquals( "before_include@Source\n" + "public class TheExample {\n" + "\n" + " // Some comment\n" + " private String f;\n" + "\n" + " public void someMethod() {\n" + " System.out.println(f);\n" + " }\n" + "}after_include", assertDoc("io.vertx.test.includeannotatedclass")); } @Test public void testIncludeClassFromAnnotatedPackage() throws Exception { assertEquals( "before_includepublic class TheExample {\n" + "\n" + " // Some comment\n" + " private String f;\n" + "\n" + " public void someMethod() {\n" + " System.out.println(f);\n" + " }\n" + "}after_include", assertDoc("io.vertx.test.includeclassfromannotatedpkg")); } @Test public void testIncludeAnnotatedInterface() throws Exception { assertEquals( "before_include@Source\n" + "public interface TheExample {\n" + "\n" + " void someMethod();\n" + "\n" + "}after_include", assertDoc("io.vertx.test.includeannotatedinterface")); } @Test public void testIncludeAnnotatedEnum() throws Exception { assertEquals( "before_include@Source\n" + "public enum TheExample {\n" + "\n" + " A,\n" + " B,\n" + " C\n" + "\n" + "}after_include", assertDoc("io.vertx.test.includeannotatedenum")); } @Test public void testIncludeAnnotatedAnnotation() throws Exception { assertEquals( "before_include@Source\n" + "public @interface TheExample {\n" + "\n" + " String value() default \"\";\n" + "\n" + "}after_include", assertDoc("io.vertx.test.includeannotatedannotation")); } @Test public void testLinkToPackage() throws Exception { assertEquals("io.vertx.test.linktopackage.sub.adoc", assertDoc("io.vertx.test.linktopackage")); } @Test public void testMarkup() throws Exception { assertEquals("abc_content\ndef_content\n", assertDoc("io.vertx.test.markup")); } @Test public void testCode() throws Exception { assertEquals("This comment contains `some code here` and a `literal`.", assertDoc("io.vertx.test.code")); } /** * This test checks whether or not the source are translated depending on the {@link Source#translate()} attribute. * It analyses the generation of a document using the default generator and a custom generator. */ @Test public void testSource() throws Exception { String doc = assertDoc("io.vertx.test.source"); // Just use the Java processor - eveything is in lower case. assertTrue("#1", doc.contains("# 1\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#2", doc.contains("# 2\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#3", doc.contains("# 3\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#4", doc.contains("# 4\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#5", doc.contains("# 5\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#6", doc.contains("# 6\n" + "[source, java]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); // Now with the custom generator // Source that need to be translated is in uppercase, otherwise lowercase (regular) // Are not translated: // #2 - because of @Source(translate = false) on the class itself // #4 - like #2 - override parent package configuration doc = assertDocWithCustomGenerator("io.vertx.test.source"); assertTrue("#1", doc.contains("# 1\n" + "[source, custom]\n" + "----\n" + "SYSTEM.OUT.PRINTLN(\"HELLO\");\n" + "----")); assertTrue("#2", doc.contains("# 2\n" + "[source, custom]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#3", doc.contains("# 3\n" + "[source, custom]\n" + "----\n" + "SYSTEM.OUT.PRINTLN(\"HELLO\");\n" + "----")); assertTrue("#4", doc.contains("# 4\n" + "[source, custom]\n" + "----\n" + "System.out.println(\"Hello\");\n" + "----")); assertTrue("#5", doc.contains("# 5\n" + "[source, java]\n" + "----\n" + "SYSTEM.OUT.PRINTLN(\"HELLO\");\n" + "----")); assertTrue("#6", doc.contains("# 6\n" + "[source, java]\n" + "----\n" + "SYSTEM.OUT.PRINTLN(\"HELLO\");\n" + "----")); } @Test public void testLang() throws Exception { assertEquals("The $lang is : java", assertDoc("io.vertx.test.lang")); } @Test public void testEntities() throws Exception { final String doc = assertDoc("io.vertx.test.entities"); assertTrue("Contains 'Foo & Bar'", doc.contains("Foo & Bar")); assertTrue("Contains '10 $'", doc.contains("10 $")); assertTrue("Contains '10 €", doc.contains("10 €")); assertTrue("Contains 'ß'", doc.contains("

Straße

")); assertTrue("Contains 'ß'", doc.contains("

Straßen

")); assertTrue("Contains '\\u00DF'", doc.contains("

\\u00DF

")); assertTrue("Contains correct json", doc.contains("json.put(\"key\", " + "\"\\u0000\\u0001\\u0080\\u009f\\u00a0\\u00ff\");\n")); } @Test public void testLinkUnresolved() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor() { @Override protected String resolveTypeLink(TypeElement elt) { return null; } }, "io.vertx.test.linkunresolved"); compiler.assertCompile(); String s = compiler.processor.getDoc("io.vertx.test.linkunresolved"); assertEquals("`TheClass`", s); } @Test public void testLinkUnresolvedTypeWithSignature() throws Exception { failDoc("io.vertx.test.linkunresolvedtypewithsignature"); } @Test public void testLanguagePostProcessor() throws Exception { // Java Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.postprocessors.language"); compiler.assertCompile(); String content = compiler.processor.getDoc("io.vertx.test.postprocessors.language"); assertThat(content, containsString("This is only displayed for java.")); assertThat(content, not(containsString("This is only displayed for javascript and ruby."))); assertThat(content, not(containsString("----"))); assertThat(content, not(containsString("[language"))); // fake-JavaScript compiler = buildCompiler(new TestGenProcessor() { @Override protected String getName() { return "javascript"; } }, "io.vertx.test.postprocessors.language"); compiler.assertCompile(); content = compiler.processor.getDoc("io.vertx.test.postprocessors.language"); assertThat(content, not(containsString("This is only displayed for java."))); assertThat(content, containsString("This is only displayed for javascript and ruby.")); // fake-groovy compiler = buildCompiler(new TestGenProcessor() { @Override protected String getName() { return "groovy"; } }, "io.vertx.test.postprocessors.language"); compiler.assertCompile(); content = compiler.processor.getDoc("io.vertx.test.postprocessors.language"); assertThat(content, not(containsString("This is only displayed for java."))); assertThat(content, not(containsString("This is only displayed for javascript and ruby."))); } @Test public void testMissingPostProcessor() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.postprocessors.missing"); compiler.assertCompile(); String content = compiler.processor.getDoc("io.vertx.test.postprocessors.missing"); // String processed = compiler.processor.applyPostProcessors(content); assertThat(content, containsString("This should be included.")); assertThat(content, containsString("[missing]")); assertThat(content, containsString("----")); } @Test public void testCodeBlocks() throws Exception { // Code blocks must not be touched by pre-processors. Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.postprocessors.code"); compiler.assertCompile(); String content = compiler.processor.getDoc("io.vertx.test.postprocessors.code"); assertThat(content, containsString("[source,java]")); assertThat(content, containsString("[source]")); assertThat(content, containsString("----")); assertThat(content, containsString("System.out.println(\"Hello\");")); assertThat(content, containsString(" System.out.println(\"Bye\");")); } @Test public void testNestedBlocks() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.postprocessors.nested"); compiler.assertCompile(); String content = compiler.processor.getDoc("io.vertx.test.postprocessors.nested"); assertThat(content, containsString("[source,java]")); assertThat(content, containsString("----")); assertThat(content, not(containsString("\\----"))); assertThat(content, containsString("System.out.println(\"Hello\");")); } @Test public void testLinksInPostProcessedContent() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.postprocessors.links"); compiler.assertCompile(); compiler.processor.registerPostProcessor(new PostProcessor() { @Override public String getName() { return "test"; } @Override public String process(String name, String content, String... args) { return content; } }); String content = compiler.processor.getDoc("io.vertx.test.postprocessors.links"); assertThat(content, containsString("`link:type[BaseProcessor]`")); } @Test public void testVariableSubstitution() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.variables"); compiler.setOption("foo", "hello"); compiler.setOption("bar", "not-used"); compiler.setOption("baz", "vert.x"); compiler.assertCompile(); String content = compiler.processor.getDoc("io.vertx.test.variables"); String processed = compiler.processor.applyVariableSubstitution(content); assertThat(processed, containsString("hello")); assertThat(processed, containsString("${missing}")); assertThat(processed, containsString("vert.x")); assertThat(processed, containsString("${}")); assertThat(processed, not(containsString("not"))); } @Test public void testUnknownTag() throws Exception { assertEquals("" + "before\n" + "@sometag should not be stripped\n" + "after", assertDoc("io.vertx.test.unknowntag")); } @Test public void testDocFile() throws Exception { assertEquals("the_content", assertDocFile("docs/simple.adoc").getDoc("simple.adoc")); } @Test public void testDocFileLink() throws Exception { assertEquals( "<1>`link:type[TheClass]`\n" + "<2>`link:method[m1]`\n" + "<3>`link:method[the label value]`\n" + "<4>`link:method[m1]`\n" + "<5>`link:method[m2]`\n" + "<6>`link:method[m3]`\n" + "<7>`link:method[the label value]`", assertDocFile("docs/link.adoc").getDoc("link.adoc")); } @Test public void testDocFileLinkAfterNewLine() throws Exception { assertEquals( "a\n`link:type[TheClass]` watch the space!", assertDocFile("docs/linkafternewline.adoc").getDoc("linkafternewline.adoc")); } @Test public void testDocFileLinkWithLabel() throws Exception { assertEquals("`link:type[the label value]`", assertDocFile("docs/linkwithlabel.adoc").getDoc("linkwithlabel.adoc")); } @Test public void testDocFileLinkWithLang() throws Exception { assertEquals("The $lang is : java", assertDocFile("docs/lang.adoc").getDoc("lang.adoc")); } @Test public void testDocFileInclude() throws Exception { assertEquals("Map map = new HashMap<>();\n" + "// Some comment\n" + "\n" + "if (true) {\n" + " // Indented 1\n" + " if (false) {\n" + " // Indented 2\n" + " }\n" + "}\n" + "map.put(\"abc\", \"def\");\n" + "map.get(\"abc\"); // Beyond last statement", assertDocFile("docs/include.adoc").getDoc("include.adoc")); } @Test public void testDocFileWithLinkToUnresolvableType() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.file"); compiler.setOption("docgen.source", docFile("docs/linktounresolvabletype.adoc").getAbsolutePath()); compiler.failCompile(); } @Test public void testDocFileNotFound() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.file"); compiler.setOption("docgen.source", new File(new File("."), "does_not_exists").getAbsolutePath()); compiler.failCompile(); } @Test public void testDocFileNotFile() throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.file"); compiler.setOption("docgen.source", new File(".").getAbsolutePath()); compiler.failCompile(); } @Test public void testDocDir() throws Exception { TestGenProcessor processor = assertDocFile("docs/dir"); assertEquals("foo_content", processor.getDoc("foo.adoc")); assertEquals("bar_content", processor.getDoc("bar.adoc")); assertEquals("daa_content", processor.getDoc("juu/daa.adoc")); } @Test public void testGen() throws Exception { AtomicInteger count = new AtomicInteger(); AbstractProcessor proc = new AbstractProcessor() { @Override public Set getSupportedAnnotationTypes() { return Collections.singleton("*"); } @Override public boolean process(Set annotations, RoundEnvironment roundEnv) { if (count.getAndIncrement() == 0) { try { Filer filer = processingEnv.getFiler(); Element elt = processingEnv.getElementUtils().getTypeElement("gen.GeneratedClass"); JavaFileObject src = filer.createSourceFile("io.vertx.test.gen.GeneratedClass", elt); try (Writer writer = src.openWriter()) { writer.append("package io.vertx.test.gen;\npublic class GeneratedClass {\n}"); } } catch (Exception e) { e.printStackTrace(); } } return true; } }; Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.gen"); compiler.addProcessor(proc); compiler.assertCompile(); assertEquals(3, count.get()); } private File docFile(String relativeName) throws Exception { URL resource = BaseProcessorTest.class.getClassLoader().getResource(relativeName); assertNotNull(resource); return new File(resource.toURI()); } private TestGenProcessor assertDocFile(String relativeName) throws Exception { File src = docFile(relativeName); Compiler compiler = buildCompiler(new TestGenProcessor(), "io.vertx.test.file"); compiler.setOption("docgen.source", src.getAbsolutePath()); compiler.assertCompile(); return compiler.processor; } private Map failDoc(String pkg) throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), pkg); compiler.failCompile(); return compiler.processor.failures; } private String assertDoc(String pkg) throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), pkg); compiler.assertCompile(); return compiler.processor.getDoc(pkg); } private String assertMarkdownDoc(String pkg) throws Exception { Compiler compiler = buildCompiler(new TestGenProcessor(), pkg); compiler.setOption("docgen.syntax", "markdown"); compiler.assertCompile(); return compiler.processor.getDoc(pkg); } private String assertDocWithCustomGenerator(String pkg) throws Exception { Compiler compiler = buildCompiler(new CustomTestGenProcessor(), pkg); compiler.assertCompile(); return compiler.processor.getDoc(pkg); } static

Compiler

buildCompiler(P processor, String pkg) throws Exception { int index = 0; File output; do { output = new File("target/" + pkg + (index == 0 ? "" : "" + index)); index++; } while (output.exists()); Path sourcePath = new File(output, "src/" + pkg.replace('.', '/')).toPath(); File classOutput = new File(output, "classes"); assertTrue(sourcePath.toFile().mkdirs()); ArrayList sources = new ArrayList<>(); Path fromPath = new File("src/test/java/" + pkg.replace('.', '/')).toPath(); SimpleFileVisitor visitor = new SimpleFileVisitor() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { Path targetPath = sourcePath.resolve(fromPath.relativize(dir)); if (!Files.exists(targetPath)) { Files.createDirectory(targetPath); } return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Path copy = Files.copy(file, sourcePath.resolve(fromPath.relativize(file))); if (copy.toString().endsWith(".java")) { sources.add(copy.toFile()); } return FileVisitResult.CONTINUE; } }; Files.walkFileTree(fromPath, visitor); assertTrue(sources.size() > 0); return new Compiler<>(sources, classOutput, processor); } } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/Compiler.java000066400000000000000000000067341405052102700242610ustar00rootroot00000000000000package io.vertx.docgen; import javax.annotation.processing.Processor; import javax.tools.Diagnostic; import javax.tools.DiagnosticCollector; import javax.tools.DiagnosticListener; import javax.tools.JavaCompiler; import javax.tools.JavaFileObject; import javax.tools.StandardJavaFileManager; import javax.tools.StandardLocation; import javax.tools.ToolProvider; import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; import static org.junit.Assert.assertTrue; /** * @author Julien Viet */ public class Compiler

{ final File classOutput; final Collection sources; final P processor; final List processors; final StandardJavaFileManager fileManager; final DiagnosticCollector diagnostics = new DiagnosticCollector<>(); final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); final Map options = new HashMap<>(); public Compiler(Collection sources, File classOutput, P processor) { JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); this.fileManager = compiler.getStandardFileManager(diagnostics, Locale.ENGLISH, Charset.forName("UTF-8")); this.classOutput = classOutput; this.sources = sources; this.processor = processor; this.processors = new ArrayList<>(Collections.singletonList(processor)); } void addProcessor(Processor p) { processors.add(p); } void setOption(String name, String value) { if (value == null) { options.remove(name); } else { options.put(name, value); } } void failCompile() { JavaCompiler.CompilationTask task = createTask(sources, diagnostics); if (task.call()) { throw new AssertionError("Was expecting compilation to fail"); } } void assertCompile() { JavaCompiler.CompilationTask task = createTask(sources, diagnostics); if (!task.call()) { StringWriter buffer = new StringWriter(); buffer.append("Could not compile").append(":\n"); for (Diagnostic diagnostic : diagnostics.getDiagnostics()) { buffer.append(diagnostic.toString()).append("\n"); } throw new AssertionError(buffer.toString()); } } private JavaCompiler.CompilationTask createTask(Collection sources, DiagnosticListener diagnostics) { if (!classOutput.mkdirs()) { assertTrue(classOutput.exists()); } assertTrue(classOutput.isDirectory()); try { fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singletonList(classOutput)); } catch (IOException e) { throw new AssertionError("Could not set location", e); } Iterable files = fileManager.getJavaFileObjects(sources.toArray(new File[sources.size()])); JavaCompiler.CompilationTask task = compiler.getTask(new OutputStreamWriter(System.out), fileManager, diagnostics, options.entrySet().stream().map(entry -> "-A" + entry.getKey() + "=" + entry.getValue()).collect(Collectors.toList()), Collections.emptyList(), files); task.setLocale(Locale.ENGLISH); task.setProcessors(processors); return task; } } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/CustomTestGenProcessor.java000066400000000000000000000033761405052102700271520ustar00rootroot00000000000000package io.vertx.docgen; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import java.util.HashMap; import java.util.Map; /** * A custom processor. * On purpose it transforms source to uppercase. */ public class CustomTestGenProcessor extends JavaDocGenProcessor { Map results = new HashMap<>(); @Override protected DocGenerator generator() { return new JavaDocGenerator() { @Override public String resolveTypeLink(TypeElement elt) { switch (elt.getKind()) { case INTERFACE: case CLASS: return "type"; case ENUM: return "enum"; default: return "unsupported"; } } @Override public String resolveConstructorLink(ExecutableElement elt) { return "constructor"; } @Override public String resolveMethodLink(ExecutableElement elt) { return "method"; } @Override public String resolveFieldLink(VariableElement elt) { switch (elt.getKind()) { case ENUM_CONSTANT: return "enumConstant"; case FIELD: return "field"; default: return "unsupported"; } } @Override public String getName() { return "custom"; } @Override public String renderSource(ExecutableElement elt, String source) { return super.renderSource(elt, source).toUpperCase(); } }; } @Override protected void write(DocGenerator generator, Doc doc, String content) { results.put(doc.id(), content); } public String getDoc(String name) { return results.get(name); } } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/DocGenProcessorTest.java000066400000000000000000000073541405052102700264050ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Test; import java.io.File; import java.nio.file.Files; import java.util.Arrays; import java.util.List; import static org.junit.Assert.*; /** * @author Julien Viet */ public class DocGenProcessorTest { @Test public void testGeneration() throws Exception { for (String pkg : Arrays.asList("io.vertx.test.linktoclass", "io.vertx.test.linktoconstructor", "io.vertx.test.linktomethod", "io.vertx.test.linktofield")) { Compiler compiler = BaseProcessorTest.buildCompiler(new DocGenProcessor(new JavaDocGenerator()), pkg); File dir = Files.createTempDirectory("docgen").toFile(); dir.deleteOnExit(); compiler.setOption("docgen.output", dir.getAbsolutePath()); compiler.assertCompile(); File file = new File(dir, pkg + ".adoc"); assertTrue(file.exists()); assertTrue(file.isFile()); } } @Test public void testLinkGenerationWithAnnotation() throws Exception { String pkg = "io.vertx.test.linktomethod"; Compiler compiler = BaseProcessorTest.buildCompiler(new DocGenProcessor(new JavaDocGenerator()), pkg); File dir = Files.createTempDirectory("docgen").toFile(); dir.deleteOnExit(); compiler.setOption("docgen.output", dir.getAbsolutePath()); compiler.assertCompile(); File file = new File(dir, pkg + ".adoc"); List lines = Files.readAllLines(file.toPath()); for (String line : lines) { // The :: is used when the annotated type is used. assertFalse(line.contains("::")); } } @Test public void testFileName() throws Exception { Compiler compiler = BaseProcessorTest.buildCompiler(new DocGenProcessor(new JavaDocGenerator()), "io.vertx.test.filename"); File dir = Files.createTempDirectory("docgen").toFile(); dir.deleteOnExit(); compiler.setOption("docgen.output", dir.getAbsolutePath()); compiler.assertCompile(); File f1 = new File(dir, "index.adoc"); assertTrue(f1.exists()); assertTrue(f1.isFile()); File f2 = new File(dir, "sub" + File.separator + "index.adoc"); assertTrue(f2.exists()); assertTrue(f2.isFile()); assertEquals("sub/index.adoc", new String(Files.readAllBytes(f1.toPath()))); } @Test public void testExtension() throws Exception { for (String pkg : Arrays.asList("io.vertx.test.linktoclass", "io.vertx.test.linktoconstructor", "io.vertx.test.linktomethod", "io.vertx.test.linktofield")) { Compiler compiler = BaseProcessorTest.buildCompiler(new DocGenProcessor(new JavaDocGenerator()), pkg); File dir = Files.createTempDirectory("docgen").toFile(); dir.deleteOnExit(); compiler.setOption("docgen.output", dir.getAbsolutePath()); compiler.setOption("docgen.extension", ".ad.txt"); compiler.assertCompile(); File file = new File(dir, pkg + ".ad.txt"); assertTrue(file.exists()); assertTrue(file.isFile()); } } @Test public void testOutputInterpolation() throws Exception { for (String pkg : Arrays.asList("io.vertx.test.linktoclass", "io.vertx.test.linktoconstructor", "io.vertx.test.linktomethod", "io.vertx.test.linktofield")) { Compiler compiler = BaseProcessorTest.buildCompiler(new DocGenProcessor(new JavaDocGenerator()), pkg); File dir = Files.createTempDirectory("docgen").toFile(); dir.deleteOnExit(); compiler.setOption("docgen.output", new File(dir, "$lang").getAbsolutePath()); compiler.setOption("docgen.extension", ".ad.txt"); compiler.assertCompile(); File file = new File(new File(dir, "java"), pkg + ".ad.txt"); assertTrue(file.exists()); assertTrue(file.isFile()); } } } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/DocWriterTest.java000066400000000000000000000050511405052102700252400ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Test; import java.io.IOException; import static org.junit.Assert.*; /** * @author Julien Viet */ public class DocWriterTest { @Test public void testFormat() throws IOException { assertCommentText("abc", "abc"); assertCommentText(" abc", " abc"); assertCommentText("abc\ndef", "abc\ndef"); assertCommentText("abc\n def", "abc\ndef"); assertCommentText("abc\n def", "abc\n def"); assertCommentText("abc\n def\n ghi", "abc\ndef\nghi"); } @Test public void testResetParagraph() throws IOException { DocWriter writer = new DocWriter(); writer.write("abc\n def\n"); writer.resetParagraph(); writer.write("ghi\n jkl"); assertEquals("abc\ndef\nghi\njkl", writer.render()); } @Test public void testLiteralMode() throws IOException { assertLiteralText("abc", "abc"); assertLiteralText(" abc", " abc"); assertLiteralText("abc\ndef", "abc\ndef"); assertLiteralText("abc\n def", "abc\n def"); assertLiteralText("abc\n def", "abc\n def"); assertLiteralText("abc\n def\n ghi", "abc\n def\n ghi"); } @Test public void testFuture() throws IOException { DocWriter writer = new DocWriter(); writer.write("a"); writer.write(() -> { DocWriter n1 = new DocWriter(); n1.write("b"); n1.write(() -> { DocWriter n2 = new DocWriter(); n2.write("c"); return n2; }); return n1; }); writer.write("d"); assertEquals("abcd", writer.render()); assertEquals("", writer.render()); } @Test public void testExec() throws IOException { DocWriter writer = new DocWriter(); writer.literalMode(); writer.write("abc\n def"); writer.exec(() -> writer.write("\n ghi")); writer.write("\n jkl"); assertEquals("abc\n def\nghi\n jkl", writer.render()); } @Test public void testExecAfterNewLine() throws IOException { DocWriter writer = new DocWriter(); writer.write("abc\n"); writer.exec(() -> writer.write("def")); writer.write(" ghi"); assertEquals("abc\ndef ghi", writer.render()); } private void assertCommentText(String actual, String expected) throws IOException { DocWriter writer = new DocWriter(); writer.write(actual); assertEquals(expected, writer.render()); } private void assertLiteralText(String actual, String expected) throws IOException { DocWriter writer = new DocWriter(); writer.literalMode(); writer.write(actual); assertEquals(expected, writer.render()); } } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/EntityUtilsTest.java000066400000000000000000000017421405052102700256360ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Assert; import org.junit.Test; import static org.junit.Assert.*; /** * Checks the behavior of the entity un-escaper. */ public class EntityUtilsTest { @Test public void testUnescapeEntity() throws Exception { Assert.assertEquals(EntityUtils.unescapeEntity("#92"), "\\"); Assert.assertEquals(EntityUtils.unescapeEntity("u00A7"), "§"); Assert.assertEquals(EntityUtils.unescapeEntity("#x020AC"), "€"); Assert.assertEquals(EntityUtils.unescapeEntity("nbsp"), " "); Assert.assertEquals(EntityUtils.unescapeEntity(""), ""); Assert.assertEquals(EntityUtils.unescapeEntity(null), ""); Assert.assertEquals(EntityUtils.unescapeEntity("\t"), ""); Assert.assertEquals(EntityUtils.unescapeEntity("#t"), "#t"); Assert.assertEquals(EntityUtils.unescapeEntity("uzz02"), "uzz02"); Assert.assertEquals(EntityUtils.unescapeEntity("#"), "#"); Assert.assertEquals(EntityUtils.unescapeEntity("#x"), "#x"); } }vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/FooAnnotation.java000066400000000000000000000005541405052102700252570ustar00rootroot00000000000000package io.vertx.docgen; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author Julien Viet */ @Target(ElementType.TYPE_USE) @Retention(RetentionPolicy.RUNTIME) public @interface FooAnnotation { } vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/LanguageFilterPostProcessorTest.java000066400000000000000000000032161405052102700307760ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Test; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.*; /** * Checks the {@link LanguageFilterPostProcessor}. */ public class LanguageFilterPostProcessorTest { LanguageFilterPostProcessor postProcessor = new LanguageFilterPostProcessor(); @Test public void testThatMatchingLanguagesAreNotFilteredOut() { String content = "This is something only for java"; String result = postProcessor.process("java", content, "java"); assertThat(result, containsString(content)); result = postProcessor.process("java", content, "java", "javascript", "ruby"); assertThat(result, containsString(content)); } @Test public void testThatNotMatchingLanguagesAreFilteredOut() { String content = "This is something only for javascript and ruby"; String result = postProcessor.process("java", content, "java"); assertThat(result, containsString(content)); result = postProcessor.process("java", content, "javascript", "ruby"); assertThat(result, not(containsString(content))); assertThat(result, equalTo(PostProcessor.EMPTY_CONTENT)); } @Test public void testWhenContentIsEmpty() { String content = ""; String result = postProcessor.process("java", content, "java"); assertThat(result, containsString(content)); } @Test(expected = IllegalArgumentException.class) public void testWithNoArgs() { String content = ""; String result = postProcessor.process("java", content); assertThat(result, containsString(content)); } }vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/PostProcessorTest.java000066400000000000000000000076021405052102700261670ustar00rootroot00000000000000package io.vertx.docgen; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; /** * Check the behavior of {@link PostProcessor}. */ public class PostProcessorTest { @Test public void testBlockDeclaration() { assertThat(PostProcessor.isBlockDeclaration("[foo]"), equalTo(true)); assertThat(PostProcessor.isBlockDeclaration("[foo,a,b,c]"), equalTo(true)); assertThat(PostProcessor.isBlockDeclaration("[foo ]"), equalTo(true)); assertThat(PostProcessor.isBlockDeclaration("[ foo ]"), equalTo(true)); assertThat(PostProcessor.isBlockDeclaration("foo"), equalTo(false)); assertThat(PostProcessor.isBlockDeclaration(""), equalTo(false)); assertThat(PostProcessor.isBlockDeclaration("[]"), equalTo(false)); assertThat(PostProcessor.isBlockDeclaration("[ ]"), equalTo(true)); assertThat(PostProcessor.isBlockDeclaration("[X]"), equalTo(true)); } @Test public void testProcessorNameExtraction() { assertThat(PostProcessor.getProcessorName("[foo]"), equalTo("foo")); assertThat(PostProcessor.getProcessorName("[foo ]"), equalTo("foo")); assertThat(PostProcessor.getProcessorName("[ foo]"), equalTo("foo")); assertThat(PostProcessor.getProcessorName("[ foo ]"), equalTo("foo")); assertThat(PostProcessor.getProcessorName("[foo,a,b,c]"), equalTo("foo")); assertThat(PostProcessor.getProcessorName("[foo, a,b,c]"), equalTo("foo")); } @Test public void testProcessorAttributeExtraction() { assertThat(PostProcessor.getProcessorAttributes("[foo]").length, equalTo(0)); // First parameter empty assertThat(PostProcessor.getProcessorAttributes("[foo,]").length, equalTo(1)); assertThat(PostProcessor.getProcessorAttributes("[foo,]")[0], equalTo("")); assertThat(PostProcessor.getProcessorAttributes("[foo,,,]").length, equalTo(0)); assertThat(PostProcessor.getProcessorAttributes("[foo, a,b,c ]")[0], equalTo("a")); assertThat(PostProcessor.getProcessorAttributes("[foo,a,b,c ]")[1], equalTo("b")); assertThat(PostProcessor.getProcessorAttributes("[foo, a,b,c ]")[2], equalTo("c")); } @Test public void testContentExtractionWithSingleLineBlock() { List lines = Arrays.asList( "line 1", "line 2" ); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("line 1")); assertThat(PostProcessor.getBlockContent(lines.iterator()), not(containsString("line 2"))); } @Test public void testContentExtractionWithBlock() { List lines = Arrays.asList( "----", "line 1", "line 2", "----", "line 3" ); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("line 1")); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("line 2")); assertThat(PostProcessor.getBlockContent(lines.iterator()), not(containsString("line 3"))); assertThat(PostProcessor.getBlockContent(lines.iterator()), not(containsString("----"))); } @Test public void testExtractionWithNestedBlocks() { List lines = Arrays.asList( "----", "line 1", "line 2", "[source]", "\\----", "some source code", "\\----", "after", "----", "line 3" ); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("line 1")); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("line 2")); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("[source]")); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("some source code")); assertThat(PostProcessor.getBlockContent(lines.iterator()), containsString("after")); assertThat(PostProcessor.getBlockContent(lines.iterator()), not(containsString("line 3"))); } }vertx-docgen-0.9.4/src/test/java/io/vertx/docgen/TestGenProcessor.java000066400000000000000000000042571405052102700257560ustar00rootroot00000000000000package io.vertx.docgen; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import java.util.HashMap; import java.util.Map; /** * @author Julien Viet */ public class TestGenProcessor extends JavaDocGenProcessor { Map results = new HashMap<>(); @Override protected DocGenerator generator() { return new JavaDocGenerator() { @Override public String getName() { return TestGenProcessor.this.getName(); } @Override public String resolveTypeLink(TypeElement elt) { return TestGenProcessor.this.resolveTypeLink(elt); } @Override public String resolveConstructorLink(ExecutableElement elt) { return TestGenProcessor.this.resolveConstructorLink(elt); } @Override public String resolveMethodLink(ExecutableElement elt) { return TestGenProcessor.this.resolveMethodLink(elt); } @Override public String resolveFieldLink(VariableElement elt) { return TestGenProcessor.this.resolveFieldLink(elt); } }; } protected String getName() { return "java"; } protected String resolveTypeLink(TypeElement elt) { switch (elt.getKind()) { case ANNOTATION_TYPE: return "annotation"; case INTERFACE: case CLASS: return "type"; case ENUM: return "enum"; default: return "unsupported"; } } protected String resolveConstructorLink(ExecutableElement elt) { return "constructor"; } protected String resolveMethodLink(ExecutableElement elt) { return "method"; } protected String resolveFieldLink(VariableElement elt) { switch (elt.getKind()) { case ENUM_CONSTANT: return "enumConstant"; case FIELD: return "field"; default: return "unsupported"; } } @Override protected void write(DocGenerator generator, Doc doc, String content) { results.put(doc.id(), content); super.write(generator, doc, content); } public String getDoc(String name) { return results.get(name); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/000077500000000000000000000000001405052102700213525ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/code/000077500000000000000000000000001405052102700222645ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/code/package-info.java000066400000000000000000000002321405052102700254500ustar00rootroot00000000000000/** * This comment contains {@code some code here} and a {@literal literal}. */ @Document package io.vertx.test.code; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/commentstructure/000077500000000000000000000000001405052102700247755ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/commentstructure/package-info.java000066400000000000000000000002031405052102700301570ustar00rootroot00000000000000/** * the_first_sentence * * the_body */ @Document() package io.vertx.test.commentstructure; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/entities/000077500000000000000000000000001405052102700231765ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/entities/package-info.java000066400000000000000000000007671405052102700263770ustar00rootroot00000000000000/** * This documentation is intended to use entities: *

*

Foo & Bar.

*

10 \u0024

*

10 €

*

Stra\u00DFe

*

Straßen

*

\u00DF

*

* In code: * * [source,java] * ---- * JsonObject json = new JsonObject(); * json.put("key", "\u0000\u0001\u0080\u009f\u00a0\u00ff"); * json.put("key", "\u00c3\u00bc"); * ---- */ @Document package io.vertx.test.entities; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/file/000077500000000000000000000000001405052102700222715ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/file/TheClass.java000066400000000000000000000003401405052102700246370ustar00rootroot00000000000000package io.vertx.test.file; /** * @author Julien Viet */ public class TheClass { public void m1() {} public void m2(String s) {} public void m3(String s, boolean b) {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/file/TheExample.java000066400000000000000000000007501405052102700251720ustar00rootroot00000000000000package io.vertx.test.file; import io.vertx.docgen.Source; import java.util.HashMap; import java.util.Map; /** * @author Julien Viet */ @Source public class TheExample { public void someMethod() { Map map = new HashMap<>(); // Some comment // if (true) { // Indented 1 if (false) { // Indented 2 } } map.put("abc", "def"); map.get("abc"); // Beyond last statement } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/file/package-info.java000066400000000000000000000000341405052102700254550ustar00rootroot00000000000000package io.vertx.test.file; vertx-docgen-0.9.4/src/test/java/io/vertx/test/filename/000077500000000000000000000000001405052102700231325ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/filename/package-info.java000066400000000000000000000002221405052102700263150ustar00rootroot00000000000000/** * {@link io.vertx.test.filename.sub} */ @Document(fileName = "index.adoc") package io.vertx.test.filename; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/filename/sub/000077500000000000000000000000001405052102700237235ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/filename/sub/package-info.java000066400000000000000000000002021405052102700271040ustar00rootroot00000000000000/** * subcontent */ @Document(fileName = "sub/index.adoc") package io.vertx.test.filename.sub; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/gen/000077500000000000000000000000001405052102700221235ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/gen/TheClass.java000066400000000000000000000002001405052102700244640ustar00rootroot00000000000000package io.vertx.test.gen; /** * @author Julien Viet */ public class TheClass { } vertx-docgen-0.9.4/src/test/java/io/vertx/test/gen/package-info.java000066400000000000000000000001721405052102700253120ustar00rootroot00000000000000/** *{@link io.vertx.test.gen.GeneratedClass} */ @Document package io.vertx.test.gen; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedannotation/000077500000000000000000000000001405052102700267665ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedannotation/TheExample.java000066400000000000000000000002331405052102700316630ustar00rootroot00000000000000package io.vertx.test.includeannotatedannotation; import io.vertx.docgen.Source; @Source public @interface TheExample { String value() default ""; } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedannotation/package-info.java000066400000000000000000000002771405052102700321630ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includeannotatedannotation.TheExample}after_include */ @Document package io.vertx.test.includeannotatedannotation; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedclass/000077500000000000000000000000001405052102700257215ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedclass/TheExample.java000066400000000000000000000004071405052102700306210ustar00rootroot00000000000000package io.vertx.test.includeannotatedclass; import io.vertx.docgen.Source; import java.util.HashMap; import java.util.Map; @Source public class TheExample { // Some comment private String f; public void someMethod() { System.out.println(f); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedclass/package-info.java000066400000000000000000000002651405052102700311130ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includeannotatedclass.TheExample}after_include */ @Document package io.vertx.test.includeannotatedclass; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedenum/000077500000000000000000000000001405052102700255605ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedenum/TheExample.java000066400000000000000000000002001405052102700304470ustar00rootroot00000000000000package io.vertx.test.includeannotatedenum; import io.vertx.docgen.Source; @Source public enum TheExample { A, B, C } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedenum/package-info.java000066400000000000000000000002631405052102700307500ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includeannotatedenum.TheExample}after_include */ @Document package io.vertx.test.includeannotatedenum; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedinterface/000077500000000000000000000000001405052102700265545ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedinterface/TheExample.java000066400000000000000000000002211405052102700314460ustar00rootroot00000000000000package io.vertx.test.includeannotatedinterface; import io.vertx.docgen.Source; @Source public interface TheExample { void someMethod(); } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeannotatedinterface/package-info.java000066400000000000000000000002751405052102700317470ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includeannotatedinterface.TheExample}after_include */ @Document package io.vertx.test.includeannotatedinterface; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/000077500000000000000000000000001405052102700245225ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/package-info.java000066400000000000000000000002101405052102700277020ustar00rootroot00000000000000/** * {@link io.vertx.test.includecircular.sub1} */ @Document package io.vertx.test.includecircular; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/sub1/000077500000000000000000000000001405052102700253745ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/sub1/package-info.java000066400000000000000000000001421405052102700305600ustar00rootroot00000000000000/** * {@link io.vertx.test.includecircular.sub2} */ package io.vertx.test.includecircular.sub1; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/sub2/000077500000000000000000000000001405052102700253755ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includecircular/sub2/package-info.java000066400000000000000000000001421405052102700305610ustar00rootroot00000000000000/** * {@link io.vertx.test.includecircular.sub1} */ package io.vertx.test.includecircular.sub2; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeclassfromannotatedpkg/000077500000000000000000000000001405052102700273075ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeclassfromannotatedpkg/package-info.java000066400000000000000000000003071405052102700324760ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includeclassfromannotatedpkg.sub.TheExample}after_include */ @Document package io.vertx.test.includeclassfromannotatedpkg; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeclassfromannotatedpkg/sub/000077500000000000000000000000001405052102700301005ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeclassfromannotatedpkg/sub/TheExample.java000066400000000000000000000002711405052102700327770ustar00rootroot00000000000000package io.vertx.test.includeclassfromannotatedpkg.sub; public class TheExample { // Some comment private String f; public void someMethod() { System.out.println(f); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includeclassfromannotatedpkg/sub/package-info.java000066400000000000000000000001201405052102700332600ustar00rootroot00000000000000@io.vertx.docgen.Source package io.vertx.test.includeclassfromannotatedpkg.sub; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedclass/000077500000000000000000000000001405052102700300065ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedclass/TheExample.java000066400000000000000000000010031405052102700326770ustar00rootroot00000000000000package io.vertx.test.includemethodfromannotatedclass; import io.vertx.docgen.Source; import java.util.HashMap; import java.util.Map; /** * @author Julien Viet */ @Source public class TheExample { public void someMethod() { Map map = new HashMap<>(); // Some comment // if (true) { // Indented 1 if (false) { // Indented 2 } } map.put("abc", "def"); map.get("abc"); // Beyond last statement } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedclass/package-info.java000066400000000000000000000002731405052102700331770ustar00rootroot00000000000000/** *{@link io.vertx.test.includemethodfromannotatedclass.TheExample#someMethod()} */ @Document package io.vertx.test.includemethodfromannotatedclass; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedmethod/000077500000000000000000000000001405052102700301615ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedmethod/TheExample.java000066400000000000000000000003731405052102700330630ustar00rootroot00000000000000package io.vertx.test.includemethodfromannotatedmethod; import io.vertx.docgen.Source; /** * @author Julien Viet */ public class TheExample { @Source public void someMethod() { int a = 0; } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedmethod/package-info.java000066400000000000000000000002751405052102700333540ustar00rootroot00000000000000/** *{@link io.vertx.test.includemethodfromannotatedmethod.TheExample#someMethod()} */ @Document package io.vertx.test.includemethodfromannotatedmethod; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedpkg/000077500000000000000000000000001405052102700274625ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedpkg/package-info.java000066400000000000000000000002731405052102700326530ustar00rootroot00000000000000/** *{@link io.vertx.test.includemethodfromannotatedpkg.sub.TheExample#someMethod()} */ @Document package io.vertx.test.includemethodfromannotatedpkg; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedpkg/sub/000077500000000000000000000000001405052102700302535ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedpkg/sub/TheExample.java000066400000000000000000000003721405052102700331540ustar00rootroot00000000000000package io.vertx.test.includemethodfromannotatedpkg.sub; import io.vertx.docgen.Source; /** * @author Julien Viet */ @Source public class TheExample { public void someMethod() { int a = 0; } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/includemethodfromannotatedpkg/sub/package-info.java000066400000000000000000000001411405052102700334360ustar00rootroot00000000000000@Source package io.vertx.test.includemethodfromannotatedpkg.sub; import io.vertx.docgen.Source; vertx-docgen-0.9.4/src/test/java/io/vertx/test/includenonexisting/000077500000000000000000000000001405052102700252635ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includenonexisting/package-info.java000066400000000000000000000001651405052102700304540ustar00rootroot00000000000000/** * {@link non_existing} */ @Document package io.vertx.test.includenonexisting; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includepkg/000077500000000000000000000000001405052102700234775ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includepkg/package-info.java000066400000000000000000000002301405052102700266610ustar00rootroot00000000000000/** * before_include{@link io.vertx.test.includepkg.sub}after_include */ @Document package io.vertx.test.includepkg; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/includepkg/sub/000077500000000000000000000000001405052102700242705ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/includepkg/sub/package-info.java000066400000000000000000000000741405052102700274600ustar00rootroot00000000000000/** * sub_content */ package io.vertx.test.includepkg.sub;vertx-docgen-0.9.4/src/test/java/io/vertx/test/lang/000077500000000000000000000000001405052102700222735ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/lang/package-info.java000066400000000000000000000001501405052102700254560ustar00rootroot00000000000000/** * The \$lang is : $lang */ @Document package io.vertx.test.lang; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoannotation/000077500000000000000000000000001405052102700247455ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoannotation/TheAnnotation.java000066400000000000000000000002271405052102700303640ustar00rootroot00000000000000package io.vertx.test.linktoannotation; /** * @author Julien Viet */ public @interface TheAnnotation { } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoannotation/package-info.java000066400000000000000000000002231405052102700301310ustar00rootroot00000000000000/** * {@link io.vertx.test.linktoannotation.TheAnnotation} */ @Document package io.vertx.test.linktoannotation; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoclass/000077500000000000000000000000001405052102700237005ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoclass/TheClass.java000066400000000000000000000002101405052102700262420ustar00rootroot00000000000000package io.vertx.test.linktoclass; /** * @author Julien Viet */ public class TheClass { } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoclass/package-info.java000066400000000000000000000002041405052102700270630ustar00rootroot00000000000000/** * {@link io.vertx.test.linktoclass.TheClass} */ @Document package io.vertx.test.linktoclass; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoconstructor/000077500000000000000000000000001405052102700251605ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoconstructor/TheClass.java000066400000000000000000000002471405052102700275340ustar00rootroot00000000000000package io.vertx.test.linktoconstructor; /** * @author Julien Viet */ public class TheClass { public TheClass() {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoconstructor/package-info.java000066400000000000000000000003271405052102700303510ustar00rootroot00000000000000/** *{@link io.vertx.test.linktoconstructor.TheClass#TheClass} *{@link io.vertx.test.linktoconstructor.TheClass#TheClass()} */ @Document package io.vertx.test.linktoconstructor; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenum/000077500000000000000000000000001405052102700235375ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenum/TheEnum.java000066400000000000000000000002051405052102700257440ustar00rootroot00000000000000package io.vertx.test.linktoenum; /** * @author Julien Viet */ public enum TheEnum { } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenum/package-info.java000066400000000000000000000002011405052102700267170ustar00rootroot00000000000000/** * {@link io.vertx.test.linktoenum.TheEnum} */ @Document package io.vertx.test.linktoenum; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenumconstant/000077500000000000000000000000001405052102700253115ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenumconstant/TheEnum.java000066400000000000000000000002361405052102700275220ustar00rootroot00000000000000package io.vertx.test.linktoenumconstant; /** * @author Julien Viet */ public enum TheEnum { THE_CONSTANT } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktoenumconstant/package-info.java000066400000000000000000000002361405052102700305010ustar00rootroot00000000000000/** *{@link io.vertx.test.linktoenumconstant.TheEnum#THE_CONSTANT} */ @Document package io.vertx.test.linktoenumconstant; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktofield/000077500000000000000000000000001405052102700236565ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktofield/TheClass.java000066400000000000000000000002361405052102700262300ustar00rootroot00000000000000package io.vertx.test.linktofield; /** * @author Julien Viet */ public class TheClass { public String f1; } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktofield/package-info.java000066400000000000000000000002071405052102700270440ustar00rootroot00000000000000/** *{@link io.vertx.test.linktofield.TheClass#f1} */ @Document package io.vertx.test.linktofield; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethod/000077500000000000000000000000001405052102700240535ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethod/TheClass.java000066400000000000000000000015171405052102700264300ustar00rootroot00000000000000package io.vertx.test.linktomethod; import io.vertx.docgen.FooAnnotation; import java.util.List; /** * @author Julien Viet */ public class TheClass { public void m1() {} public void m2(String arg) {} public void m3(List arg) {} public void m4(boolean arg) {} public void m5(byte arg) {} public void m6(short arg) {} public void m7(int arg) {} public void m8(long arg) {} public void m9(float arg) {} public void m10(double arg) {} public void m11(char arg) {} public void m12(T arg) {} public > void m13(T arg) {} public > void m14(T arg) {} public void m15(String[] arg) {} public void m16(String[][] arg) {} public void m17(T[] arg) {} public void m18(@FooAnnotation Object arg) {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethod/package-info.java000066400000000000000000000027571405052102700272550ustar00rootroot00000000000000/** *{@link io.vertx.test.linktomethod.TheClass#m1()} *{@link io.vertx.test.linktomethod.TheClass#m1( )} *{@link io.vertx.test.linktomethod.TheClass#m2(java.lang.String)} *{@link io.vertx.test.linktomethod.TheClass#m2( java.lang.String)} *{@link io.vertx.test.linktomethod.TheClass#m2(java.lang.String )} *{@link io.vertx.test.linktomethod.TheClass#m3(java.util.List)} *{@link io.vertx.test.linktomethod.TheClass#m3( java.util.List)} *{@link io.vertx.test.linktomethod.TheClass#m3(java.util.List )} *{@link io.vertx.test.linktomethod.TheClass#m4(boolean)} *{@link io.vertx.test.linktomethod.TheClass#m5(byte)} *{@link io.vertx.test.linktomethod.TheClass#m6(short)} *{@link io.vertx.test.linktomethod.TheClass#m7(int)} *{@link io.vertx.test.linktomethod.TheClass#m8(long)} *{@link io.vertx.test.linktomethod.TheClass#m9(float)} *{@link io.vertx.test.linktomethod.TheClass#m10(double)} *{@link io.vertx.test.linktomethod.TheClass#m11(char)} *{@link io.vertx.test.linktomethod.TheClass#m12(java.lang.Object)} *{@link io.vertx.test.linktomethod.TheClass#m13(java.util.List)} *{@link io.vertx.test.linktomethod.TheClass#m14(java.util.List)} *{@link io.vertx.test.linktomethod.TheClass#m15(java.lang.String[])} *{@link io.vertx.test.linktomethod.TheClass#m16(java.lang.String[][])} *{@link io.vertx.test.linktomethod.TheClass#m17(java.lang.Object[])} *{@link io.vertx.test.linktomethod.TheClass#m18(java.lang.Object)} */ @Document package io.vertx.test.linktomethod; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodmember/000077500000000000000000000000001405052102700252435ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodmember/TheClass.java000066400000000000000000000002521405052102700276130ustar00rootroot00000000000000package io.vertx.test.linktomethodmember; /** * @author Julien Viet */ public class TheClass { public void m() { } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodmember/package-info.java000066400000000000000000000002241405052102700304300ustar00rootroot00000000000000/** * {@link io.vertx.test.linktomethodmember.TheClass#m} */ @Document package io.vertx.test.linktomethodmember; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithsimpletypename/000077500000000000000000000000001405052102700277245ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithsimpletypename/TheClass.java000066400000000000000000000005261405052102700323000ustar00rootroot00000000000000package io.vertx.test.linktomethodwithsimpletypename; import java.util.List; import java.util.Locale; /** * @author Julien Viet */ public class TheClass { public void m1(Locale arg) {} public void m2(String arg) {} public void m3(Locale[] arg) {} public void m4(List arg) {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithsimpletypename/package-info.java000066400000000000000000000006721405052102700331200ustar00rootroot00000000000000/** *{@link io.vertx.test.linktomethodwithsimpletypename.TheClass#m1(Locale)} *{@link io.vertx.test.linktomethodwithsimpletypename.TheClass#m2(String)} *{@link io.vertx.test.linktomethodwithsimpletypename.TheClass#m3(Locale[])} *{@link io.vertx.test.linktomethodwithsimpletypename.TheClass#m4(java.util.List)} */ @Document package io.vertx.test.linktomethodwithsimpletypename; import io.vertx.docgen.Document; import java.util.Locale; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithunresolvabletype/000077500000000000000000000000001405052102700302735ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithunresolvabletype/TheClass.java000066400000000000000000000002761405052102700326510ustar00rootroot00000000000000package io.vertx.test.linktomethodwithunresolvabletype; /** * @author Julien Viet */ public class TheClass { public void m(String s) { } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktomethodwithunresolvabletype/package-info.java000066400000000000000000000002701405052102700334610ustar00rootroot00000000000000/** *{@link io.vertx.test.linktomethodwithunresolvabletype.TheClass#m(foobar)} */ @Document package io.vertx.test.linktomethodwithunresolvabletype; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktopackage/000077500000000000000000000000001405052102700241665ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktopackage/package-info.java000066400000000000000000000002031405052102700273500ustar00rootroot00000000000000/** *{@link io.vertx.test.linktopackage.sub} */ @Document package io.vertx.test.linktopackage; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktopackage/sub/000077500000000000000000000000001405052102700247575ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktopackage/sub/package-info.java000066400000000000000000000001521405052102700301440ustar00rootroot00000000000000/** * something */ @Document package io.vertx.test.linktopackage.sub; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenameconstructorandmethod/000077500000000000000000000000001405052102700305535ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenameconstructorandmethod/TheClass.java000066400000000000000000000004451405052102700331270ustar00rootroot00000000000000package io.vertx.test.linktosamenameconstructorandmethod; /** * @author Julien Viet */ public class TheClass { public TheClass() { } public TheClass(String s) { } public void TheClass() { } public void TheClass(String s) { } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenameconstructorandmethod/package-info.java000066400000000000000000000005511405052102700337430ustar00rootroot00000000000000/** *{@link io.vertx.test.linktosamenameconstructorandmethod.TheClass#TheClass} *{@link io.vertx.test.linktosamenameconstructorandmethod.TheClass#TheClass()} *{@link io.vertx.test.linktosamenameconstructorandmethod.TheClass#TheClass(java.lang.String)} */ @Document package io.vertx.test.linktosamenameconstructorandmethod; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenamefieldandmethod/000077500000000000000000000000001405052102700272515ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenamefieldandmethod/TheClass.java000066400000000000000000000003211405052102700316160ustar00rootroot00000000000000package io.vertx.test.linktosamenamefieldandmethod; /** * @author Julien Viet */ public class TheClass { public void member() { } public String member; } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktosamenamefieldandmethod/package-info.java000066400000000000000000000003641405052102700324430ustar00rootroot00000000000000/** *{@link io.vertx.test.linktosamenamefieldandmethod.TheClass#member} *{@link io.vertx.test.linktosamenamefieldandmethod.TheClass#member()} */ @Document package io.vertx.test.linktosamenamefieldandmethod; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticfield/000077500000000000000000000000001405052102700250665ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticfield/TheClass.java000066400000000000000000000002531405052102700274370ustar00rootroot00000000000000package io.vertx.test.linktostaticfield; /** * @author Julien Viet */ public class TheClass { public static String f1; } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticfield/package-info.java000066400000000000000000000002231405052102700302520ustar00rootroot00000000000000/** *{@link io.vertx.test.linktostaticfield.TheClass#f1} */ @Document package io.vertx.test.linktostaticfield; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticmethod/000077500000000000000000000000001405052102700252635ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticmethod/TheClass.java000066400000000000000000000002551405052102700276360ustar00rootroot00000000000000package io.vertx.test.linktostaticmethod; /** * @author Julien Viet */ public class TheClass { public static void m() {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linktostaticmethod/package-info.java000066400000000000000000000002261405052102700304520ustar00rootroot00000000000000/** *{@link io.vertx.test.linktostaticmethod.TheClass#m()} */ @Document package io.vertx.test.linktostaticmethod; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkunresolved/000077500000000000000000000000001405052102700244165ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkunresolved/TheClass.java000066400000000000000000000001011405052102700267570ustar00rootroot00000000000000package io.vertx.test.linkunresolved; public class TheClass { } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkunresolved/package-info.java000066400000000000000000000002121405052102700276000ustar00rootroot00000000000000/** * {@link io.vertx.test.linkunresolved.TheClass} */ @Document package io.vertx.test.linkunresolved; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkunresolvedtypewithsignature/000077500000000000000000000000001405052102700301365ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkunresolvedtypewithsignature/package-info.java000066400000000000000000000002711405052102700333250ustar00rootroot00000000000000/** * {@link io.vertx.test.linkunresolvedtypewithsignature.DoesNotExist#whatever} */ @Document package io.vertx.test.linkunresolvedtypewithsignature; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkwithlabel/000077500000000000000000000000001405052102700242035ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkwithlabel/TheClass.java000066400000000000000000000002411405052102700265510ustar00rootroot00000000000000package io.vertx.test.linkwithlabel; /** * @author Julien Viet */ public class TheClass { public void m() {} } vertx-docgen-0.9.4/src/test/java/io/vertx/test/linkwithlabel/package-info.java000066400000000000000000000002341405052102700273710ustar00rootroot00000000000000/** *{@link io.vertx.test.linkwithlabel.TheClass#m() the label value} */ @Document package io.vertx.test.linkwithlabel; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/margin/000077500000000000000000000000001405052102700226275ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/margin/package-info.java000066400000000000000000000001411405052102700260120ustar00rootroot00000000000000/** * A * B * C */ @Document package io.vertx.test.margin; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/markup/000077500000000000000000000000001405052102700226515ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/markup/package-info.java000066400000000000000000000002341405052102700260370ustar00rootroot00000000000000/** * abc_content * def_content * */ @Document package io.vertx.test.markup; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/000077500000000000000000000000001405052102700244625ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/README.md000066400000000000000000000000711405052102700257370ustar00rootroot00000000000000Contains the resources required to tests post-processors.vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/code/000077500000000000000000000000001405052102700253745ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/code/package-info.java000066400000000000000000000004521405052102700305640ustar00rootroot00000000000000/** * This document checks that code are not stripped by post-processors. * * [source,java] * ---- * System.out.println("Hello"); * ---- * * [source] * ---- * System.out.println("Bye"); * ---- */ @Document() package io.vertx.test.postprocessors.code; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/language/000077500000000000000000000000001405052102700262455ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/language/package-info.java000066400000000000000000000006551405052102700314420ustar00rootroot00000000000000/** * This document should be different according to the language. * * [language,java] * ---- * This is only displayed for java. But it can have... * Several lines. * ---- * * [language, javascript, ruby] * ---- * This is only displayed for javascript and ruby. * ---- * * This is some text. Very important stuff... * */ @Document() package io.vertx.test.postprocessors.language; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/links/000077500000000000000000000000001405052102700256025ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/links/package-info.java000066400000000000000000000004041405052102700307670ustar00rootroot00000000000000/** * This document checks post-rpcessor content is processed. * * [test] * ---- * This paragraph contains a link: {@link io.vertx.docgen.BaseProcessor}. * ---- */ @Document() package io.vertx.test.postprocessors.links; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/missing/000077500000000000000000000000001405052102700261335ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/missing/package-info.java000066400000000000000000000003541405052102700313240ustar00rootroot00000000000000/** * This document checks that missing post-processor contents stay untouched. * * [missing] * ---- * This should be included. * ---- */ @Document() package io.vertx.test.postprocessors.missing; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/nested/000077500000000000000000000000001405052102700257445ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/postprocessors/nested/package-info.java000066400000000000000000000004341405052102700311340ustar00rootroot00000000000000/** * This document checks that post-processor blocks can contain nested blocks. * * [language,java] * ---- * [source,java] * \---- * System.out.println("Hello"); * \---- * ---- * */ @Document() package io.vertx.test.postprocessors.nested; import io.vertx.docgen.Document;vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/000077500000000000000000000000001405052102700226525ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/Example.java000066400000000000000000000003051405052102700251060ustar00rootroot00000000000000package io.vertx.test.source; import io.vertx.docgen.Source; /** * Dummy class used in tests. */ @Source public class Example { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/ExampleNotTranslated.java000066400000000000000000000003731405052102700276160ustar00rootroot00000000000000package io.vertx.test.source; import io.vertx.docgen.Source; /** * The code from this class must not be translated. */ @Source(translate = false) public class ExampleNotTranslated { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/notTranslated/000077500000000000000000000000001405052102700254745ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/notTranslated/Example.java000066400000000000000000000003231405052102700277300ustar00rootroot00000000000000package io.vertx.test.source.notTranslated; import io.vertx.docgen.Source; /** * Dummy class used in tests. */ @Source public class Example { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/notTranslated/package-info.java000066400000000000000000000001461405052102700306640ustar00rootroot00000000000000@Source(translate = false) package io.vertx.test.source.notTranslated; import io.vertx.docgen.Source;vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/notTranslated/sub/000077500000000000000000000000001405052102700262655ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/notTranslated/sub/Example.java000066400000000000000000000003031405052102700305170ustar00rootroot00000000000000package io.vertx.test.source.notTranslated.sub; import io.vertx.docgen.Source; @Source(translate = true) public class Example { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/package-info.java000066400000000000000000000012631405052102700260430ustar00rootroot00000000000000/** * # 1 * [source, $lang] * ---- * {@link io.vertx.test.source.Example#hello()} * ---- * # 2 * [source, $lang] * ---- * {@link io.vertx.test.source.ExampleNotTranslated#hello()} * ---- * # 3 * [source, $lang] * ---- * {@link io.vertx.test.source.translated.Example#hello()} * ---- * # 4 * [source, $lang] * ---- * {@link io.vertx.test.source.translated.sub.Example#hello()} * ---- * # 5 * [source, java] * ---- * {@link io.vertx.test.source.notTranslated.Example#hello()} * ---- * # 6 * [source, java] * ---- * {@link io.vertx.test.source.notTranslated.sub.Example#hello()} * ---- */ @Document package io.vertx.test.source; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/translated/000077500000000000000000000000001405052102700250135ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/translated/Example.java000066400000000000000000000003201405052102700272440ustar00rootroot00000000000000package io.vertx.test.source.translated; import io.vertx.docgen.Source; /** * Dummy class used in tests. */ @Source public class Example { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/translated/package-info.java000066400000000000000000000001201405052102700301730ustar00rootroot00000000000000@Source package io.vertx.test.source.translated; import io.vertx.docgen.Source;vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/translated/sub/000077500000000000000000000000001405052102700256045ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/source/translated/sub/Example.java000066400000000000000000000003021405052102700300350ustar00rootroot00000000000000package io.vertx.test.source.translated.sub; import io.vertx.docgen.Source; @Source(translate = false) public class Example { public void hello() { System.out.println("Hello"); } } vertx-docgen-0.9.4/src/test/java/io/vertx/test/unknowntag/000077500000000000000000000000001405052102700235455ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/unknowntag/package-info.java000066400000000000000000000002141405052102700267310ustar00rootroot00000000000000/** * before * @sometag should not be stripped * after */ @Document package io.vertx.test.unknowntag; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/java/io/vertx/test/variables/000077500000000000000000000000001405052102700233225ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/java/io/vertx/test/variables/package-info.java000066400000000000000000000001651405052102700265130ustar00rootroot00000000000000/** * ${foo} ${missing} ${baz} ${} */ @Document package io.vertx.test.variables; import io.vertx.docgen.Document; vertx-docgen-0.9.4/src/test/resources/000077500000000000000000000000001405052102700177055ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/resources/docs/000077500000000000000000000000001405052102700206355ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/resources/docs/dir/000077500000000000000000000000001405052102700214135ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/resources/docs/dir/bar.adoc000066400000000000000000000000141405052102700230020ustar00rootroot00000000000000bar_content vertx-docgen-0.9.4/src/test/resources/docs/dir/foo.adoc000066400000000000000000000000141405052102700230210ustar00rootroot00000000000000foo_content vertx-docgen-0.9.4/src/test/resources/docs/dir/juu/000077500000000000000000000000001405052102700222165ustar00rootroot00000000000000vertx-docgen-0.9.4/src/test/resources/docs/dir/juu/daa.adoc000066400000000000000000000000141405052102700235660ustar00rootroot00000000000000daa_content vertx-docgen-0.9.4/src/test/resources/docs/include.adoc000066400000000000000000000001011405052102700231000ustar00rootroot00000000000000{@link io.vertx.test.file.TheExample#someMethod()}vertx-docgen-0.9.4/src/test/resources/docs/lang.adoc000066400000000000000000000000251405052102700224030ustar00rootroot00000000000000The \$lang is : $langvertx-docgen-0.9.4/src/test/resources/docs/link.adoc000066400000000000000000000006511405052102700224240ustar00rootroot00000000000000<1>{@link io.vertx.test.file.TheClass} <2>{@link io.vertx.test.file.TheClass#m1} <3>{@link io.vertx.test.file.TheClass#m1 the label value} <4>{@link io.vertx.test.file.TheClass#m1()} <5>{@link io.vertx.test.file.TheClass#m2(java.lang.String)} <6>{@link io.vertx.test.file.TheClass#m3(java.lang.String, boolean)} <7>{@link io.vertx.test.file.TheClass#m3(java.lang.String, boolean) the label value} vertx-docgen-0.9.4/src/test/resources/docs/linkafternewline.adoc000066400000000000000000000000671405052102700250310ustar00rootroot00000000000000a {@link io.vertx.test.file.TheClass} watch the space! vertx-docgen-0.9.4/src/test/resources/docs/linktounresolvabletype.adoc000066400000000000000000000000671405052102700263140ustar00rootroot00000000000000{@link io.vertx.test.file.DoesNotExists}vertx-docgen-0.9.4/src/test/resources/docs/linkwithlabel.adoc000066400000000000000000000001031405052102700243100ustar00rootroot00000000000000{@link io.vertx.test.file.TheClass the label value}vertx-docgen-0.9.4/src/test/resources/docs/simple.adoc000066400000000000000000000000131405052102700227500ustar00rootroot00000000000000the_contentvertx-docgen-0.9.4/test-proj/000077500000000000000000000000001405052102700160545ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/build.gradle000066400000000000000000000013711405052102700203350ustar00rootroot00000000000000plugins { id 'java' } version '1.0-SNAPSHOT' ext { vertxVersion = "3.3.2" } repositories { jcenter() } // compileOnly requires Gradle 2.12+ task docProcessing(type: JavaCompile, group: 'build') { source = sourceSets.main.java classpath = configurations.compile + configurations.compileOnly destinationDir = project.file('src/main/asciidoc') options.compilerArgs = [ "-proc:only", "-processor", "io.vertx.docgen.JavaDocGenProcessor", "-Adocgen.output=${project.buildDir}/asciidoc", "-Adocgen.source=${project.projectDir}/src/main/asciidoc/doc.adoc" ] } compileJava { targetCompatibility = 1.8 sourceCompatibility = 1.8 dependsOn docProcessing } dependencies { compileOnly("io.vertx:vertx-docgen:${vertxVersion}") } vertx-docgen-0.9.4/test-proj/pom.xml000066400000000000000000000060261405052102700173750ustar00rootroot00000000000000 4.0.0 test proj 1.0-SNAPSHOT ${java.home}/../lib/tools.jar com.sun tools 1.8 system ${tools.jar} true io.vertx vertx-docgen 3.4.0-SNAPSHOT maven-javadoc-plugin 2.10.1 javadoc-no-fork -Xdoclint:none process-classes org.asciidoctor asciidoctor-maven-plugin 1.5.0 process-asciidoc ${project.build.directory}/asciidoc index.adoc ${project.build.directory}/site html book process-classes maven-compiler-plugin 3.1 1.8 1.8 io.vertx.docgen.JavaDocGenProcessor default-compile -Adocgen.output=${project.build.directory}/asciidoc -Adocgen.source=${project.basedir}/src/main/asciidoc/doc.adoc vertx-docgen-0.9.4/test-proj/src/000077500000000000000000000000001405052102700166435ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/000077500000000000000000000000001405052102700175675ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/asciidoc/000077500000000000000000000000001405052102700213455ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/asciidoc/doc.adoc000066400000000000000000000000751405052102700227440ustar00rootroot00000000000000= The great project include::{@link test.proj.foofeature}[] vertx-docgen-0.9.4/test-proj/src/main/java/000077500000000000000000000000001405052102700205105ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/java/test/000077500000000000000000000000001405052102700214675ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/000077500000000000000000000000001405052102700224415ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/000077500000000000000000000000001405052102700246005ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/Examples.java000066400000000000000000000011411405052102700272160ustar00rootroot00000000000000package test.proj.foofeature; import io.vertx.docgen.Source; import java.util.List; import java.util.ArrayList; import java.util.Set; import java.util.HashSet; import java.lang.UnsupportedOperationException; @Source public class Examples { private FooApi getFoo() { throw new UnsupportedOperationException(); } public void fooExample() { FooApi foo = getFoo(); // <1> List list = new ArrayList<>(); Runnable lambda = () -> { System.out.println("hello from lambda"); }; Set set = new HashSet<>(); foo.myMethod("whatever", 0, list, set); // <2> } }vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/FooApi.java000066400000000000000000000003041405052102700266150ustar00rootroot00000000000000package test.proj.foofeature; import java.util.Set; public class FooApi { public String myField; public void myMethod(String s, int i, java.util.List list, Set set) { } }vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/package-info.java000066400000000000000000000012511405052102700277660ustar00rootroot00000000000000/** * == The foo feature. * * The {@link test.proj.foofeature.FooApi api class} * The {@link test.proj.foofeature.FooApi#myMethod api method} * The {@link test.proj.foofeature.FooApi#myField api field} * * * item1 * * item 2 * * item 3 * * Some code: * * [source,java] * ---- * {@link test.proj.foofeature.Examples#fooExample} * ---- * <1> get a Foo * <2> call {@link test.proj.foofeature.FooApi#myMethod api method} * * === A sub section * * {@link test.proj.foofeature.subsection} * * === Let's see some code * * There is some code here: {@code System.out.println("Hello");}. */ @Document package test.proj.foofeature; import io.vertx.docgen.Document;vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/subsection/000077500000000000000000000000001405052102700267565ustar00rootroot00000000000000vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/foofeature/subsection/package-info.java000066400000000000000000000001211405052102700321370ustar00rootroot00000000000000/** * A literaly included section */ package test.proj.foofeature.subsection; vertx-docgen-0.9.4/test-proj/src/main/java/test/proj/package-info.java000066400000000000000000000002501405052102700256250ustar00rootroot00000000000000/** * = The great project * * include::{@link test.proj.foofeature}[] * */ @Document(fileName = "index.adoc") package test.proj; import io.vertx.docgen.Document;