ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gin...@apache.org
Subject ant-ivy git commit: simplify set construction
Date Tue, 05 Dec 2017 11:27:31 GMT
Repository: ant-ivy
Updated Branches:
  refs/heads/master 2f4bf4db6 -> a12365084


simplify set construction

Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/a1236508
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/a1236508
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/a1236508

Branch: refs/heads/master
Commit: a1236508420e902ca672cac736788a19d49aba40
Parents: 2f4bf4d
Author: Gintas Grigelionis <gintas@apache.org>
Authored: Tue Dec 5 12:24:50 2017 +0100
Committer: Gintas Grigelionis <gintas@apache.org>
Committed: Tue Dec 5 12:24:50 2017 +0100

----------------------------------------------------------------------
 .../ivy/core/module/descriptor/DefaultDependencyDescriptor.java | 5 ++---
 src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java     | 4 ++--
 .../ivy/plugins/resolver/AbstractPatternsBasedResolver.java     | 3 +--
 test/java/org/apache/ivy/MainTest.java                          | 3 +--
 4 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a1236508/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
index 30677eb..66774ad 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptor.java
@@ -385,9 +385,8 @@ public class DefaultDependencyDescriptor implements DependencyDescriptor
{
 
     private Collection<String> getDependencyConfigurationsIncludingExtending(String
conf,
             String requestedConfiguration) {
-        Set<String> allDepConfs = new LinkedHashSet<>();
-        allDepConfs
-                .addAll(Arrays.asList(getDependencyConfigurations(conf, requestedConfiguration)));
+        Set<String> allDepConfs = new LinkedHashSet<>(Arrays.asList(getDependencyConfigurations(conf,
+                requestedConfiguration)));
 
         Collection<Configuration> extendingConfs = Configuration.findConfigurationExtending(conf,
             md.getConfigurations());

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a1236508/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
index fc0b6b8..9d6667b 100644
--- a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
+++ b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
@@ -433,10 +433,10 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
         remainingTokens.remove(IvyPatternHelper.ORGANISATION_KEY);
         String osgiType = stringCriteria.get(IvyPatternHelper.ORGANISATION_KEY);
         if (osgiType == null) {
-            Set<Map<String, String>> tokenValues = new HashSet<>();
             Map<String, Object> newCriteria = new HashMap<>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.BUNDLE_TYPE);
-            tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
+            Set<Map<String, String>> tokenValues = new HashSet<>(listTokenValues(remainingTokens,
+                    newCriteria));
             newCriteria = new HashMap<>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.PACKAGE_TYPE);
             tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a1236508/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java b/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
index cb0d606..0f0d1f1 100644
--- a/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
+++ b/src/java/org/apache/ivy/plugins/resolver/AbstractPatternsBasedResolver.java
@@ -120,8 +120,7 @@ public abstract class AbstractPatternsBasedResolver extends BasicResolver
{
 
     @Override
     protected Collection<String> findNames(Map<String, String> tokenValues, String
token) {
-        Collection<String> names = new HashSet<>();
-        names.addAll(findIvyNames(tokenValues, token));
+        Collection<String> names = new HashSet<>(findIvyNames(tokenValues, token));
         if (isAllownomd()) {
             names.addAll(findArtifactNames(tokenValues, token));
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a1236508/test/java/org/apache/ivy/MainTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/MainTest.java b/test/java/org/apache/ivy/MainTest.java
index 256906b..063f600 100644
--- a/test/java/org/apache/ivy/MainTest.java
+++ b/test/java/org/apache/ivy/MainTest.java
@@ -152,8 +152,7 @@ public class MainTest {
         final String[] parsedTypes = parsedCommand.getOptionValues("types");
         assertNotNull("Values for types argument is missing", parsedTypes);
         assertEquals("Unexpected number of values parsed for types argument", 2, parsedTypes.length);
-        final Set<String> uniqueParsedTypes = new HashSet<>();
-        uniqueParsedTypes.addAll(Arrays.asList(parsedTypes));
+        final Set<String> uniqueParsedTypes = new HashSet<>(Arrays.asList(parsedTypes));
         assertTrue("jar type is missing from the parsed types argument", uniqueParsedTypes.contains("jar"));
         assertTrue("jar type is missing from the parsed types argument", uniqueParsedTypes.contains("source"));
     }


Mime
View raw message