This is an automated email from the ASF dual-hosted git repository. Claudenw pushed a commit to branch replace-ireportable-with-reportable in repository https://gitbox.apache.org/repos/asf/creadur-rat.git
commit 35a4a8978d2d73b336d1a7a3e3e2a0c1b8845402 Author: Claude Warren <[email protected]> AuthorDate: Sun Jun 28 08:33:56 2026 +0100 rename IReportable and IReportableListWalker --- .../main/java/org/apache/rat/OptionCollection.java | 6 +++--- .../org/apache/rat/OptionCollectionParser.java | 4 ++-- .../java/org/apache/rat/ReportConfiguration.java | 12 ++++++------ .../report/{IReportable.java => Reportable.java} | 4 ++-- .../java/org/apache/rat/walker/FileListWalker.java | 8 ++++---- ...leListWalker.java => ReportableListWalker.java} | 22 +++++++++++----------- .../main/java/org/apache/rat/walker/Walker.java | 6 +++--- .../java/org/apache/rat/OptionCollectionTest.java | 8 ++++---- .../org/apache/rat/ReportConfigurationTest.java | 8 ++++---- .../rat/anttasks/ResourceCollectionContainer.java | 6 +++--- 10 files changed, 42 insertions(+), 42 deletions(-) diff --git a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java index d0439808..eeddb497 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java +++ b/apache-rat-core/src/main/java/org/apache/rat/OptionCollection.java @@ -48,7 +48,7 @@ import org.apache.rat.document.DocumentNameMatcher; import org.apache.rat.document.FileDocument; import org.apache.rat.help.Licenses; import org.apache.rat.license.LicenseSetFactory; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; import org.apache.rat.report.claim.ClaimStatistic; import org.apache.rat.utils.DefaultLog; import org.apache.rat.utils.Log.Level; @@ -190,7 +190,7 @@ public final class OptionCollection { } } for (String s : commandLine.getArgs()) { - IReportable reportable = getReportable(new File(s), configuration); + Reportable reportable = getReportable(new File(s), configuration); if (reportable != null) { configuration.addSource(reportable); } @@ -215,7 +215,7 @@ public final class OptionCollection { * @param config the ReportConfiguration. * @return the IReportable instance containing the files. */ - public static IReportable getReportable(final File base, final ReportConfiguration config) { + public static Reportable getReportable(final File base, final ReportConfiguration config) { File absBase = base.getAbsoluteFile(); DocumentName documentName = DocumentName.builder(absBase).build(); if (!absBase.exists()) { diff --git a/apache-rat-core/src/main/java/org/apache/rat/OptionCollectionParser.java b/apache-rat-core/src/main/java/org/apache/rat/OptionCollectionParser.java index d40686c6..ba0d3156 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/OptionCollectionParser.java +++ b/apache-rat-core/src/main/java/org/apache/rat/OptionCollectionParser.java @@ -34,7 +34,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.rat.commandline.Arg; import org.apache.rat.commandline.ArgumentContext; import org.apache.rat.help.Licenses; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; import org.apache.rat.ui.UIOptionCollection; import org.apache.rat.utils.DefaultLog; @@ -126,7 +126,7 @@ public final class OptionCollectionParser { final CommandLine commandLine = argumentContext.getCommandLine(); if (!configuration.hasSource()) { for (String s : commandLine.getArgs()) { - IReportable reportable = OptionCollection.getReportable(new File(s), configuration); + Reportable reportable = OptionCollection.getReportable(new File(s), configuration); if (reportable != null) { configuration.addSource(reportable); } diff --git a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java index 799dfaf5..a95f12c4 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java +++ b/apache-rat-core/src/main/java/org/apache/rat/ReportConfiguration.java @@ -54,12 +54,12 @@ import org.apache.rat.license.ILicense; import org.apache.rat.license.ILicenseFamily; import org.apache.rat.license.LicenseSetFactory; import org.apache.rat.license.LicenseSetFactory.LicenseFilter; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; import org.apache.rat.utils.DefaultLog; import org.apache.rat.utils.Log.Level; import org.apache.rat.utils.ReportingSet; import org.apache.rat.walker.FileListWalker; -import org.apache.rat.walker.IReportableListWalker; +import org.apache.rat.walker.ReportableListWalker; /** * A configuration object is used by the front end to invoke the @@ -131,7 +131,7 @@ public class ReportConfiguration { /** * A list of reportables to process; */ - private final List<IReportable> reportables; + private final List<Reportable> reportables; /** * A predicate to test if a path should be included in the processing. @@ -210,7 +210,7 @@ public class ReportConfiguration { * Adds a Reportable as a source of files to scan. * @param reportable the reportable to process. */ - public void addSource(final IReportable reportable) { + public void addSource(final Reportable reportable) { notNull(reportable, "Reportable may not be null."); reportables.add(reportable); } @@ -227,9 +227,9 @@ public class ReportConfiguration { * Gets a builder initialized with any files specified as sources. * @return a configured builder. */ - public IReportableListWalker.Builder getSources() { + public ReportableListWalker.Builder getSources() { DocumentName name = DocumentName.builder(new File(".")).build(); - IReportableListWalker.Builder builder = IReportableListWalker.builder(name); + ReportableListWalker.Builder builder = ReportableListWalker.builder(name); sources.forEach(file -> builder.addReportable(new FileListWalker(new FileDocument(file, DocumentNameMatcher.MATCHES_ALL)))); reportables.forEach(builder::addReportable); return builder; diff --git a/apache-rat-core/src/main/java/org/apache/rat/report/IReportable.java b/apache-rat-core/src/main/java/org/apache/rat/report/Reportable.java similarity index 96% rename from apache-rat-core/src/main/java/org/apache/rat/report/IReportable.java rename to apache-rat-core/src/main/java/org/apache/rat/report/Reportable.java index 2c108af6..9d131ed8 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/report/IReportable.java +++ b/apache-rat-core/src/main/java/org/apache/rat/report/Reportable.java @@ -21,7 +21,7 @@ package org.apache.rat.report; import org.apache.rat.api.RatException; import org.apache.rat.document.DocumentName; -public interface IReportable { +public interface Reportable { /** * Adds the reportable to the RatReport. * @param report the report to add the results to. @@ -33,5 +33,5 @@ public interface IReportable { * Returns the DocumentName for the reportable. * @return the DocumentName for the reportable. */ - DocumentName getName(); + DocumentName name(); } diff --git a/apache-rat-core/src/main/java/org/apache/rat/walker/FileListWalker.java b/apache-rat-core/src/main/java/org/apache/rat/walker/FileListWalker.java index 05609085..eb62c0f2 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/walker/FileListWalker.java +++ b/apache-rat-core/src/main/java/org/apache/rat/walker/FileListWalker.java @@ -29,15 +29,15 @@ import org.apache.rat.config.exclusion.ExclusionUtils; import org.apache.rat.document.DocumentName; import org.apache.rat.document.DocumentNameMatcher; import org.apache.rat.document.FileDocument; -import org.apache.rat.report.IReportable; import org.apache.rat.report.RatReport; +import org.apache.rat.report.Reportable; import org.apache.rat.utils.DefaultLog; /** * Implementation of IReportable that traverses over a resource collection * internally. */ -public class FileListWalker implements IReportable { +public class FileListWalker implements Reportable { /** The source document name. */ private final FileDocument source; /** The root document name. */ @@ -72,7 +72,7 @@ public class FileListWalker implements IReportable { @Override public void run(final RatReport report) throws RatException { DefaultLog.getInstance().debug(String.format("Reading file name: %s due to option %s", source, Arg.SOURCE.option())); - DocumentName sourceName = getName(); + DocumentName sourceName = name(); try (Reader reader = source.reader()) { for (String docName : IOUtils.readLines(reader)) { try { @@ -93,7 +93,7 @@ public class FileListWalker implements IReportable { } @Override - public DocumentName getName() { + public DocumentName name() { return source.getName(); } } diff --git a/apache-rat-core/src/main/java/org/apache/rat/walker/IReportableListWalker.java b/apache-rat-core/src/main/java/org/apache/rat/walker/ReportableListWalker.java similarity index 85% rename from apache-rat-core/src/main/java/org/apache/rat/walker/IReportableListWalker.java rename to apache-rat-core/src/main/java/org/apache/rat/walker/ReportableListWalker.java index b028b9c6..b4afad47 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/walker/IReportableListWalker.java +++ b/apache-rat-core/src/main/java/org/apache/rat/walker/ReportableListWalker.java @@ -24,18 +24,18 @@ import java.util.Objects; import org.apache.rat.api.RatException; import org.apache.rat.document.DocumentName; -import org.apache.rat.report.IReportable; import org.apache.rat.report.RatReport; +import org.apache.rat.report.Reportable; import org.apache.rat.utils.DefaultLog; /** * A Reportable that walks a list of IReportables and executes the run on each. */ -public final class IReportableListWalker implements IReportable { +public final class ReportableListWalker implements Reportable { /** The document name for this walker. */ private final DocumentName documentName; /** The list of reportables for this walker. */ - private final List<IReportable> reportables; + private final List<Reportable> reportables; /** * Create a builder for the list walker. @@ -50,24 +50,24 @@ public final class IReportableListWalker implements IReportable { * Construct the builder. * @param builder for the reportable. */ - private IReportableListWalker(final Builder builder) { + private ReportableListWalker(final Builder builder) { this.documentName = builder.documentName; this.reportables = builder.reportables; } @Override public void run(final RatReport report) { - for (IReportable reportable : reportables) { + for (Reportable reportable : reportables) { try { reportable.run(report); } catch (RatException e) { - DefaultLog.getInstance().error("Error processing " + reportable.getName(), e); + DefaultLog.getInstance().error("Error processing " + reportable.name(), e); } } } @Override - public DocumentName getName() { + public DocumentName name() { return documentName; } @@ -78,7 +78,7 @@ public final class IReportableListWalker implements IReportable { /** The document name for the walker. */ private final DocumentName documentName; /** The list of IReportable objects to execute. */ - private List<IReportable> reportables = new ArrayList<>(); + private List<Reportable> reportables = new ArrayList<>(); /** * Constructs the builder. @@ -94,7 +94,7 @@ public final class IReportableListWalker implements IReportable { * @param reportable the reportable to run. * @return this. */ - public Builder addReportable(final IReportable reportable) { + public Builder addReportable(final Reportable reportable) { this.reportables.add(reportable); return this; } @@ -104,11 +104,11 @@ public final class IReportableListWalker implements IReportable { * @return the reportable. * @throws RatException on error. */ - public IReportable build() throws RatException { + public Reportable build() throws RatException { if (reportables == null) { throw new RatException("Builder may only be used once"); } - IReportable result = new IReportableListWalker(this); + Reportable result = new ReportableListWalker(this); this.reportables = null; return result; } diff --git a/apache-rat-core/src/main/java/org/apache/rat/walker/Walker.java b/apache-rat-core/src/main/java/org/apache/rat/walker/Walker.java index 5651f7ab..a6df1e25 100644 --- a/apache-rat-core/src/main/java/org/apache/rat/walker/Walker.java +++ b/apache-rat-core/src/main/java/org/apache/rat/walker/Walker.java @@ -21,12 +21,12 @@ package org.apache.rat.walker; import org.apache.rat.api.Document; import org.apache.rat.document.DocumentName; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; /** * Abstract walker. */ -public abstract class Walker implements IReportable { +public abstract class Walker implements Reportable { /** The document this walker is walking */ private final Document document; @@ -48,7 +48,7 @@ public abstract class Walker implements IReportable { } @Override - public DocumentName getName() { + public DocumentName name() { return document.getName(); } } diff --git a/apache-rat-core/src/test/java/org/apache/rat/OptionCollectionTest.java b/apache-rat-core/src/test/java/org/apache/rat/OptionCollectionTest.java index 238bc69c..070484f2 100644 --- a/apache-rat-core/src/test/java/org/apache/rat/OptionCollectionTest.java +++ b/apache-rat-core/src/test/java/org/apache/rat/OptionCollectionTest.java @@ -38,7 +38,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.rat.commandline.ArgumentContext; import org.apache.rat.document.DocumentName; import org.apache.rat.license.LicenseSetFactory; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; import org.apache.rat.test.AbstractConfigurationOptionsProvider; import org.apache.rat.test.utils.OptionFormatter; import org.apache.rat.testhelpers.TestingLog; @@ -233,9 +233,9 @@ public class OptionCollectionTest { DocumentName.FSInfo fsInfo = new DocumentName.FSInfo(testPath.getFileSystem()); String expected = fsInfo.normalize(base.getAbsolutePath()); ReportConfiguration config = OptionCollection.parseCommands(testPath.toFile(), new String[]{fName}, o -> fail("Help called"), false); - IReportable reportable = OptionCollection.getReportable(base, config); + Reportable reportable = OptionCollection.getReportable(base, config); assertThat(reportable).as(() -> format("'%s' returned null", fName)).isNotNull(); - assertThat(reportable.getName().getName()).isEqualTo(expected); + assertThat(reportable.name().getName()).isEqualTo(expected); } @Test @@ -250,7 +250,7 @@ public class OptionCollectionTest { reportConfiguration.addExcludedPatterns(List.of(dir2.getName())); assertThat(OptionCollection.getReportable(dir2, reportConfiguration)).isNull(); - IReportable reportable = OptionCollection.getReportable(dir1, new ReportConfiguration()); + Reportable reportable = OptionCollection.getReportable(dir1, new ReportConfiguration()); assertThat(reportable).isInstanceOf(DirectoryWalker.class); File file1 = new File(dir1, "file1"); diff --git a/apache-rat-core/src/test/java/org/apache/rat/ReportConfigurationTest.java b/apache-rat-core/src/test/java/org/apache/rat/ReportConfigurationTest.java index 69af88b2..df346d2e 100644 --- a/apache-rat-core/src/test/java/org/apache/rat/ReportConfigurationTest.java +++ b/apache-rat-core/src/test/java/org/apache/rat/ReportConfigurationTest.java @@ -51,7 +51,7 @@ import org.apache.rat.document.DocumentNameMatcher; import org.apache.rat.license.ILicense; import org.apache.rat.license.ILicenseFamily; import org.apache.rat.license.LicenseSetFactory.LicenseFilter; -import org.apache.rat.report.IReportable; +import org.apache.rat.report.Reportable; import org.apache.rat.testhelpers.TestingLog; import org.apache.rat.testhelpers.TestingLicense; import org.apache.rat.testhelpers.TestingMatcher; @@ -468,10 +468,10 @@ public class ReportConfigurationTest { @Test public void reportableTest() { assertThat(underTest.hasSource()).isFalse(); - IReportable reportable = mock(IReportable.class); + Reportable reportable = mock(Reportable.class); underTest.addSource(reportable); assertThat(underTest.hasSource()).isTrue(); - assertThatThrownBy(() -> underTest.addSource((IReportable)null)).isExactlyInstanceOf(ConfigurationException.class) + assertThatThrownBy(() -> underTest.addSource((Reportable)null)).isExactlyInstanceOf(ConfigurationException.class) .hasMessageContaining("Reportable may not be null."); } @@ -524,7 +524,7 @@ public class ReportConfigurationTest { sb.setLength(0); msg = "You must specify at least one license"; - underTest.addSource(mock(IReportable.class)); + underTest.addSource(mock(Reportable.class)); assertThatThrownBy(() -> underTest.validate(sb::append)).isExactlyInstanceOf(ConfigurationException.class) .hasMessageContaining(msg); diff --git a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/ResourceCollectionContainer.java b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/ResourceCollectionContainer.java index df911ad4..baab5e9a 100644 --- a/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/ResourceCollectionContainer.java +++ b/apache-rat-tasks/src/main/java/org/apache/rat/anttasks/ResourceCollectionContainer.java @@ -22,8 +22,8 @@ import org.apache.rat.ReportConfiguration; import org.apache.rat.api.RatException; import org.apache.rat.document.DocumentName; import org.apache.rat.document.FileDocument; -import org.apache.rat.report.IReportable; import org.apache.rat.report.RatReport; +import org.apache.rat.report.Reportable; import org.apache.tools.ant.types.Resource; import org.apache.tools.ant.types.ResourceCollection; import org.apache.tools.ant.types.resources.FileResource; @@ -32,7 +32,7 @@ import org.apache.tools.ant.types.resources.FileResource; * Implementation of IReportable that traverses over a resource collection * internally. */ -class ResourceCollectionContainer implements IReportable { +class ResourceCollectionContainer implements Reportable { /** The resources as collected by Ant */ private final ResourceCollection resources; /** The report configuration being used for the report */ @@ -59,7 +59,7 @@ class ResourceCollectionContainer implements IReportable { } @Override - public DocumentName getName() { + public DocumentName name() { return name; } }
