You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2018/12/27 16:55:48 UTC
[maven-javadoc-plugin] 05/08: Start switching from String to Path
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch refactor
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit adf8a5872441ed4675d6907e84b0ca0025e989c1
Author: rfscholte <rf...@apache.org>
AuthorDate: Thu Dec 27 12:23:40 2018 +0100
Start switching from String to Path
---
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 26 +++++++++++-----------
.../maven/plugins/javadoc/JavadocReport.java | 3 ++-
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index e181f4a..2253375 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -1993,7 +1993,7 @@ public abstract class AbstractJavadocMojo
Collection<String> collectedSourcePaths = collect( sourcePaths.values() );
- Map<String, Collection<String>> files = getFiles( collectedSourcePaths );
+ Map<Path, Collection<String>> files = getFiles( collectedSourcePaths );
if ( !canGenerateReport( files ) )
{
return;
@@ -2223,10 +2223,10 @@ public abstract class AbstractJavadocMojo
* @return a List that contains the specific path for every source file
* @throws MavenReportException {@link MavenReportException}
*/
- protected Map<String, Collection<String>> getFiles( Collection<String> sourcePaths )
+ protected Map<Path, Collection<String>> getFiles( Collection<String> sourcePaths )
throws MavenReportException
{
- Map<String, Collection<String>> mappedFiles = new LinkedHashMap<>( sourcePaths.size() );
+ Map<Path, Collection<String>> mappedFiles = new LinkedHashMap<>( sourcePaths.size() );
if ( StringUtils.isEmpty( subpackages ) )
{
Collection<String> excludedPackages = getExcludedPackages();
@@ -2237,7 +2237,7 @@ public abstract class AbstractJavadocMojo
File sourceDirectory = new File( sourcePath );
files.addAll( JavadocUtil.getFilesFromSource( sourceDirectory, sourceFileIncludes, sourceFileExcludes,
excludedPackages ) );
- mappedFiles.put( sourcePath, files );
+ mappedFiles.put( Paths.get( sourcePath ), files );
}
}
@@ -2512,7 +2512,7 @@ public abstract class AbstractJavadocMojo
* @param files the project files
* @return a boolean that indicates whether javadoc report can be generated or not
*/
- protected boolean canGenerateReport( Map<String, Collection<String>> files )
+ protected boolean canGenerateReport( Map<Path, Collection<String>> files )
{
for ( Collection<String> filesValues : files.values() )
{
@@ -4356,7 +4356,7 @@ public abstract class AbstractJavadocMojo
* @param files not null
* @return the list of package names for files in the sourcePaths
*/
- private List<String> getPackageNames( Map<String, Collection<String>> sourcePaths )
+ private List<String> getPackageNames( Map<Path, Collection<String>> sourcePaths )
{
List<String> returnList = new ArrayList<>();
@@ -4365,9 +4365,9 @@ public abstract class AbstractJavadocMojo
return returnList;
}
- for ( Entry<String, Collection<String>> currentPathEntry : sourcePaths.entrySet() )
+ for ( Entry<Path, Collection<String>> currentPathEntry : sourcePaths.entrySet() )
{
- String currentSourcePath = currentPathEntry.getKey().replace( '\\', '/' );
+ String currentSourcePath = currentPathEntry.getKey().toString().replace( '\\', '/' );
for ( String currentFile : currentPathEntry.getValue() )
{
@@ -4458,9 +4458,9 @@ public abstract class AbstractJavadocMojo
exportAllPackages = true;
}
- for ( Map.Entry<String, Collection<String>> currentPathEntry : getFiles( artifactSourcePaths ).entrySet() )
+ for ( Map.Entry<Path, Collection<String>> currentPathEntry : getFiles( artifactSourcePaths ).entrySet() )
{
- String currentSourcePath = currentPathEntry.getKey().replace( '\\', '/' );
+ String currentSourcePath = currentPathEntry.getKey().toString().replace( '\\', '/' );
for ( String currentFile : currentPathEntry.getValue() )
{
@@ -4503,7 +4503,7 @@ public abstract class AbstractJavadocMojo
* @param files not null
* @return a list files with unnamed package names for files in the sourcePaths
*/
- private List<String> getFilesWithUnnamedPackages( Map<String, Collection<String>> sourcePaths )
+ private List<String> getFilesWithUnnamedPackages( Map<Path, Collection<String>> sourcePaths )
{
List<String> returnList = new ArrayList<>();
@@ -4512,9 +4512,9 @@ public abstract class AbstractJavadocMojo
return returnList;
}
- for ( Entry<String, Collection<String>> currentPathEntry : sourcePaths.entrySet() )
+ for ( Entry<Path, Collection<String>> currentPathEntry : sourcePaths.entrySet() )
{
- String currentSourcePath = currentPathEntry.getKey().replace( '\\', '/' );
+ String currentSourcePath = currentPathEntry.getKey().toString().replace( '\\', '/' );
for ( String currentFile : currentPathEntry.getValue() )
{
diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
index e31cc40..f147a31 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocReport.java
@@ -20,6 +20,7 @@ package org.apache.maven.plugins.javadoc;
*/
import java.io.File;
+import java.nio.file.Path;
import java.util.Collection;
import java.util.Locale;
import java.util.Map;
@@ -229,7 +230,7 @@ public class JavadocReport
if ( this.isAggregator() || !"pom".equals( this.project.getPackaging() ) )
{
Collection<String> sourcePaths;
- Map<String, Collection<String>> files;
+ Map<Path, Collection<String>> files;
try
{
sourcePaths = collect( getSourcePaths().values() );