Skip to content
Permalink
Browse files

8254796: Cleanup pervasive unnecessary parameter

Reviewed-by: ksrini, hannesw
  • Loading branch information
jonathan-gibbons committed Oct 19, 2020
1 parent 953e472 commit 60f63ec811d834d9f1a7468a5552ffa12568b765
@@ -126,13 +126,12 @@ public HtmlConfiguration getConfiguration() {
* @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.
@@ -80,8 +80,6 @@
private final Resources resources;
private final Utils utils;

private final DocletEnvironment docEnv;

private final DocPath outputdir;

/**
@@ -90,33 +88,30 @@
*/
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;
}

/**
* 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()) {
@@ -110,7 +110,7 @@ public boolean run(DocletEnvironment docEnv) {

try {
try {
startGeneration(docEnv);
startGeneration();
return true;
} catch (UncheckedDocletException e) {
throw (DocletException) e.getCause();
@@ -187,7 +187,7 @@ public SourceVersion getSupportedSourceVersion() {
*
* @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 @@ private void startGeneration(DocletEnvironment docEnv) throws DocletException {
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,31 +256,22 @@ protected abstract void generateClassFiles(SortedSet<TypeElement> arr, ClassTree
/**
* 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);
for (PackageElement pkg : packages) {
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);
}
}
}

1 comment on commit 60f63ec

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 60f63ec Oct 19, 2020

Please sign in to comment.