More code cleanups

This commit is contained in:
Erik C. Thauvin 2024-06-23 18:06:17 -07:00
parent 75a864acfe
commit 2f9da45172
Signed by: erik
GPG key ID: 776702A6A2DA330E
2 changed files with 53 additions and 67 deletions

View file

@ -56,7 +56,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
private final Map<String, String> pluginsConfiguration_ = new ConcurrentHashMap<>();
private boolean delayTemplateSubstitution_;
private boolean failOnWarning_;
private File json;
private File json_;
private LoggingLevel loggingLevel_;
private String moduleName_;
private String moduleVersion_;
@ -77,11 +77,11 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
/**
* Returns the list of JARs contained in a given directory.
* Returns the JARs contained in a given directory.
*
* @param directory the directory
* @param regex the regular expression to match
* @return the list of JARs
* @return the Java Archives
*/
public static List<File> getJarList(File directory, String regex) {
var jars = new ArrayList<File>();
@ -255,8 +255,8 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
// json
if (json != null) {
args.add(json.getAbsolutePath());
if (json_ != null) {
args.add(json_.getAbsolutePath());
}
if (LOGGER.isLoggable(Level.FINE)) {
@ -338,7 +338,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
/**
* Sets the global list of package configurations.
* Sets the global package configurations.
* <p>
* Using format:
* <ul>
@ -355,12 +355,12 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation globalPackageOptions(String... options) {
Collections.addAll(globalPackageOptions_, options);
globalPackageOptions_.addAll(List.of(options));
return this;
}
/**
* Retrieves the global list of package configurations.
* Retrieves the global package configurations.
*
* @return the package configurations
*/
@ -369,7 +369,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
/**
* Sets the global list of package configurations.
* Sets the global package configurations.
* <p>
* Using format:
* <ul>
@ -382,7 +382,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* <li>...</li>
* </ul>
*
* @param options the list of package configurations
* @param options the package configurations
* @return this operation instance
*/
public DokkaOperation globalPackageOptions(Collection<String> options) {
@ -397,7 +397,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation globalSrcLink(String... links) {
Collections.addAll(globalSrcLinks_, links);
globalSrcLinks_.addAll(List.of(links));
return this;
}
@ -432,7 +432,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation includes(File... files) {
Collections.addAll(includes_, files);
includes_.addAll(List.of(files));
return this;
}
@ -447,9 +447,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @return this operation instance
*/
public DokkaOperation includes(String... files) {
Collections.addAll(includes_, Arrays.stream(files)
.map(File::new)
.toArray(File[]::new));
includes_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
}
@ -469,7 +467,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* <p>
* This can be configured on per-package basis.
*
* @param files the list of files
* @param files the markdown files
* @return this operation instance
*/
public DokkaOperation includes(Collection<File> files) {
@ -483,7 +481,7 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
* @param configuration the configuration file path
*/
public DokkaOperation json(File configuration) {
json = configuration;
json_ = configuration;
return this;
}
@ -648,26 +646,24 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
/**
* Sets the list of jars with Dokka plugins and their dependencies.
* Sets the jars for Dokka plugins and their dependencies.
*
* @param jars one or more jars
* @return this operation instance
*/
public DokkaOperation pluginsClasspath(File... jars) {
Collections.addAll(pluginsClasspath_, jars);
pluginsClasspath_.addAll(List.of(jars));
return this;
}
/**
* Sets the list of jars with Dokka plugins and their dependencies.
* Sets the jars for Dokka plugins and their dependencies.
*
* @param jars one or more jars
* @return this operation instance
*/
public DokkaOperation pluginsClasspath(String... jars) {
Collections.addAll(pluginsClasspath_, Arrays.stream(jars)
.map(File::new)
.toArray(File[]::new));
pluginsClasspath_.addAll(Arrays.stream(jars).map(File::new).toList());
return this;
}
@ -681,9 +677,9 @@ public class DokkaOperation extends AbstractProcessOperation<DokkaOperation> {
}
/**
* Sets the list of jars with Dokka plugins and their dependencies.
* Sets the jars for Dokka plugins and their dependencies.
*
* @param jars the list of jars
* @param jars the jars
* @return this operation instance
*/
public DokkaOperation pluginsClasspath(Collection<File> jars) {

View file

@ -243,7 +243,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet classpath(File... files) {
Collections.addAll(classpath_, files);
classpath_.addAll(List.of(files));
return this;
}
@ -258,9 +258,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet classpath(String... files) {
Collections.addAll(classpath_, Arrays.stream(files)
.map(File::new)
.toArray(File[]::new));
classpath_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
}
@ -271,7 +269,7 @@ public class SourceSet {
* <p>
* This option accepts both {@code .jar} and {@code .klib} files.
*
* @param files the list of files
* @param files the collection of files
* @return this operation instance
*/
public SourceSet classpath(Collection<File> files) {
@ -349,7 +347,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet documentedVisibilities(DocumentedVisibility... visibilities) {
documentedVisibilities_.addAll(Arrays.asList(visibilities));
documentedVisibilities_.addAll(List.of(visibilities));
return this;
}
@ -402,7 +400,7 @@ public class SourceSet {
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* A list of Markdown files that contain module and package documentation.
* The Markdown files that contain module and package documentation.
* <p>
* The contents of the specified files are parsed and embedded into documentation as module and package
* descriptions.
@ -411,14 +409,14 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet includes(File... files) {
Collections.addAll(includes_, files);
includes_.addAll(List.of(files));
return this;
}
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* A list of Markdown files that contain module and package documentation.
* The Markdown files that contain module and package documentation.
* <p>
* The contents of the specified files are parsed and embedded into documentation as module and package
* descriptions.
@ -427,9 +425,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet includes(String... files) {
Collections.addAll(includes_, Arrays.stream(files)
.map(File::new)
.toArray(File[]::new));
includes_.addAll(Arrays.stream(files).map(File::new).toList());
return this;
}
@ -445,12 +441,12 @@ public class SourceSet {
/**
* Sets the Markdown files that contain module and package documentation.
* <p>
* A list of Markdown files that contain module and package documentation.
* The Markdown files that contain module and package documentation.
* <p>
* The contents of the specified files are parsed and embedded into documentation as module and package
* descriptions.
*
* @param files the list of files
* @param files the collection of files
* @return this operation instance
*/
public SourceSet includes(Collection<File> files) {
@ -559,7 +555,7 @@ public class SourceSet {
}
/**
* Set the list of package source set configuration.
* Set the package source set configuration.
* <p>
* A set of parameters specific to matched packages within this source set.
* <p>
@ -574,7 +570,7 @@ public class SourceSet {
* <li>...</li>
* </ul>
*
* @param perPackageOptions the list of per package options
* @param perPackageOptions the per package options
* @return this operation instance
*/
public SourceSet perPackageOptions(Collection<String> perPackageOptions) {
@ -583,7 +579,7 @@ public class SourceSet {
}
/**
* Retrieves the list of package source set configuration.
* Retrieves the package source set configuration.
*
* @return the package source set configuration
*/
@ -592,7 +588,7 @@ public class SourceSet {
}
/**
* Set the list of package source set configuration.
* Set the package source set configuration.
* <p>
* A set of parameters specific to matched packages within this source set.
* <p>
@ -607,11 +603,11 @@ public class SourceSet {
* <li>...</li>
* </ul>
*
* @param perPackageOptions the list of per package options
* @param perPackageOptions the per package options
* @return this operation instance
*/
public SourceSet perPackageOptions(String... perPackageOptions) {
Collections.addAll(perPackageOptions_, perPackageOptions);
perPackageOptions_.addAll(List.of(perPackageOptions));
return this;
}
@ -634,12 +630,12 @@ public class SourceSet {
}
/**
* Set the list of directories or files that contain sample functions.
* Set the directories or files that contain sample functions.
* <p>
* A list of directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* tag.
*
* @param samples the list of samples
* @param samples the samples
* @return this operation instance
*/
public SourceSet samples(Collection<File> samples) {
@ -648,7 +644,7 @@ public class SourceSet {
}
/**
* Retrieves the list of directories or files that contain sample functions.
* Retrieves the directories or files that contain sample functions.
*
* @return the directories or files
*/
@ -657,32 +653,30 @@ public class SourceSet {
}
/**
* Set the list of directories or files that contain sample functions.
* Set the directories or files that contain sample functions.
* <p>
* A list of directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* tag.
*
* @param samples nne or more samples
* @return this operation instance
*/
public SourceSet samples(File... samples) {
Collections.addAll(samples_, samples);
samples_.addAll(List.of(samples));
return this;
}
/**
* Set the list of directories or files that contain sample functions.
* Set the directories or files that contain sample functions.
* <p>
* A list of directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* The directories or files that contain sample functions which are referenced via the {@code @sample} KDoc
* tag.
*
* @param samples nne or more samples
* @return this operation instance
*/
public SourceSet samples(String... samples) {
Collections.addAll(samples_, Arrays.stream(samples)
.map(File::new)
.toArray(File[]::new));
samples_.addAll(Arrays.stream(samples).map(File::new).toList());
return this;
}
@ -718,7 +712,7 @@ public class SourceSet {
* The source code roots to be analyzed and documented. Acceptable inputs are directories and individual
* {@code .kt} / {@code .java} files.
*
* @param src the list of source code roots
* @param src the source code roots
* @return this operation instance
*/
public SourceSet src(Collection<File> src) {
@ -736,7 +730,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet src(File... src) {
Collections.addAll(src_, src);
src_.addAll(List.of(src));
return this;
}
@ -750,9 +744,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet src(String... src) {
Collections.addAll(src_, Arrays.stream(src)
.map(File::new)
.toArray(File[]::new));
src_.addAll(Arrays.stream(src).map(File::new).toList());
return this;
}
@ -805,7 +797,7 @@ public class SourceSet {
* <p>
* The files to be suppressed when generating documentation.
*
* @param suppressedFiles the list of suppressed files
* @param suppressedFiles the suppressed files
* @return this operation instance
*/
public SourceSet suppressedFiles(Collection<File> suppressedFiles) {
@ -832,9 +824,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet suppressedFiles(String... suppressedFiles) {
Collections.addAll(suppressedFiles_, Arrays.stream(suppressedFiles)
.map(File::new)
.toArray(File[]::new));
suppressedFiles_.addAll(Arrays.stream(suppressedFiles).map(File::new).toList());
return this;
}
@ -847,7 +837,7 @@ public class SourceSet {
* @return this operation instance
*/
public SourceSet suppressedFiles(File... suppressedFiles) {
suppressedFiles_.addAll(Arrays.asList(suppressedFiles));
suppressedFiles_.addAll(List.of(suppressedFiles));
return this;
}
}