ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaiki...@apache.org
Subject [1/4] ant-ivy git commit: Generics and Java 7 syntax in osgi package
Date Sat, 01 Jul 2017 14:49:36 GMT
Repository: ant-ivy
Updated Branches:
  refs/heads/master 7e764a320 -> d9665bfc1


Generics and Java 7 syntax in osgi package

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

Branch: refs/heads/master
Commit: 0c0ee3551826c822646c8076ac138c97d8db3071
Parents: 7e764a3
Author: twogee <g.grigelionis@gmail.com>
Authored: Thu Jun 29 13:43:23 2017 +0200
Committer: Jaikiran Pai <jaikiran@apache.org>
Committed: Sat Jul 1 20:14:59 2017 +0530

----------------------------------------------------------------------
 .../org/apache/ivy/osgi/core/BundleInfo.java    | 18 +++----
 .../apache/ivy/osgi/core/BundleInfoAdapter.java | 15 +++---
 .../osgi/core/ExecutionEnvironmentProfile.java  |  2 +-
 .../ExecutionEnvironmentProfileProvider.java    | 12 ++---
 .../org/apache/ivy/osgi/core/ExportPackage.java |  2 +-
 .../ivy/osgi/core/ManifestHeaderElement.java    |  6 +--
 .../ivy/osgi/core/ManifestHeaderValue.java      |  4 +-
 .../apache/ivy/osgi/core/ManifestParser.java    | 28 +++++------
 .../apache/ivy/osgi/filter/CompareFilter.java   |  4 +-
 .../ivy/osgi/filter/MultiOperatorFilter.java    |  5 +-
 .../ivy/osgi/filter/OSGiFilterParser.java       |  2 +-
 .../org/apache/ivy/osgi/obr/OBRResolver.java    |  2 +-
 .../org/apache/ivy/osgi/obr/xml/Capability.java |  2 +-
 .../ivy/osgi/obr/xml/CapabilityAdapter.java     |  6 +--
 .../apache/ivy/osgi/obr/xml/OBRXMLWriter.java   | 53 +++++++++++---------
 .../apache/ivy/osgi/p2/P2ArtifactParser.java    | 11 ++--
 .../apache/ivy/osgi/p2/P2CompositeParser.java   |  4 +-
 .../org/apache/ivy/osgi/p2/P2Descriptor.java    |  8 +--
 .../apache/ivy/osgi/p2/P2MetadataParser.java    | 10 ++--
 .../apache/ivy/osgi/p2/PropertiesParser.java    |  2 +-
 .../org/apache/ivy/osgi/p2/XMLInputParser.java  |  2 +-
 .../osgi/repo/AbstractFSManifestIterable.java   |  2 +-
 .../ivy/osgi/repo/AbstractOSGiResolver.java     | 44 ++++++++--------
 .../ivy/osgi/repo/AggregatedOSGiResolver.java   |  4 +-
 .../ivy/osgi/repo/AggregatedRepoDescriptor.java |  6 +--
 .../repo/ArtifactReportManifestIterable.java    |  4 +-
 .../ivy/osgi/repo/EditableRepoDescriptor.java   |  8 +--
 .../ivy/osgi/repo/FSManifestIterable.java       |  4 +-
 .../ivy/osgi/repo/ModuleDescriptorWrapper.java  |  4 +-
 .../ivy/osgi/repo/RelativeURLRepository.java    |  2 +-
 .../ivy/osgi/updatesite/UpdateSiteLoader.java   | 15 ++----
 .../ivy/osgi/updatesite/UpdateSiteResolver.java |  2 +-
 .../ivy/osgi/updatesite/xml/EclipseFeature.java |  4 +-
 .../ivy/osgi/updatesite/xml/FeatureParser.java  |  2 +-
 .../ivy/osgi/updatesite/xml/UpdateSite.java     |  2 +-
 .../apache/ivy/osgi/util/DelegatingHandler.java | 10 ++--
 .../org/apache/ivy/osgi/util/ParseUtil.java     |  4 +-
 .../org/apache/ivy/osgi/util/VersionRange.java  | 16 +++---
 src/java/org/apache/ivy/osgi/util/ZipUtil.java  |  5 +-
 39 files changed, 161 insertions(+), 175 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/BundleInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleInfo.java b/src/java/org/apache/ivy/osgi/core/BundleInfo.java
index 2d078bc..661848c 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleInfo.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleInfo.java
@@ -48,11 +48,11 @@ public class BundleInfo {
 
     private Version version;
 
-    private Set<BundleRequirement> requirements = new LinkedHashSet<BundleRequirement>();
+    private Set<BundleRequirement> requirements = new LinkedHashSet<>();
 
-    private Set<BundleCapability> capabilities = new LinkedHashSet<BundleCapability>();
+    private Set<BundleCapability> capabilities = new LinkedHashSet<>();
 
-    private List<String> executionEnvironments = new ArrayList<String>();
+    private List<String> executionEnvironments = new ArrayList<>();
 
     private String description;
 
@@ -74,7 +74,7 @@ public class BundleInfo {
 
     private List<String> classpath;
 
-    private List<BundleArtifact> artifacts = new ArrayList<BundleArtifact>();
+    private List<BundleArtifact> artifacts = new ArrayList<>();
 
     public BundleInfo(String name, Version version) {
         this.symbolicName = name;
@@ -82,7 +82,7 @@ public class BundleInfo {
     }
 
     public String toString() {
-        StringBuffer builder = new StringBuffer();
+        StringBuilder builder = new StringBuilder();
         builder.append("BundleInfo [executionEnvironments=");
         builder.append(executionEnvironments);
         builder.append(", capabilities=");
@@ -339,7 +339,7 @@ public class BundleInfo {
     }
 
     public Set<BundleRequirement> getRequires() {
-        Set<BundleRequirement> set = new LinkedHashSet<BundleRequirement>();
+        Set<BundleRequirement> set = new LinkedHashSet<>();
         for (BundleRequirement requirement : requirements) {
             if (requirement.getType().equals(BUNDLE_TYPE)) {
                 set.add(requirement);
@@ -349,7 +349,7 @@ public class BundleInfo {
     }
 
     public Set<BundleRequirement> getImports() {
-        Set<BundleRequirement> set = new LinkedHashSet<BundleRequirement>();
+        Set<BundleRequirement> set = new LinkedHashSet<>();
         for (BundleRequirement requirement : requirements) {
             if (requirement.getType().equals(PACKAGE_TYPE)) {
                 set.add(requirement);
@@ -359,7 +359,7 @@ public class BundleInfo {
     }
 
     public Set<ExportPackage> getExports() {
-        Set<ExportPackage> set = new LinkedHashSet<ExportPackage>();
+        Set<ExportPackage> set = new LinkedHashSet<>();
         for (BundleCapability capability : capabilities) {
             if (PACKAGE_TYPE.equals(capability.getType())) {
                 set.add((ExportPackage) capability);
@@ -369,7 +369,7 @@ public class BundleInfo {
     }
 
     public Set<BundleCapability> getServices() {
-        Set<BundleCapability> set = new LinkedHashSet<BundleCapability>();
+        Set<BundleCapability> set = new LinkedHashSet<>();
         for (BundleCapability capability : capabilities) {
             if (SERVICE_TYPE.equals(capability.getType())) {
                 set.add(capability);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java b/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
index 2545de1..79c2ad9 100644
--- a/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
+++ b/src/java/org/apache/ivy/osgi/core/BundleInfoAdapter.java
@@ -100,7 +100,7 @@ public class BundleInfoAdapter {
         md.addConfiguration(CONF_OPTIONAL);
         md.addConfiguration(CONF_TRANSITIVE_OPTIONAL);
 
-        Set<String> exportedPkgNames = new HashSet<String>(bundle.getExports().size());
+        Set<String> exportedPkgNames = new HashSet<>(bundle.getExports().size());
         for (ExportPackage exportPackage : bundle.getExports()) {
             md.getExtraInfos().add(
                 new ExtraInfoHolder(EXTRA_INFO_EXPORT_PREFIX + exportPackage.getName(),
@@ -161,8 +161,8 @@ public class BundleInfoAdapter {
                     DefaultExcludeRule rule = new DefaultExcludeRule(id,
                             ExactOrRegexpPatternMatcher.INSTANCE, null);
                     String[] confs = md.getConfigurationsNames();
-                    for (int i = 0; i < confs.length; i++) {
-                        rule.addConfiguration(confs[i]);
+                    for (String conf : confs) {
+                        rule.addConfiguration(conf);
                     }
                     md.addExcludeRule(rule);
                 }
@@ -188,7 +188,7 @@ public class BundleInfoAdapter {
             if (!uri.isAbsolute()) {
                 uri = baseUri.resolve(uri);
             }
-            Map<String, String> extraAtt = new HashMap<String, String>();
+            Map<String, String> extraAtt = new HashMap<>();
             if (packaging != null) {
                 extraAtt.put("packaging", packaging);
             }
@@ -203,7 +203,7 @@ public class BundleInfoAdapter {
     }
 
     public static List<String> getConfigurations(BundleInfo bundle) {
-        List<String> confs = new ArrayList<String>();
+        List<String> confs = new ArrayList<>();
         confs.add(CONF_NAME_DEFAULT);
         confs.add(CONF_NAME_OPTIONAL);
         confs.add(CONF_NAME_TRANSITIVE_OPTIONAL);
@@ -223,7 +223,7 @@ public class BundleInfoAdapter {
 
     private static URI asIvyURI(String org, String name, String branch, String rev, String type,
             String art, String ext) {
-        StringBuffer builder = new StringBuffer();
+        StringBuilder builder = new StringBuilder();
         builder.append("ivy:///");
         builder.append(org);
         builder.append('/');
@@ -279,8 +279,7 @@ public class BundleInfoAdapter {
 
         String query = uri.getQuery();
         String[] parameters = query.split("&");
-        for (int j = 0; j < parameters.length; j++) {
-            String parameter = parameters[j];
+        for (String parameter : parameters) {
             if (parameter.length() == 0) {
                 continue;
             }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
index 8c079bb..e072285 100644
--- a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
+++ b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfile.java
@@ -22,7 +22,7 @@ import java.util.TreeSet;
 
 public class ExecutionEnvironmentProfile {
 
-    Set<String> pkgNames = new TreeSet<String>();
+    Set<String> pkgNames = new TreeSet<>();
 
     private final String name;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfileProvider.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfileProvider.java b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfileProvider.java
index 45f3bc1..d3d4ea5 100644
--- a/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfileProvider.java
+++ b/src/java/org/apache/ivy/osgi/core/ExecutionEnvironmentProfileProvider.java
@@ -72,7 +72,7 @@ public class ExecutionEnvironmentProfileProvider {
         } finally {
             defaultProfilesFile.close();
         }
-        Map<String, ExecutionEnvironmentProfile> profiles = new HashMap<String, ExecutionEnvironmentProfile>();
+        Map<String, ExecutionEnvironmentProfile> profiles = new HashMap<>();
         for (Entry<Object, Object> prop : props.entrySet()) {
             String propName = (String) prop.getKey();
             if (propName.endsWith(".pkglist")) {
@@ -103,9 +103,8 @@ public class ExecutionEnvironmentProfileProvider {
 
         // load the actual list
         String pkgList = props.getProperty(name + ".pkglist");
-        String[] packages = pkgList.split(",");
-        for (int i = 0; i < packages.length; i++) {
-            String pkg = packages[i].trim();
+        for (String pack : pkgList.split(",")) {
+            String pkg = pack.trim();
             if (pkg.length() != 0) {
                 profile.pkgNames.add(pkg);
             }
@@ -115,9 +114,8 @@ public class ExecutionEnvironmentProfileProvider {
 
         String aliasList = props.getProperty(name + ".aliases");
         if (aliasList != null) {
-            String[] aliases = aliasList.split(",");
-            for (int i = 0; i < aliases.length; i++) {
-                String alias = aliases[i].trim();
+            for (String aka : aliasList.split(",")) {
+                String alias = aka.trim();
                 if (alias.length() != 0) {
                     ExecutionEnvironmentProfile profileAlias = new ExecutionEnvironmentProfile(
                             alias);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ExportPackage.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ExportPackage.java b/src/java/org/apache/ivy/osgi/core/ExportPackage.java
index 25e0334..19b9beb 100644
--- a/src/java/org/apache/ivy/osgi/core/ExportPackage.java
+++ b/src/java/org/apache/ivy/osgi/core/ExportPackage.java
@@ -24,7 +24,7 @@ import org.apache.ivy.osgi.util.Version;
 
 public class ExportPackage extends BundleCapability {
 
-    private final Set<String> uses = new HashSet<String>();
+    private final Set<String> uses = new HashSet<>();
 
     public ExportPackage(String name, Version version) {
         super(BundleInfo.PACKAGE_TYPE, name, version);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ManifestHeaderElement.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ManifestHeaderElement.java b/src/java/org/apache/ivy/osgi/core/ManifestHeaderElement.java
index 7aa2176..96f884f 100644
--- a/src/java/org/apache/ivy/osgi/core/ManifestHeaderElement.java
+++ b/src/java/org/apache/ivy/osgi/core/ManifestHeaderElement.java
@@ -25,11 +25,11 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 public class ManifestHeaderElement {
-    private List<String> values = new ArrayList<String>();
+    private List<String> values = new ArrayList<>();
 
-    private Map<String, String> attributes = new HashMap<String, String>();
+    private Map<String, String> attributes = new HashMap<>();
 
-    private Map<String, String> directives = new HashMap<String, String>();
+    private Map<String, String> directives = new HashMap<>();
 
     public List<String> getValues() {
         return values;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java b/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
index 1b64b7c..08af4c6 100644
--- a/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
+++ b/src/java/org/apache/ivy/osgi/core/ManifestHeaderValue.java
@@ -40,7 +40,7 @@ import java.util.List;
  */
 public class ManifestHeaderValue {
 
-    private List<ManifestHeaderElement> elements = new ArrayList<ManifestHeaderElement>();
+    private List<ManifestHeaderElement> elements = new ArrayList<>();
 
     ManifestHeaderValue() {
         // just for unit testing
@@ -71,7 +71,7 @@ public class ManifestHeaderValue {
         if (elements.isEmpty()) {
             return Collections.emptyList();
         }
-        List<String> list = new ArrayList<String>();
+        List<String> list = new ArrayList<>();
         for (ManifestHeaderElement element : getElements()) {
             list.addAll(element.getValues());
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/core/ManifestParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/core/ManifestParser.java b/src/java/org/apache/ivy/osgi/core/ManifestParser.java
index 90685b1..4806f33 100644
--- a/src/java/org/apache/ivy/osgi/core/ManifestParser.java
+++ b/src/java/org/apache/ivy/osgi/core/ManifestParser.java
@@ -106,8 +106,7 @@ public class ManifestParser {
 
     public static BundleInfo parseManifest(InputStream manifestStream) throws IOException,
             ParseException {
-        BundleInfo parseManifest = parseManifest(new Manifest(manifestStream));
-        return parseManifest;
+        return parseManifest(new Manifest(manifestStream));
     }
 
     public static BundleInfo parseManifest(Manifest manifest) throws ParseException {
@@ -174,9 +173,8 @@ public class ManifestParser {
                 ExportPackage export = new ExportPackage(name, v);
                 String uses = exportElement.getDirectives().get(ATTR_USE);
                 if (uses != null) {
-                    String[] split = uses.trim().split(",");
-                    for (int i = 0; i < split.length; i++) {
-                        export.addUse(split[i].trim());
+                    for (String use : uses.split(",")) {
+                        export.addUse(use.trim());
                     }
                 }
                 bundleInfo.addCapability(export);
@@ -274,24 +272,24 @@ public class ManifestParser {
      * @return String
      */
     public static String formatLines(String manifest) {
-        StringBuffer buffer = new StringBuffer(manifest.length());
+        StringBuilder buffer = new StringBuilder(manifest.length());
         String[] lines = manifest.split("\n");
-        for (int i = 0; i < lines.length; i++) {
-            if (lines[i].length() <= 72) {
-                buffer.append(lines[i]);
+        for (String line : lines) {
+            if (line.length() <= 72) {
+                buffer.append(line);
                 buffer.append('\n');
             } else {
-                buffer.append(lines[i].substring(0, 72));
+                buffer.append(line.substring(0, 72));
                 buffer.append("\n ");
                 int n = 72;
-                while (n <= lines[i].length() - 1) {
+                while (n <= line.length() - 1) {
                     int end = n + 71;
-                    if (end > lines[i].length()) {
-                        end = lines[i].length();
+                    if (end > line.length()) {
+                        end = line.length();
                     }
-                    buffer.append(lines[i].substring(n, end));
+                    buffer.append(line.substring(n, end));
                     buffer.append('\n');
-                    if (end != lines[i].length()) {
+                    if (end != line.length()) {
                         buffer.append(' ');
                     }
                     n = end;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/CompareFilter.java b/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
index 13f33e3..d3b43ca 100644
--- a/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
+++ b/src/java/org/apache/ivy/osgi/filter/CompareFilter.java
@@ -21,14 +21,14 @@ import java.util.Map;
 
 public class CompareFilter extends OSGiFilter {
 
-    public static enum Operator {
+    public enum Operator {
 
         EQUALS("="), LOWER_THAN("<"), LOWER_OR_EQUAL("<="), GREATER_THAN(">"), GREATER_OR_EQUAL(
                 ">="), APPROX("~="), PRESENT("=*");
 
         private String op;
 
-        private Operator(String op) {
+        Operator(String op) {
             this.op = op;
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java b/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
index 309b0ad..8961657 100644
--- a/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
+++ b/src/java/org/apache/ivy/osgi/filter/MultiOperatorFilter.java
@@ -22,15 +22,14 @@ import java.util.List;
 
 public abstract class MultiOperatorFilter extends OSGiFilter {
 
-    private List<OSGiFilter> subFilters = new ArrayList<OSGiFilter>();
+    private List<OSGiFilter> subFilters = new ArrayList<>();
 
     public MultiOperatorFilter() {
         // default constructor
     }
 
     public MultiOperatorFilter(OSGiFilter[] filters) {
-        for (int i = 0; i < filters.length; i++) {
-            OSGiFilter filter = filters[i];
+        for (OSGiFilter filter : filters) {
             add(filter);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java b/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
index 3be59d9..5221752 100644
--- a/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
+++ b/src/java/org/apache/ivy/osgi/filter/OSGiFilterParser.java
@@ -128,7 +128,7 @@ public class OSGiFilterParser {
         }
 
         private String parseCompareValue() {
-            StringBuffer builder = new StringBuffer();
+            StringBuilder builder = new StringBuilder();
             do {
                 readNext();
                 if (!isOperator(c) && c != ')' && c != '(') {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/obr/OBRResolver.java b/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
index 162fd42..c1e3bb5 100644
--- a/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
+++ b/src/java/org/apache/ivy/osgi/obr/OBRResolver.java
@@ -88,7 +88,7 @@ public class OBRResolver extends AbstractOSGiResolver {
                 Resource obrResource = new URLResource(url);
                 CacheResourceOptions options = new CacheResourceOptions();
                 if (metadataTtl != null) {
-                    options.setTtl(metadataTtl.longValue());
+                    options.setTtl(metadataTtl);
                 }
                 if (forceMetadataUpdate != null) {
                     options.setForce(forceMetadataUpdate);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/obr/xml/Capability.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/obr/xml/Capability.java b/src/java/org/apache/ivy/osgi/obr/xml/Capability.java
index 4712b94..392190b 100644
--- a/src/java/org/apache/ivy/osgi/obr/xml/Capability.java
+++ b/src/java/org/apache/ivy/osgi/obr/xml/Capability.java
@@ -22,7 +22,7 @@ import java.util.List;
 
 public class Capability {
 
-    private List<CapabilityProperty> properties = new ArrayList<CapabilityProperty>();
+    private List<CapabilityProperty> properties = new ArrayList<>();
 
     private String name;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/obr/xml/CapabilityAdapter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/obr/xml/CapabilityAdapter.java b/src/java/org/apache/ivy/osgi/obr/xml/CapabilityAdapter.java
index 6aea463..395908e 100644
--- a/src/java/org/apache/ivy/osgi/obr/xml/CapabilityAdapter.java
+++ b/src/java/org/apache/ivy/osgi/obr/xml/CapabilityAdapter.java
@@ -67,10 +67,8 @@ public class CapabilityAdapter {
         }
         ExportPackage exportPackage = new ExportPackage(pkgName, version);
         if (uses != null) {
-            String[] split = uses.trim().split(",");
-            for (int i = 0; i < split.length; i++) {
-                String u = split[i];
-                exportPackage.addUse(u.trim());
+            for (String use : uses.split(",")) {
+                exportPackage.addUse(use.trim());
             }
         }
         return exportPackage;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java b/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java
index 190b957..1518d7d 100644
--- a/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java
+++ b/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java
@@ -148,33 +148,40 @@ public class OBRXMLWriter {
         String type = capability.getType();
         addAttr(atts, CapabilityHandler.NAME, type);
         handler.startElement("", CapabilityHandler.CAPABILITY, CapabilityHandler.CAPABILITY, atts);
-        if (type.equals(BundleInfo.BUNDLE_TYPE)) {
-            // nothing to do, already handled with the resource tag
-        } else if (type.equals(BundleInfo.PACKAGE_TYPE)) {
-            saxCapabilityProperty("package", capability.getName(), handler);
-            Version v = capability.getRawVersion();
-            if (v != null) {
-                saxCapabilityProperty("version", v.toString(), handler);
-            }
-            Set<String> uses = ((ExportPackage) capability).getUses();
-            if (uses != null && !uses.isEmpty()) {
-                StringBuffer builder = new StringBuffer();
-                for (String use : uses) {
-                    if (builder.length() != 0) {
-                        builder.append(',');
+        switch (type) {
+            case BundleInfo.BUNDLE_TYPE:
+                // nothing to do, already handled with the resource tag
+                break;
+            case BundleInfo.PACKAGE_TYPE: {
+                saxCapabilityProperty("package", capability.getName(), handler);
+                Version v = capability.getRawVersion();
+                if (v != null) {
+                    saxCapabilityProperty("version", v.toString(), handler);
+                }
+                Set<String> uses = ((ExportPackage) capability).getUses();
+                if (uses != null && !uses.isEmpty()) {
+                    StringBuilder builder = new StringBuilder();
+                    for (String use : uses) {
+                        if (builder.length() != 0) {
+                            builder.append(',');
+                        }
+                        builder.append(use);
                     }
-                    builder.append(use);
+                    saxCapabilityProperty("uses", builder.toString(), handler);
                 }
-                saxCapabilityProperty("uses", builder.toString(), handler);
+                break;
             }
-        } else if (type.equals(BundleInfo.SERVICE_TYPE)) {
-            saxCapabilityProperty("service", capability.getName(), handler);
-            Version v = capability.getRawVersion();
-            if (v != null) {
-                saxCapabilityProperty("version", v.toString(), handler);
+            case BundleInfo.SERVICE_TYPE: {
+                saxCapabilityProperty("service", capability.getName(), handler);
+                Version v = capability.getRawVersion();
+                if (v != null) {
+                    saxCapabilityProperty("version", v.toString(), handler);
+                }
+                break;
             }
-        } else {
-            // oups
+            default:
+                // oups
+                break;
         }
         handler.endElement("", CapabilityHandler.CAPABILITY, CapabilityHandler.CAPABILITY);
         handler.characters("\n".toCharArray(), 0, 1);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java b/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
index 207618a..c027989 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
@@ -71,7 +71,7 @@ public class P2ArtifactParser implements XMLInputParser {
         //
         // private static final String VERSION = "version";
 
-        private Map<OSGiFilter, String> artifactPatterns = new LinkedHashMap<OSGiFilter, String>();
+        private Map<OSGiFilter, String> artifactPatterns = new LinkedHashMap<>();
 
         public RepositoryHandler(final P2Descriptor p2Descriptor, String repoUrl) {
             super(REPOSITORY);
@@ -130,7 +130,7 @@ public class P2ArtifactParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            outputByFilter = new LinkedHashMap<String, String>(size);
+            outputByFilter = new LinkedHashMap<>(size);
         }
 
     }
@@ -180,10 +180,7 @@ public class P2ArtifactParser implements XMLInputParser {
                         URI uri;
                         try {
                             uri = new URL(url).toURI();
-                        } catch (MalformedURLException e) {
-                            throw new SAXParseException("Incorrect artifact url '" + url + "' ("
-                                    + e.getMessage() + ")", getLocator(), e);
-                        } catch (URISyntaxException e) {
+                        } catch (MalformedURLException | URISyntaxException e) {
                             throw new SAXParseException("Incorrect artifact url '" + url + "' ("
                                     + e.getMessage() + ")", getLocator(), e);
                         }
@@ -194,7 +191,7 @@ public class P2ArtifactParser implements XMLInputParser {
                 }
 
                 private String getPattern(P2Artifact p2Artifact, Map<String, String> properties) {
-                    Map<String, String> props = new HashMap<String, String>(properties);
+                    Map<String, String> props = new HashMap<>(properties);
                     props.put("classifier", p2Artifact.getClassifier());
                     for (Entry<OSGiFilter, String> pattern : artifactPatterns.entrySet()) {
                         if (pattern.getKey().eval(props)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java b/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
index 110907f..3819d6c 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2CompositeParser.java
@@ -35,7 +35,7 @@ import org.xml.sax.SAXException;
 
 public class P2CompositeParser implements XMLInputParser {
 
-    private Set<String> childLocations = new LinkedHashSet<String>();
+    private Set<String> childLocations = new LinkedHashSet<>();
 
     public Set<String> getChildLocations() {
         return childLocations;
@@ -100,7 +100,7 @@ public class P2CompositeParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            childLocations = new ArrayList<String>(size);
+            childLocations = new ArrayList<>(size);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java b/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java
index 87ab7fc..df77956 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java
@@ -32,9 +32,9 @@ import org.apache.ivy.util.Message;
 
 public class P2Descriptor extends EditableRepoDescriptor {
 
-    private Map<String, Map<Version, BundleInfo>> sourceTargetBundles = new HashMap<String, Map<Version, BundleInfo>>();
+    private Map<String, Map<Version, BundleInfo>> sourceTargetBundles = new HashMap<>();
 
-    private Map<String, Map<Version, BundleInfo>> sourceBundles = new HashMap<String, Map<Version, BundleInfo>>();
+    private Map<String, Map<Version, BundleInfo>> sourceBundles = new HashMap<>();
 
     public P2Descriptor(URI repoUri, ExecutionEnvironmentProfileProvider profileProvider) {
         super(repoUri, profileProvider);
@@ -51,7 +51,7 @@ public class P2Descriptor extends EditableRepoDescriptor {
             }
             Map<Version, BundleInfo> byVersion = sourceBundles.get(bundleInfo.getSymbolicName());
             if (byVersion == null) {
-                byVersion = new HashMap<Version, BundleInfo>();
+                byVersion = new HashMap<>();
                 sourceBundles.put(bundleInfo.getSymbolicName(), byVersion);
             }
             byVersion.put(bundleInfo.getVersion(), bundleInfo);
@@ -59,7 +59,7 @@ public class P2Descriptor extends EditableRepoDescriptor {
             Map<Version, BundleInfo> byTargetVersion = sourceTargetBundles.get(bundleInfo
                     .getSymbolicNameTarget());
             if (byTargetVersion == null) {
-                byTargetVersion = new HashMap<Version, BundleInfo>();
+                byTargetVersion = new HashMap<>();
                 sourceTargetBundles.put(bundleInfo.getSymbolicNameTarget(), byTargetVersion);
             }
             BundleInfo old = byTargetVersion.put(bundleInfo.getVersionTarget(), bundleInfo);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java b/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
index 700a23a..7ba23f2 100644
--- a/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
@@ -138,7 +138,7 @@ public class P2MetadataParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) throws SAXException {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            repositoryUris = new ArrayList<URI>(size);
+            repositoryUris = new ArrayList<>(size);
         }
     }
 
@@ -219,7 +219,7 @@ public class P2MetadataParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            bundles = new ArrayList<BundleInfo>(size);
+            bundles = new ArrayList<>(size);
         }
 
     }
@@ -487,7 +487,7 @@ public class P2MetadataParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            capabilities = new ArrayList<BundleCapability>(size);
+            capabilities = new ArrayList<>(size);
         }
 
     }
@@ -551,7 +551,7 @@ public class P2MetadataParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            requirements = new ArrayList<BundleRequirement>(size);
+            requirements = new ArrayList<>(size);
         }
 
     }
@@ -657,7 +657,7 @@ public class P2MetadataParser implements XMLInputParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            artifacts = new ArrayList<P2Artifact>(size);
+            artifacts = new ArrayList<>(size);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java b/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java
index bf048af..1c43413 100644
--- a/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/PropertiesParser.java
@@ -51,7 +51,7 @@ public class PropertiesParser {
         @Override
         protected void handleAttributes(Attributes atts) {
             int size = Integer.parseInt(atts.getValue(SIZE));
-            properties = new HashMap<String, String>(size);
+            properties = new HashMap<>(size);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java b/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
index 4d79f41..6170726 100644
--- a/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
+++ b/src/java/org/apache/ivy/osgi/p2/XMLInputParser.java
@@ -25,6 +25,6 @@ import org.xml.sax.SAXException;
 
 public interface XMLInputParser {
 
-    public void parse(InputStream in) throws ParseException, IOException, SAXException;
+    void parse(InputStream in) throws ParseException, IOException, SAXException;
 
 }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java b/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
index cbccda9..cf1d511 100644
--- a/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
+++ b/src/java/org/apache/ivy/osgi/repo/AbstractFSManifestIterable.java
@@ -62,7 +62,7 @@ public abstract class AbstractFSManifestIterable<T> implements Iterable<Manifest
          * the stack is an iterator on the children on the root. The last iterator in the stack
          * points to {@link #currentDir}.
          */
-        private Stack<Iterator<T>> dirs = new Stack<Iterator<T>>();
+        private Stack<Iterator<T>> dirs = new Stack<>();
 
         /**
          * The bundles files being lookup.

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/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 2a73d21..02589b5 100644
--- a/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
+++ b/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
@@ -243,16 +243,16 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
             // several candidates with different symbolic name : make an warning about the ambiguity
             if (rress.length != 1) {
                 // several candidates with different symbolic name ?
-                Map<String, List<MDResolvedResource>> matching = new HashMap<String, List<MDResolvedResource>>();
-                for (int i = 0; i < rress.length; i++) {
-                    String name = ((MDResolvedResource) rress[i]).getResolvedModuleRevision()
+                Map<String, List<MDResolvedResource>> matching = new HashMap<>();
+                for (ResolvedResource rres : rress) {
+                    String name = ((MDResolvedResource) rres).getResolvedModuleRevision()
                             .getDescriptor().getExtraAttribute(CAPABILITY_EXTRA_ATTR);
                     List<MDResolvedResource> list = matching.get(name);
                     if (list == null) {
-                        list = new ArrayList<MDResolvedResource>();
+                        list = new ArrayList<>();
                         matching.put(name, list);
                     }
-                    list.add((MDResolvedResource) rress[i]);
+                    list.add((MDResolvedResource) rres);
                 }
                 if (matching.keySet().size() != 1) {
                     if (requirementStrategy == RequirementStrategy.first) {
@@ -335,7 +335,7 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
 
         if (IvyPatternHelper.REVISION_KEY.equals(token)) {
             String name = tokenValues.get(IvyPatternHelper.MODULE_KEY);
-            List<String> versions = new ArrayList<String>();
+            List<String> versions = new ArrayList<>();
             Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModules(osgiType, name);
             if (mds != null) {
                 for (ModuleDescriptorWrapper md : mds) {
@@ -405,14 +405,14 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
 
     @Override
     public Map<String, String>[] listTokenValues(String[] tokens, Map<String, Object> criteria) {
-        Set<String> tokenSet = new HashSet<String>(Arrays.asList(tokens));
+        Set<String> tokenSet = new HashSet<>(Arrays.asList(tokens));
         Set<Map<String, String>> listTokenValues = listTokenValues(tokenSet, criteria);
         return listTokenValues.toArray(new Map[listTokenValues.size()]);
     }
 
     private Set<Map<String, String>> listTokenValues(Set<String> tokens,
             Map<String, Object> criteria) {
-        Map<String, String> stringCriteria = new HashMap<String, String>();
+        Map<String, String> stringCriteria = new HashMap<>();
         for (Entry<String, Object> entry : criteria.entrySet()) {
             String key = entry.getKey();
             Object value = entry.getValue();
@@ -428,25 +428,25 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
             return Collections.singleton(stringCriteria);
         }
 
-        Set<String> remainingTokens = new HashSet<String>(tokens);
+        Set<String> remainingTokens = new HashSet<>(tokens);
 
         remainingTokens.remove(IvyPatternHelper.ORGANISATION_KEY);
         String osgiType = stringCriteria.get(IvyPatternHelper.ORGANISATION_KEY);
         if (osgiType == null) {
-            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
-            Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
+            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));
-            newCriteria = new HashMap<String, Object>(criteria);
+            newCriteria = new HashMap<>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.PACKAGE_TYPE);
             tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
-            newCriteria = new HashMap<String, Object>(criteria);
+            newCriteria = new HashMap<>(criteria);
             newCriteria.put(IvyPatternHelper.ORGANISATION_KEY, BundleInfo.SERVICE_TYPE);
             tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
             return tokenValues;
         }
 
-        Map<String, String> values = new HashMap<String, String>();
+        Map<String, String> values = new HashMap<>();
         values.put(IvyPatternHelper.ORGANISATION_KEY, osgiType);
 
         Set<String> capabilities = getRepoDescriptor().getCapabilityValues(osgiType);
@@ -457,9 +457,9 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
         remainingTokens.remove(IvyPatternHelper.MODULE_KEY);
         String module = stringCriteria.get(IvyPatternHelper.MODULE_KEY);
         if (module == null) {
-            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            Set<Map<String, String>> tokenValues = new HashSet<>();
             for (String name : capabilities) {
-                Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
+                Map<String, Object> newCriteria = new HashMap<>(criteria);
                 newCriteria.put(IvyPatternHelper.MODULE_KEY, name);
                 tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
             }
@@ -474,9 +474,9 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
             if (mdws == null || mdws.isEmpty()) {
                 return Collections.emptySet();
             }
-            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            Set<Map<String, String>> tokenValues = new HashSet<>();
             for (ModuleDescriptorWrapper mdw : mdws) {
-                Map<String, Object> newCriteria = new HashMap<String, Object>(criteria);
+                Map<String, Object> newCriteria = new HashMap<>(criteria);
                 newCriteria.put(IvyPatternHelper.REVISION_KEY, mdw.getBundleInfo().getVersion()
                         .toString());
                 tokenValues.addAll(listTokenValues(remainingTokens, newCriteria));
@@ -507,12 +507,12 @@ public abstract class AbstractOSGiResolver extends BasicResolver {
             if (found == null) {
                 return Collections.emptySet();
             }
-            Set<Map<String, String>> tokenValues = new HashSet<Map<String, String>>();
+            Set<Map<String, String>> tokenValues = new HashSet<>();
             List<String> configurations = BundleInfoAdapter
                     .getConfigurations(found.getBundleInfo());
-            for (int i = 0; i < configurations.size(); i++) {
-                Map<String, String> newCriteria = new HashMap<String, String>(stringCriteria);
-                newCriteria.put(IvyPatternHelper.CONF_KEY, configurations.get(i));
+            for (String configuration : configurations) {
+                Map<String, String> newCriteria = new HashMap<>(stringCriteria);
+                newCriteria.put(IvyPatternHelper.CONF_KEY, configuration);
                 tokenValues.add(newCriteria);
             }
             return tokenValues;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/AggregatedOSGiResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/AggregatedOSGiResolver.java b/src/java/org/apache/ivy/osgi/repo/AggregatedOSGiResolver.java
index ad00cf4..d1101b8 100644
--- a/src/java/org/apache/ivy/osgi/repo/AggregatedOSGiResolver.java
+++ b/src/java/org/apache/ivy/osgi/repo/AggregatedOSGiResolver.java
@@ -22,7 +22,7 @@ import java.util.List;
 
 public class AggregatedOSGiResolver extends AbstractOSGiResolver {
 
-    private List<AbstractOSGiResolver> resolvers = new ArrayList<AbstractOSGiResolver>();
+    private List<AbstractOSGiResolver> resolvers = new ArrayList<>();
 
     public void add(AbstractOSGiResolver resolver) {
         resolvers.add(resolver);
@@ -30,7 +30,7 @@ public class AggregatedOSGiResolver extends AbstractOSGiResolver {
 
     @Override
     protected void init() {
-        List<RepoDescriptor> repos = new ArrayList<RepoDescriptor>();
+        List<RepoDescriptor> repos = new ArrayList<>();
         for (AbstractOSGiResolver resolver : resolvers) {
             repos.add(resolver.getRepoDescriptor());
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java b/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java
index 0963bd7..67d1bc5 100644
--- a/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java
+++ b/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java
@@ -75,7 +75,7 @@ public class AggregatedRepoDescriptor extends RepoDescriptor {
 
     @Override
     public Set<String> getCapabilities() {
-        Set<String> ret = new HashSet<String>();
+        Set<String> ret = new HashSet<>();
         for (RepoDescriptor repo : repos) {
             Set<String> capabilities = repo.getCapabilities();
             if (capabilities != null) {
@@ -87,7 +87,7 @@ public class AggregatedRepoDescriptor extends RepoDescriptor {
 
     @Override
     public Set<ModuleDescriptorWrapper> findModules(String requirement, String value) {
-        Set<ModuleDescriptorWrapper> ret = new HashSet<ModuleDescriptorWrapper>();
+        Set<ModuleDescriptorWrapper> ret = new HashSet<>();
         for (RepoDescriptor repo : repos) {
             Set<ModuleDescriptorWrapper> modules = repo.findModules(requirement, value);
             if (modules != null) {
@@ -99,7 +99,7 @@ public class AggregatedRepoDescriptor extends RepoDescriptor {
 
     @Override
     public Set<String> getCapabilityValues(String capabilityName) {
-        Set<String> ret = new HashSet<String>();
+        Set<String> ret = new HashSet<>();
         for (RepoDescriptor repo : repos) {
             Set<String> capabilityValues = repo.getCapabilityValues(capabilityName);
             if (capabilityValues != null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java b/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
index 0674228..920f42f 100644
--- a/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
+++ b/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
@@ -37,7 +37,7 @@ import org.apache.ivy.util.Message;
 
 public class ArtifactReportManifestIterable implements Iterable<ManifestAndLocation> {
 
-    private final Map<ModuleRevisionId, List<ArtifactDownloadReport>> artifactReports = new HashMap<ModuleRevisionId, List<ArtifactDownloadReport>>();
+    private final Map<ModuleRevisionId, List<ArtifactDownloadReport>> artifactReports = new HashMap<>();
 
     private List<String> sourceTypes;
 
@@ -48,7 +48,7 @@ public class ArtifactReportManifestIterable implements Iterable<ManifestAndLocat
             ModuleRevisionId mrid = report.getArtifact().getModuleRevisionId();
             List<ArtifactDownloadReport> moduleReports = artifactReports.get(mrid);
             if (moduleReports == null) {
-                moduleReports = new ArrayList<ArtifactDownloadReport>();
+                moduleReports = new ArrayList<>();
                 artifactReports.put(mrid, moduleReports);
             }
             moduleReports.add(report);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
index ae77af2..7889a1e 100644
--- a/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
+++ b/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
@@ -33,9 +33,9 @@ import org.apache.ivy.util.Message;
 
 public class EditableRepoDescriptor extends RepoDescriptor {
 
-    private final Map<String, Map<String, Set<ModuleDescriptorWrapper>>> moduleByCapabilities = new HashMap<String, Map<String, Set<ModuleDescriptorWrapper>>>();
+    private final Map<String, Map<String, Set<ModuleDescriptorWrapper>>> moduleByCapabilities = new HashMap<>();
 
-    private final Set<ModuleDescriptorWrapper> modules = new HashSet<ModuleDescriptorWrapper>();
+    private final Set<ModuleDescriptorWrapper> modules = new HashSet<>();
 
     private final ExecutionEnvironmentProfileProvider profileProvider;
 
@@ -102,12 +102,12 @@ public class EditableRepoDescriptor extends RepoDescriptor {
         modules.add(md);
         Map<String, Set<ModuleDescriptorWrapper>> map = moduleByCapabilities.get(type);
         if (map == null) {
-            map = new HashMap<String, Set<ModuleDescriptorWrapper>>();
+            map = new HashMap<>();
             moduleByCapabilities.put(type, map);
         }
         Set<ModuleDescriptorWrapper> bundleReferences = map.get(value);
         if (bundleReferences == null) {
-            bundleReferences = new HashSet<ModuleDescriptorWrapper>();
+            bundleReferences = new HashSet<>();
             map.put(value, bundleReferences);
         }
         if (!bundleReferences.add(md)) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java b/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java
index 3d71760..f2cb305 100644
--- a/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java
+++ b/src/java/org/apache/ivy/osgi/repo/FSManifestIterable.java
@@ -36,8 +36,8 @@ public class FSManifestIterable extends AbstractFSManifestIterable<File> {
     /**
      * List of directory name that usually contains jars but are not bundles
      */
-    public static final Set<String> NON_BUNDLE_DIRS = new HashSet<String>(Arrays.asList("source",
-        "sources", "javadoc", "javadocs", "doc", "docs"));
+    public static final Set<String> NON_BUNDLE_DIRS = new HashSet<>(Arrays.asList("source",
+            "sources", "javadoc", "javadocs", "doc", "docs"));
 
     /**
      * Default directory filter that doesn't select .svn directories, neither the directories that

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java b/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
index 22bf67e..7efcb03 100644
--- a/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
+++ b/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
@@ -34,7 +34,7 @@ public class ModuleDescriptorWrapper {
 
     private BundleInfo bundleInfo;
 
-    private DefaultModuleDescriptor md;
+    private volatile DefaultModuleDescriptor md;
 
     private URI baseUri;
 
@@ -71,7 +71,7 @@ public class ModuleDescriptorWrapper {
         if (collection.isEmpty()) {
             return Collections.emptyList();
         }
-        List<ModuleDescriptor> unwrapped = new ArrayList<ModuleDescriptor>();
+        List<ModuleDescriptor> unwrapped = new ArrayList<>();
         for (ModuleDescriptorWrapper wrapped : collection) {
             unwrapped.add(wrapped.getModuleDescriptor());
         }

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java b/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java
index e4b055d..03b6860 100644
--- a/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java
+++ b/src/java/org/apache/ivy/osgi/repo/RelativeURLRepository.java
@@ -42,7 +42,7 @@ public class RelativeURLRepository extends URLRepository {
         this.baseUrl = baseUrl;
     }
 
-    private Map<String, Resource> resourcesCache = new HashMap<String, Resource>();
+    private Map<String, Resource> resourcesCache = new HashMap<>();
 
     public Resource getResource(String source) throws IOException {
         source = encode(source);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
index 6e3f9c9..c63b437 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
@@ -232,13 +232,10 @@ public class UpdateSiteLoader {
         if (report.getDownloadStatus() == DownloadStatus.FAILED) {
             return null;
         }
-        InputStream in = new FileInputStream(report.getLocalFile());
-        try {
+        try (InputStream in = new FileInputStream(report.getLocalFile())) {
             UpdateSite site = EclipseUpdateSiteParser.parse(in);
             site.setUri(normalizeSiteUri(site.getUri(), siteUri));
             return site;
-        } finally {
-            in.close();
         }
     }
 
@@ -281,15 +278,12 @@ public class UpdateSiteLoader {
         if (report.getDownloadStatus() == DownloadStatus.FAILED) {
             return null;
         }
-        InputStream in = new FileInputStream(report.getLocalFile());
-        try {
+        try (InputStream in = new FileInputStream(report.getLocalFile())) {
             ZipInputStream zipped = findEntry(in, "digest.xml");
             if (zipped == null) {
                 return null;
             }
             return UpdateSiteDigestParser.parse(zipped, site);
-        } finally {
-            in.close();
         }
     }
 
@@ -307,8 +301,7 @@ public class UpdateSiteLoader {
             if (report.getDownloadStatus() == DownloadStatus.FAILED) {
                 return null;
             }
-            InputStream in = new FileInputStream(report.getLocalFile());
-            try {
+            try (InputStream in = new FileInputStream(report.getLocalFile())) {
                 ZipInputStream zipped = findEntry(in, "feature.xml");
                 if (zipped == null) {
                     return null;
@@ -316,8 +309,6 @@ public class UpdateSiteLoader {
                 EclipseFeature f = FeatureParser.parse(zipped);
                 f.setURL(feature.getUrl());
                 repoDescriptor.addFeature(f);
-            } finally {
-                in.close();
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java
index f178615..f6dde81 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteResolver.java
@@ -67,7 +67,7 @@ public class UpdateSiteResolver extends AbstractOSGiResolver {
         }
         CacheResourceOptions options = new CacheResourceOptions();
         if (metadataTtl != null) {
-            options.setTtl(metadataTtl.longValue());
+            options.setTtl(metadataTtl);
         }
         if (forceMetadataUpdate != null) {
             options.setForce(forceMetadataUpdate);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java b/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java
index 2e21044..a568c9a 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/xml/EclipseFeature.java
@@ -28,9 +28,9 @@ public class EclipseFeature {
 
     private Version version;
 
-    private List<EclipsePlugin> plugins = new ArrayList<EclipsePlugin>();
+    private List<EclipsePlugin> plugins = new ArrayList<>();
 
-    private List<Require> requires = new ArrayList<Require>();
+    private List<Require> requires = new ArrayList<>();
 
     private String url;
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java b/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java
index 979de27..84e0866 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/xml/FeatureParser.java
@@ -229,7 +229,7 @@ public class FeatureParser {
 
         private static final String REQUIRES = "requires";
 
-        List<Require> requires = new ArrayList<Require>();
+        List<Require> requires = new ArrayList<>();
 
         public RequiresHandler() {
             super(REQUIRES);

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java b/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java
index 24a0414..bf113ea 100644
--- a/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java
+++ b/src/java/org/apache/ivy/osgi/updatesite/xml/UpdateSite.java
@@ -33,7 +33,7 @@ public class UpdateSite {
 
     private URI digestUri;
 
-    private List<EclipseFeature> features = new ArrayList<EclipseFeature>();
+    private List<EclipseFeature> features = new ArrayList<>();
 
     public void setUri(URI uri) {
         this.uri = uri;

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java b/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java
index a314d57..a52642d 100644
--- a/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java
+++ b/src/java/org/apache/ivy/osgi/util/DelegatingHandler.java
@@ -38,9 +38,9 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
 
     DelegatingHandler parent;
 
-    private final Map<String, DelegatingHandler> saxHandlerMapping = new HashMap<String, DelegatingHandler>();
+    private final Map<String, DelegatingHandler> saxHandlerMapping = new HashMap<>();
 
-    private final Map<String, ChildElementHandler<?>> childHandlerMapping = new HashMap<String, DelegatingHandler.ChildElementHandler<?>>();
+    private final Map<String, ChildElementHandler<?>> childHandlerMapping = new HashMap<>();
 
     private final String tagName;
 
@@ -131,7 +131,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
     }
 
     private interface SkipOnErrorCallback {
-        public void call() throws SAXException;
+        void call() throws SAXException;
     }
 
     private void skipOnError(SkipOnErrorCallback callback) throws SAXException {
@@ -634,7 +634,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
         if (value == null) {
             return defaultValue;
         }
-        return new Integer(parseInt(name, value));
+        return parseInt(name, value);
     }
 
     private int parseInt(String name, String value) throws SAXParseException {
@@ -657,7 +657,7 @@ public class DelegatingHandler extends DefaultHandler implements DTDHandler, Con
         if (value == null) {
             return defaultValue;
         }
-        return new Long(parseLong(name, value));
+        return parseLong(name, value);
     }
 
     private long parseLong(String name, String value) throws SAXParseException {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/util/ParseUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/ParseUtil.java b/src/java/org/apache/ivy/osgi/util/ParseUtil.java
index 39078b9..62a0a1c 100644
--- a/src/java/org/apache/ivy/osgi/util/ParseUtil.java
+++ b/src/java/org/apache/ivy/osgi/util/ParseUtil.java
@@ -39,14 +39,14 @@ public class ParseUtil {
             value = "";
         }
 
-        final List<String> list = new ArrayList<String>();
+        final List<String> list = new ArrayList<>();
 
         final int CHAR = 1;
         final int DELIMITER = 2;
         final int STARTQUOTE = 4;
         final int ENDQUOTE = 8;
 
-        final StringBuffer sb = new StringBuffer();
+        final StringBuilder sb = new StringBuilder();
 
         int expecting = (CHAR | DELIMITER | STARTQUOTE);
 

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/util/VersionRange.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/VersionRange.java b/src/java/org/apache/ivy/osgi/util/VersionRange.java
index 8d8be94..4d97562 100644
--- a/src/java/org/apache/ivy/osgi/util/VersionRange.java
+++ b/src/java/org/apache/ivy/osgi/util/VersionRange.java
@@ -147,23 +147,23 @@ public class VersionRange {
             if (major == null) {
                 return null;
             }
-            Integer minor = new Integer(0);
-            Integer patch = new Integer(0);
+            Integer minor = 0;
+            Integer patch = 0;
             String qualifier = null;
             if (parseNumberSeparator()) {
                 minor = parseNumber();
                 if (minor == null) {
-                    minor = new Integer(0);
+                    minor = 0;
                 } else if (parseNumberSeparator()) {
                     patch = parseNumber();
                     if (patch == null) {
-                        patch = new Integer(0);
+                        patch = 0;
                     } else if (parseNumberSeparator()) {
                         qualifier = parseQualifier();
                     }
                 }
             }
-            return new Version(major.intValue(), minor.intValue(), patch.intValue(), qualifier);
+            return new Version(major, minor, patch, qualifier);
         }
 
         private Integer parseNumber() {
@@ -183,7 +183,7 @@ public class VersionRange {
                     case '7':
                     case '8':
                     case '9':
-                        n = new Integer((n == null ? 0 : n.intValue() * 10) + c - '0');
+                        n = (n == null ? 0 : n * 10) + c - '0';
                         break;
                     default:
                         unread();
@@ -215,7 +215,7 @@ public class VersionRange {
         }
 
         private String parseQualifier() {
-            StringBuffer q = new StringBuffer();
+            StringBuilder q = new StringBuilder();
             do {
                 readNext();
                 if (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= '0' && c <= '9'
@@ -269,7 +269,7 @@ public class VersionRange {
     }
 
     public String toIvyRevision() {
-        StringBuffer buffer = new StringBuffer();
+        StringBuilder buffer = new StringBuilder();
         buffer.append(startExclusive ? "(" : "[");
         buffer.append(startVersion);
         if (endVersion == null) {

http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/0c0ee355/src/java/org/apache/ivy/osgi/util/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/osgi/util/ZipUtil.java b/src/java/org/apache/ivy/osgi/util/ZipUtil.java
index 92737c3..df03207 100644
--- a/src/java/org/apache/ivy/osgi/util/ZipUtil.java
+++ b/src/java/org/apache/ivy/osgi/util/ZipUtil.java
@@ -43,9 +43,8 @@ public class ZipUtil {
     private static void zipFiles(File rootDir, File currDir, ZipOutputStream zos)
             throws IOException {
         if (currDir.isDirectory()) {
-            final File[] files = currDir.listFiles();
-            for (int i = 0; i < files.length; i++) {
-                zipFiles(rootDir, files[i], zos);
+            for (File file : currDir.listFiles()) {
+                zipFiles(rootDir, file, zos);
             }
         } else {
             final String strAbsPath = currDir.getPath();


Mime
View raw message