8254796: Cleanup pervasive unnecessary parameter

Reviewed-by: ksrini, hannesw
This commit is contained in:
Jonathan Gibbons 2020-10-19 17:08:06 +00:00
parent 953e472ded
commit 60f63ec811
3 changed files with 20 additions and 37 deletions

View File

@ -126,13 +126,12 @@ public class HtmlDoclet extends AbstractDoclet {
* @throws DocletException if there is a problem while writing the other files
*/
@Override // defined by AbstractDoclet
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
protected void generateOtherFiles(ClassTree classtree)
throws DocletException {
super.generateOtherFiles(docEnv, classtree);
super.generateOtherFiles(classtree);
HtmlOptions options = configuration.getOptions();
if (options.linkSource()) {
SourceToHTMLConverter.convertRoot(configuration,
docEnv, DocPaths.SOURCE_OUTPUT);
SourceToHTMLConverter.convertRoot(configuration,DocPaths.SOURCE_OUTPUT);
}
// Modules with no documented classes may be specified on the
// command line to specify a service provider, allow these.

View File

@ -80,8 +80,6 @@ public class SourceToHTMLConverter {
private final Resources resources;
private final Utils utils;
private final DocletEnvironment docEnv;
private final DocPath outputdir;
/**
@ -90,14 +88,12 @@ public class SourceToHTMLConverter {
*/
private DocPath relativePath = DocPath.empty;
private SourceToHTMLConverter(HtmlConfiguration configuration, DocletEnvironment rd,
DocPath outputdir) {
private SourceToHTMLConverter(HtmlConfiguration configuration, DocPath outputdir) {
this.configuration = configuration;
this.options = configuration.getOptions();
this.messages = configuration.getMessages();
this.resources = configuration.docResources;
this.utils = configuration.utils;
this.docEnv = rd;
this.outputdir = outputdir;
}
@ -105,18 +101,17 @@ public class SourceToHTMLConverter {
* Translate the TypeElements in the given DocletEnvironment to HTML representation.
*
* @param configuration the configuration.
* @param docEnv the DocletEnvironment to convert.
* @param outputdir the name of the directory to output to.
* @throws DocFileIOException if there is a problem generating an output file
* @throws SimpleDocletException if there is a problem reading a source file
*/
public static void convertRoot(HtmlConfiguration configuration, DocletEnvironment docEnv,
DocPath outputdir) throws DocFileIOException, SimpleDocletException {
new SourceToHTMLConverter(configuration, docEnv, outputdir).generate();
public static void convertRoot(HtmlConfiguration configuration, DocPath outputdir)
throws DocFileIOException, SimpleDocletException {
new SourceToHTMLConverter(configuration, outputdir).generate();
}
void generate() throws DocFileIOException, SimpleDocletException {
if (docEnv == null || outputdir == null) {
if (outputdir == null) {
return;
}
for (ModuleElement mdl : configuration.getSpecifiedModuleElements()) {

View File

@ -110,7 +110,7 @@ public abstract class AbstractDoclet implements Doclet {
try {
try {
startGeneration(docEnv);
startGeneration();
return true;
} catch (UncheckedDocletException e) {
throw (DocletException) e.getCause();
@ -187,7 +187,7 @@ public abstract class AbstractDoclet implements Doclet {
*
* @throws DocletException if there is a problem while generating the documentation
*/
private void startGeneration(DocletEnvironment docEnv) throws DocletException {
private void startGeneration() throws DocletException {
// Modules with no documented classes may be specified on the
// command line to specify a service provider, allow these.
@ -203,25 +203,23 @@ public abstract class AbstractDoclet implements Doclet {
configuration.getDocletVersion());
ClassTree classtree = new ClassTree(configuration, configuration.getOptions().noDeprecated());
generateClassFiles(docEnv, classtree);
generateClassFiles(classtree);
ElementListWriter.generate(configuration);
generatePackageFiles(classtree);
generateModuleFiles();
generateOtherFiles(docEnv, classtree);
generateOtherFiles(classtree);
configuration.tagletManager.printReport();
}
/**
* Generate additional documentation that is added to the API documentation.
*
* @param docEnv the DocletEnvironment
* @param classtree the data structure representing the class tree
* @throws DocletException if there is a problem while generating the documentation
*/
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
throws DocletException {
protected void generateOtherFiles(ClassTree classtree) throws DocletException {
BuilderFactory builderFactory = configuration.getBuilderFactory();
AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuilder();
constantsSummaryBuilder.build();
@ -258,13 +256,17 @@ public abstract class AbstractDoclet implements Doclet {
/**
* Iterate through all classes and construct documentation for them.
*
* @param docEnv the DocletEnvironment
* @param classtree the data structure representing the class tree
* @throws DocletException if there is a problem while generating the documentation
*/
protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
protected void generateClassFiles(ClassTree classtree)
throws DocletException {
generateClassFiles(classtree);
// handle classes specified as files on the command line
for (PackageElement pkg : configuration.typeElementCatalog.packages()) {
generateClassFiles(configuration.typeElementCatalog.allClasses(pkg), classtree);
}
// handle classes specified in m odules and packages on the command line
SortedSet<PackageElement> packages = new TreeSet<>(utils.comparators.makePackageComparator());
packages.addAll(configuration.getSpecifiedPackageElements());
configuration.modulePackages.values().stream().forEach(packages::addAll);
@ -272,17 +274,4 @@ public abstract class AbstractDoclet implements Doclet {
generateClassFiles(utils.getAllClasses(pkg), classtree);
}
}
/**
* Generate the class files for single classes specified on the command line.
*
* @param classtree the data structure representing the class tree
* @throws DocletException if there is a problem while generating the documentation
*/
private void generateClassFiles(ClassTree classtree) throws DocletException {
SortedSet<PackageElement> packages = configuration.typeElementCatalog.packages();
for (PackageElement pkg : packages) {
generateClassFiles(configuration.typeElementCatalog.allClasses(pkg), classtree);
}
}
}