You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2021/10/03 12:49:05 UTC

[maven-resolver-ant-tasks] branch MRESOLVER-215 created (now 57b9af8)

This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a change to branch MRESOLVER-215
in repository https://gitbox.apache.org/repos/asf/maven-resolver-ant-tasks.git.


      at 57b9af8  [MRESOLVER-215] - java7 improvement:

This branch includes the following new commits:

     new 57b9af8  [MRESOLVER-215] - java7 improvement:

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-resolver-ant-tasks] 01/01: [MRESOLVER-215] - java7 improvement:

Posted by kh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

khmarbaise pushed a commit to branch MRESOLVER-215
in repository https://gitbox.apache.org/repos/asf/maven-resolver-ant-tasks.git

commit 57b9af86be9b28f58b6d80d91d8dafef5dc68025
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Oct 3 14:25:12 2021 +0200

    [MRESOLVER-215] - java7 improvement:
    
     * Replace type arguments with diamond type <>.
     * Compare object with Objects.equals().
---
 .../maven/resolver/internal/ant/AntRepoSys.java    | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/maven/resolver/internal/ant/AntRepoSys.java b/src/main/java/org/apache/maven/resolver/internal/ant/AntRepoSys.java
index 61dafe3..51ed961 100644
--- a/src/main/java/org/apache/maven/resolver/internal/ant/AntRepoSys.java
+++ b/src/main/java/org/apache/maven/resolver/internal/ant/AntRepoSys.java
@@ -33,6 +33,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Properties;
 import java.util.concurrent.CopyOnWriteArrayList;
 
@@ -136,11 +137,11 @@ public class AntRepoSys
 
     private Settings settings;
 
-    private final List<Mirror> mirrors = new CopyOnWriteArrayList<Mirror>();
+    private final List<Mirror> mirrors = new CopyOnWriteArrayList<>();
 
-    private final List<Proxy> proxies = new CopyOnWriteArrayList<Proxy>();
+    private final List<Proxy> proxies = new CopyOnWriteArrayList<>();
 
-    private final List<Authentication> authentications = new CopyOnWriteArrayList<Authentication>();
+    private final List<Authentication> authentications = new CopyOnWriteArrayList<>();
 
     private LocalRepository localRepository;
 
@@ -148,7 +149,7 @@ public class AntRepoSys
 
     private static <T> boolean eq( T o1, T o2 )
     {
-        return ( o1 == null ) ? o2 == null : o1.equals( o2 );
+        return Objects.equals( o1, o2 );
     }
 
     public static synchronized AntRepoSys getInstance( Project project )
@@ -226,7 +227,7 @@ public class AntRepoSys
     {
         DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
 
-        Map<Object, Object> configProps = new LinkedHashMap<Object, Object>();
+        Map<Object, Object> configProps = new LinkedHashMap<>();
         configProps.put( ConfigurationProperties.USER_AGENT, getUserAgent() );
         configProps.putAll( (Map<?, ?>) project.getProperties() );
         processServerConfiguration( configProps );
@@ -308,7 +309,7 @@ public class AntRepoSys
 
     private Map<String, String> getHttpHeaders( Xpp3Dom dom )
     {
-        Map<String, String> headers = new HashMap<String, String>();
+        Map<String, String> headers = new HashMap<>();
         for ( int i = 0; i < dom.getChildCount(); i++ )
         {
             Xpp3Dom child = dom.getChild( i );
@@ -434,7 +435,7 @@ public class AntRepoSys
     {
         DefaultAuthenticationSelector selector = new DefaultAuthenticationSelector();
 
-        Collection<String> ids = new HashSet<String>();
+        Collection<String> ids = new HashSet<>();
         for ( Authentication auth : authentications )
         {
             List<String> servers = auth.getServers();
@@ -730,11 +731,11 @@ public class AntRepoSys
         List<Exclusion> globalExclusions = exclusions;
         if ( !dependencies.getExclusions().isEmpty() )
         {
-            globalExclusions = new ArrayList<Exclusion>( exclusions );
+            globalExclusions = new ArrayList<>( exclusions );
             globalExclusions.addAll( dependencies.getExclusions() );
         }
 
-        Collection<String> ids = new HashSet<String>();
+        Collection<String> ids = new HashSet<>();
 
         for ( DependencyContainer container : dependencies.getDependencyContainers() )
         {
@@ -803,7 +804,7 @@ public class AntRepoSys
 
     private List<Dependency> readDependencies( File file )
     {
-        List<Dependency> dependencies = new ArrayList<Dependency>();
+        List<Dependency> dependencies = new ArrayList<>();
         try
         {
             try ( BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream( file ), "UTF-8" ) ) )
@@ -877,7 +878,7 @@ public class AntRepoSys
         Model model = pom.getModel( task );
         File pomFile = pom.getFile();
 
-        List<org.eclipse.aether.artifact.Artifact> results = new ArrayList<org.eclipse.aether.artifact.Artifact>();
+        List<org.eclipse.aether.artifact.Artifact> results = new ArrayList<>();
 
         org.eclipse.aether.artifact.Artifact pomArtifact =
             new DefaultArtifact( model.getGroupId(), model.getArtifactId(), "pom", model.getVersion() ).setFile( pomFile );