Skip to content

Commit

Permalink
Don't duplicate ...intern.tool.
Browse files Browse the repository at this point in the history
It's the doclet independent part of javadoc. While it's also internal,
substituting it makes the invocation more difficult, because our doclet
is needed on the general classpath as well as
on the doclet-classpat.
  • Loading branch information
mnlipp committed Sep 25, 2023
1 parent 39ae2a1 commit 83b4b10
Show file tree
Hide file tree
Showing 29 changed files with 23 additions and 6,734 deletions.
6 changes: 3 additions & 3 deletions mdoclet/MDoclet-Test (Java 21).launch
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/mdoclet/src/org/jdrupes/mdoclet/internal/tool/Main.java"/>
<listEntry value="/mdoclet"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jdrupes.mdoclet.internal.tool.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="jdk.javadoc.internal.tool.Main"/>
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="mdoclet"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="--add-exports=jdk.javadoc/org.jdrupes.mdoclet.internal.tool=ALL-UNNAMED&#10;--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED&#10;-doclet org.jdrupes.mdoclet.MDoclet --disable-auto-highlight -Xdoclint:-html&#10;-overview testfiles/overview.md -d build/testfiles testfiles/test/Test.java testfiles/test/MDocletExample.java"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="mdoclet"/>
Expand Down
6 changes: 3 additions & 3 deletions mdoclet/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ task apidocs(type: JavaExec) {
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED']
classpath jar
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED']
classpath sourceSets.main.compileClasspath

main = 'org.jdrupes.mdoclet.internal.tool.Main'
main = 'jdk.javadoc.internal.tool.Main'
args = ['-doctitle', 'JDrupes MDoclet',
'-use',
'-linksource',
Expand Down
4 changes: 3 additions & 1 deletion mdoclet/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Specify the Doclet on JavaDoc's command line:
-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \
-J--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED \
-J--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED \
-doclet org.jdrupes.mdoclet.MDoclet -docletpath /path/to/org.jdrupes.mdoclet.jar:another.jar</code></pre>
</div>

Expand Down Expand Up @@ -181,7 +182,8 @@ task apidocs(type: JavaExec) {
'--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED',
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED']
'--add-exports=jdk.compiler/com.sun.tools.doclint=ALL-UNNAMED',
'--add-exports=jdk.javadoc/jdk.javadoc.internal.tool=ALL-UNNAMED']
classpath sourceSets.main.compileClasspath
main = 'jdk.javadoc.internal.tool.Main'
args = ['-doctitle', "My Code",
Expand Down
2 changes: 1 addition & 1 deletion mdoclet/src/org/jdrupes/mdoclet/MDocletEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject.Kind;

import org.jdrupes.mdoclet.internal.tool.DocEnvImpl;
import jdk.javadoc.internal.tool.DocEnvImpl;

import com.sun.source.util.DocTrees;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import javax.tools.DocumentationTool.DocumentationTask;

import org.jdrupes.mdoclet.internal.tool.Start;
import jdk.javadoc.internal.tool.Start;

import javax.tools.JavaFileObject;

Expand All @@ -57,17 +57,16 @@ public class JavadocTaskImpl implements DocumentationTask {
private final List<String> addModules = new ArrayList<>();

public JavadocTaskImpl(Context context,
Class<?> docletClass,
Iterable<String> options,
Iterable<? extends JavaFileObject> fileObjects)
{
Class<?> docletClass,
Iterable<String> options,
Iterable<? extends JavaFileObject> fileObjects) {
this.context = context;
this.docletClass = docletClass;

this.options = (options == null) ? Set.of()
: nullCheck(options);
: nullCheck(options);
this.fileObjects = (fileObjects == null) ? Set.of()
: nullCheck(fileObjects);
: nullCheck(fileObjects);
setLocale(Locale.getDefault());
}

Expand Down Expand Up @@ -105,13 +104,14 @@ public Boolean call() {
}

private void initContext() {
//initialize compiler's default locale
// initialize compiler's default locale
context.put(Locale.class, locale);
if (!addModules.isEmpty()) {
String names = String.join(",", addModules);
Options opts = Options.instance(context);
String prev = opts.get(Option.ADD_MODULES);
opts.put(Option.ADD_MODULES, (prev == null) ? names : prev + "," + names);
opts.put(Option.ADD_MODULES,
(prev == null) ? names : prev + "," + names);
}
}

Expand Down
4 changes: 2 additions & 2 deletions mdoclet/src/org/jdrupes/mdoclet/internal/api/JavadocTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
import javax.tools.JavaFileObject;
import javax.tools.StandardJavaFileManager;

import org.jdrupes.mdoclet.internal.tool.ToolOptions;
import jdk.javadoc.internal.tool.ToolOptions;

import com.sun.tools.javac.api.ClientCodeWrapper;
import com.sun.tools.javac.file.JavacFileManager;
Expand Down Expand Up @@ -161,7 +161,7 @@ public int run(InputStream in, OutputStream out, OutputStream err,
= new PrintWriter(err == null ? System.err : err, true);
PrintWriter out_pw = new PrintWriter(out == null ? System.out : out);
try {
return org.jdrupes.mdoclet.internal.tool.Main.execute(arguments,
return jdk.javadoc.internal.tool.Main.execute(arguments,
err_pw);
} finally {
err_pw.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
import javax.tools.JavaFileManager.Location;

import org.jdrupes.mdoclet.internal.doclets.toolkit.util.Utils;
import org.jdrupes.mdoclet.internal.tool.DocEnvImpl;
import org.jdrupes.mdoclet.internal.tool.ToolEnvironment;
import jdk.javadoc.internal.tool.DocEnvImpl;
import jdk.javadoc.internal.tool.ToolEnvironment;

import com.sun.source.util.TreePath;
import com.sun.tools.javac.code.Flags;
Expand Down
40 changes: 0 additions & 40 deletions mdoclet/src/org/jdrupes/mdoclet/internal/tool/AccessKind.java

This file was deleted.

119 changes: 0 additions & 119 deletions mdoclet/src/org/jdrupes/mdoclet/internal/tool/DocEnvImpl.java

This file was deleted.

0 comments on commit 83b4b10

Please sign in to comment.