You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2019/01/30 01:00:52 UTC

[maven-invoker-plugin] branch master updated: some java7 sugar syntax

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-invoker-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 627fd3c  some java7 sugar syntax
627fd3c is described below

commit 627fd3cb7c3dca3720341ed1088dc00f138d5016
Author: olivier lamy <ol...@apache.org>
AuthorDate: Wed Jan 30 11:00:37 2019 +1000

    some java7 sugar syntax
    
    Signed-off-by: olivier lamy <ol...@apache.org>
---
 .../maven/plugins/invoker/AbstractInvokerMojo.java | 24 +++++++++++-----------
 .../apache/maven/plugins/invoker/InstallMojo.java  | 14 ++++++-------
 .../maven/plugins/invoker/InvokerReport.java       |  2 +-
 .../maven/plugins/invoker/InvokerSession.java      | 14 ++++++-------
 .../maven/plugins/invoker/SelectorUtils.java       |  8 ++++----
 5 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index 71e7e78..bf2f618 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -713,7 +713,7 @@ public abstract class AbstractInvokerMojo
 
         handleScriptRunnerWithScriptClassPath();
 
-        Collection<String> collectedProjects = new LinkedHashSet<String>();
+        Collection<String> collectedProjects = new LinkedHashSet<>();
         for ( BuildJob buildJob : buildJobs )
         {
             collectProjects( projectsDirectory, buildJob.getProject(), collectedProjects, true );
@@ -802,7 +802,7 @@ public abstract class AbstractInvokerMojo
 
     private BuildJob[] getNonSetupJobs( BuildJob[] buildJobs )
     {
-        List<BuildJob> result = new LinkedList<BuildJob>();
+        List<BuildJob> result = new LinkedList<>();
         for ( int i = 0; i < buildJobs.length; i++ )
         {
             if ( !buildJobs[i].getType().equals( BuildJob.Type.SETUP ) )
@@ -819,7 +819,7 @@ public abstract class AbstractInvokerMojo
         final List<String> scriptClassPath;
         if ( addTestClassPath )
         {
-            scriptClassPath = new ArrayList<String>( testClassPath );
+            scriptClassPath = new ArrayList<>( testClassPath );
             for ( Artifact pluginArtifact : pluginArtifacts )
             {
                 scriptClassPath.remove( pluginArtifact.getFile().getAbsolutePath() );
@@ -1041,7 +1041,7 @@ public abstract class AbstractInvokerMojo
         {
             filter = !cloneProjectsTo.getCanonicalFile().equals( projectsDirectory.getCanonicalFile() );
 
-            List<String> clonedSubpaths = new ArrayList<String>();
+            List<String> clonedSubpaths = new ArrayList<>();
 
             for ( String subpath : dirs )
             {
@@ -1891,7 +1891,7 @@ public abstract class AbstractInvokerMojo
 
         List<String> profiles = getProfiles( basedir );
 
-        Map<String, Object> context = new LinkedHashMap<String, Object>();
+        Map<String, Object> context = new LinkedHashMap<>();
 
         FileLogger logger = setupBuildLogFile( basedir );
         boolean selectorResult = true;
@@ -2256,7 +2256,7 @@ public abstract class AbstractInvokerMojo
         throws IOException
     {
         List<String> excludes =
-            ( pomExcludes != null ) ? new ArrayList<String>( pomExcludes ) : new ArrayList<String>();
+            ( pomExcludes != null ) ? new ArrayList<>( pomExcludes ) : new ArrayList<String>();
         if ( this.settingsFile != null )
         {
             String exclude = relativizePath( this.settingsFile, projectsDirectory.getCanonicalPath() );
@@ -2312,7 +2312,7 @@ public abstract class AbstractInvokerMojo
 
             BuildJob[] normalPoms = scanProjectsDirectory( pomIncludes, excludes, BuildJob.Type.NORMAL );
 
-            Map<String, BuildJob> uniquePoms = new LinkedHashMap<String, BuildJob>();
+            Map<String, BuildJob> uniquePoms = new LinkedHashMap<>();
             for ( BuildJob setupPom : setupPoms )
             {
                 uniquePoms.put( setupPom.getProject(), setupPom );
@@ -2330,8 +2330,8 @@ public abstract class AbstractInvokerMojo
         else
         {
             String[] testRegexes = StringUtils.split( invokerTest, "," );
-            List<String> includes = new ArrayList<String>( testRegexes.length );
-            List<String> excludes = new ArrayList<String>();
+            List<String> includes = new ArrayList<>( testRegexes.length );
+            List<String> excludes = new ArrayList<>();
 
             for ( String regex : testRegexes )
             {
@@ -2390,7 +2390,7 @@ public abstract class AbstractInvokerMojo
         scanner.addDefaultExcludes();
         scanner.scan();
 
-        Map<String, BuildJob> matches = new LinkedHashMap<String, BuildJob>();
+        Map<String, BuildJob> matches = new LinkedHashMap<>();
 
         for ( String includedFile : scanner.getIncludedFiles() )
         {
@@ -2569,7 +2569,7 @@ public abstract class AbstractInvokerMojo
     private List<String> readTokens( final File tokenFile )
         throws IOException
     {
-        List<String> result = new ArrayList<String>();
+        List<String> result = new ArrayList<>();
         
         Map<String, Object> composite = getInterpolationValueSource( false );
 
@@ -2593,7 +2593,7 @@ public abstract class AbstractInvokerMojo
      */
     private List<String> collectListFromCSV( final String csv )
     {
-        final List<String> result = new ArrayList<String>();
+        final List<String> result = new ArrayList<>();
 
         if ( ( csv != null ) && ( csv.trim().length() > 0 ) )
         {
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
index e00fa6b..3e89066 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
@@ -178,8 +178,8 @@ public class InstallMojo
 
         createTestRepository();
 
-        installedArtifacts = new HashSet<String>();
-        copiedArtifacts = new HashSet<String>();
+        installedArtifacts = new HashSet<>();
+        copiedArtifacts = new HashSet<>();
 
         installProjectDependencies( project, reactorProjects );
         installProjectParents( project );
@@ -332,7 +332,7 @@ public class InstallMojo
             }
 
             // Install any attached project artifacts
-            Collection<Artifact> attachedArtifacts = (Collection<Artifact>) mvnProject.getAttachedArtifacts();
+            Collection<Artifact> attachedArtifacts = mvnProject.getAttachedArtifacts();
             for ( Artifact attachedArtifact : attachedArtifacts )
             {
                 installArtifact( attachedArtifact.getFile(), attachedArtifact );
@@ -414,11 +414,11 @@ public class InstallMojo
         throws MojoExecutionException
     {
         // ... into dependencies that were resolved from reactor projects ...
-        Collection<String> dependencyProjects = new LinkedHashSet<String>();
+        Collection<String> dependencyProjects = new LinkedHashSet<>();
         collectAllProjectReferences( mvnProject, dependencyProjects );
 
         // index available reactor projects
-        Map<String, MavenProject> projects = new HashMap<String, MavenProject>( reactorProjects.size() );
+        Map<String, MavenProject> projects = new HashMap<>( reactorProjects.size() );
         for ( MavenProject reactorProject : reactorProjects )
         {
             String projectId =
@@ -428,9 +428,9 @@ public class InstallMojo
         }
 
         // group transitive dependencies (even those that don't contribute to the class path like POMs) ...
-        Collection<Artifact> artifacts = (Collection<Artifact>) mvnProject.getArtifacts();
+        Collection<Artifact> artifacts = mvnProject.getArtifacts();
         // ... and those that were resolved from the (local) repo
-        Collection<Artifact> dependencyArtifacts = new LinkedHashSet<Artifact>();
+        Collection<Artifact> dependencyArtifacts = new LinkedHashSet<>();
 
         for ( Artifact artifact : artifacts )
         {
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
index 35eb5b2..063ac64 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerReport.java
@@ -139,7 +139,7 @@ public class InvokerReport
 
         BuildJobXpp3Reader buildJobReader = new BuildJobXpp3Reader();
 
-        List<BuildJob> buildJobs = new ArrayList<BuildJob>( reportFiles.length );
+        List<BuildJob> buildJobs = new ArrayList<>( reportFiles.length );
         for ( File reportFile : reportFiles )
         {
             try ( XmlStreamReader xmlReader = ReaderFactory.newXmlReader( reportFile ) )
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
index 0cf9ee3..7c11479 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java
@@ -52,7 +52,7 @@ class InvokerSession
      */
     InvokerSession()
     {
-        buildJobs = new ArrayList<BuildJob>();
+        buildJobs = new ArrayList<>();
     }
 
     /**
@@ -62,7 +62,7 @@ class InvokerSession
      */
     InvokerSession( BuildJob[] buildJobs )
     {
-        this.buildJobs = new ArrayList<BuildJob>( Arrays.asList( buildJobs ) );
+        this.buildJobs = new ArrayList<>( Arrays.asList( buildJobs ) );
     }
 
     /**
@@ -84,7 +84,7 @@ class InvokerSession
      */
     public void setJobs( List<? extends BuildJob> buildJobs )
     {
-        this.buildJobs = new ArrayList<BuildJob>( buildJobs );
+        this.buildJobs = new ArrayList<>( buildJobs );
 
         resetStats();
     }
@@ -162,10 +162,10 @@ class InvokerSession
             return;
         }
 
-        successfulJobs = new ArrayList<BuildJob>();
-        failedJobs = new ArrayList<BuildJob>();
-        skippedJobs = new ArrayList<BuildJob>();
-        errorJobs = new ArrayList<BuildJob>();
+        successfulJobs = new ArrayList<>();
+        failedJobs = new ArrayList<>();
+        skippedJobs = new ArrayList<>();
+        errorJobs = new ArrayList<>();
 
         for ( BuildJob buildJob : buildJobs )
         {
diff --git a/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java b/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java
index fe89761..eeae0f7 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/SelectorUtils.java
@@ -66,8 +66,8 @@ class SelectorUtils
 
     static boolean isOsFamily( String osSpec )
     {
-        List<String> includes = new ArrayList<String>();
-        List<String> excludes = new ArrayList<String>();
+        List<String> includes = new ArrayList<>();
+        List<String> excludes = new ArrayList<>();
         parseList( osSpec, includes, excludes );
 
         return isOsFamily( includes, true ) && !isOsFamily( excludes, false );
@@ -165,8 +165,8 @@ class SelectorUtils
 
     static boolean isMavenVersion( String mavenSpec, String actualVersion )
     {
-        List<String> includes = new ArrayList<String>();
-        List<String> excludes = new ArrayList<String>();
+        List<String> includes = new ArrayList<>();
+        List<String> excludes = new ArrayList<>();
         parseList( mavenSpec, includes, excludes );
 
         List<Integer> mavenVersionList = parseVersion( actualVersion );