Skip to content

Commit

Permalink
Fix problem found with overview when using mdoclet.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed Sep 27, 2023
1 parent 41caab0 commit 47412e7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 6 additions & 5 deletions plantUml9/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ java {
}
}

version = '3.0.0'
version = '3.1.0'

description = 'A taglet for processing PlantUML in javadoc comments'

Expand Down Expand Up @@ -144,11 +144,12 @@ task testAll(type: JavaExec) {
check.dependsOn(testAll)

task apidocs(type: JavaExec) {
dependsOn classes
dependsOn jar
inputs.file "overview.md"

jvmArgs = ['--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED']
jvmArgs = ['--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED'
]
classpath sourceSets.main.compileClasspath
classpath files(tasks.jar)

Expand All @@ -159,8 +160,8 @@ task apidocs(type: JavaExec) {
'-use',
'-linksource',
'-link', 'https://docs.oracle.com/en/java/javase/17/docs/api/',
'--add-exports', 'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'--add-exports', 'jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports', 'jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED',
'-doclet', 'org.jdrupes.mdoclet.MDoclet',
'-docletpath', configurations.markdownDoclet.files
.asType(List).join(File.pathSeparator),
Expand Down
11 changes: 8 additions & 3 deletions plantUml9/src/org/jdrupes/taglets/plantUml/PlantUml.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import javax.lang.model.element.Name;
import javax.lang.model.element.PackageElement;
import javax.lang.model.element.TypeElement;
import javax.lang.model.util.SimpleElementVisitor8;
import javax.lang.model.util.SimpleElementVisitor14;
import javax.tools.DocumentationTool;
import javax.tools.FileObject;
import javax.tools.JavaFileManager;
Expand Down Expand Up @@ -105,7 +105,12 @@ private void processTag(DocTree tree, Element element) {
+ " tag: Expected filename and PlantUML source");
}

String packageName = extractPackageName(element);
String packageName = "";
String elementType = element.getClass().getName();
if (elementType.endsWith("Symbol$ClassSymbol")
|| elementType.endsWith("Symbol$PackageSymbol")) {
packageName = extractPackageName(element);
}
FileObject graphicsFile;
try {
graphicsFile = fileManager.getFileForOutput(
Expand Down Expand Up @@ -137,7 +142,7 @@ private void processTag(DocTree tree, Element element) {
}

private String extractPackageName(Element element) {
return element.accept(new SimpleElementVisitor8<>() {
return element.accept(new SimpleElementVisitor14<>() {

@Override
public Name visitPackage(PackageElement e, Object p) {
Expand Down

0 comments on commit 47412e7

Please sign in to comment.