maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [maven-assembly-plugin] branch master updated: Use zero sized arrays in calls to toArray()
Date Fri, 11 Dec 2020 05:58:24 GMT
This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 29937d8  Use zero sized arrays in calls to toArray()
     new 9cbdbc4  Merge pull request #38 from gnodet/speed
29937d8 is described below

commit 29937d80c09111f9421c1614b3049059c3a45e3e
Author: Guillaume Nodet <gnodet@gmail.com>
AuthorDate: Wed Nov 18 20:55:12 2020 +0100

    Use zero sized arrays in calls to toArray()
---
 .../plugins/assembly/archive/archiver/AssemblyProxyArchiver.java    | 6 +++---
 .../maven/plugins/assembly/artifact/DefaultDependencyResolver.java  | 2 +-
 .../apache/maven/plugins/assembly/utils/TypeConversionUtils.java    | 2 +-
 .../apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
index e4501ab..2b0cd06 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/archive/archiver/AssemblyProxyArchiver.java
@@ -132,7 +132,7 @@ public class AssemblyProxyArchiver
 
         if ( !selectors.isEmpty() )
         {
-            this.selectors = selectors.toArray( new FileSelector[selectors.size()] );
+            this.selectors = selectors.toArray( new FileSelector[0] );
         }
     }
 
@@ -763,9 +763,9 @@ public class AssemblyProxyArchiver
 
             dfs.setCaseSensitive( fs.isCaseSensitive() );
             dfs.setDirectory( fs.getDirectory() );
-            dfs.setExcludes( newEx.toArray( new String[newEx.size()] ) );
+            dfs.setExcludes( newEx.toArray( new String[0] ) );
             dfs.setFileSelectors( fs.getFileSelectors() );
-            dfs.setIncludes( newIn.toArray( new String[newIn.size()] ) );
+            dfs.setIncludes( newIn.toArray( new String[0] ) );
             dfs.setIncludingEmptyDirectories( fs.isIncludingEmptyDirectories() );
             dfs.setPrefix( fs.getPrefix() );
             dfs.setStreamTransformer( fs.getStreamTransformer() );
diff --git a/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java
b/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java
index d6a833d..b4ef76f 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/artifact/DefaultDependencyResolver.java
@@ -129,7 +129,7 @@ public class DefaultDependencyResolver
             if ( binaries.isIncludeDependencies() )
             {
                 updateDependencySetResolutionRequirements( dependencySet, requirements,
-                                                           projects.toArray( new MavenProject[projects.size()]
) );
+                                                           projects.toArray( new MavenProject[0]
) );
             }
         }
     }
diff --git a/src/main/java/org/apache/maven/plugins/assembly/utils/TypeConversionUtils.java
b/src/main/java/org/apache/maven/plugins/assembly/utils/TypeConversionUtils.java
index a73a0b2..6565a9d 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/utils/TypeConversionUtils.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/utils/TypeConversionUtils.java
@@ -58,7 +58,7 @@ public final class TypeConversionUtils
 
         if ( ( list != null ) && !list.isEmpty() )
         {
-            result = list.toArray( new String[list.size()] );
+            result = list.toArray( new String[0] );
         }
 
         return result;
diff --git a/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
b/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
index 4792b7a..137c6f1 100644
--- a/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
+++ b/src/test/java/org/apache/maven/plugins/assembly/io/DefaultAssemblyReaderTest.java
@@ -692,7 +692,7 @@ public class DefaultAssemblyReaderTest
         final List<String> files = writeAssembliesToFile( assemblies, basedir );
 
         final List<Assembly> results =
-            performReadAssemblies( basedir, files.toArray( new String[files.size()] ), null,
null );
+            performReadAssemblies( basedir, files.toArray( new String[0] ), null, null );
 
         assertNotNull( results );
         assertEquals( 2, results.size() );


Mime
View raw message