ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twogee <...@git.apache.org>
Subject [GitHub] ant-ivy pull request #52: Generics in core
Date Fri, 14 Jul 2017 08:19:53 GMT
Github user twogee commented on a diff in the pull request:

    https://github.com/apache/ant-ivy/pull/52#discussion_r127408025
  
    --- Diff: src/java/org/apache/ivy/tools/analyser/JarJarDependencyAnalyser.java ---
    @@ -39,21 +39,22 @@ public JarJarDependencyAnalyser(File jarjarjarLocation) {
         }
     
         public ModuleDescriptor[] analyze(JarModule[] modules) {
    -
             StringBuilder jarjarCmd = new StringBuilder("java -jar \"").append(
                 jarjarjarLocation.getAbsolutePath()).append("\" --find --level=jar ");
             Map<String, JarModule> jarModulesMap = new HashMap<>();
             Map<ModuleRevisionId, DefaultModuleDescriptor> mds = new HashMap<>();
     
    -        for (int i = 0; i < modules.length; i++) {
    -            jarModulesMap.put(modules[i].getJar().getAbsolutePath(), modules[i]);
    +        for (JarModule jarModule : modules) {
    +            jarModulesMap.put(jarModule.getJar().getAbsolutePath(), jarModule);
                 DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
    -                modules[i].getMrid(), new Date(modules[i].getJar().lastModified()));
    -            mds.put(modules[i].getMrid(), md);
    -            jarjarCmd.append("\"").append(modules[i].getJar().getAbsolutePath()).append("\"");
    -            if (i + 1 < modules.length) {
    -                jarjarCmd.append(File.pathSeparator);
    -            }
    +                    jarModule.getMrid(), new Date(jarModule.getJar().lastModified()));
    +            mds.put(jarModule.getMrid(), md);
    +            jarjarCmd.append("\"").append(jarModule.getJar().getAbsolutePath()).append("\"");
    +            jarjarCmd.append(File.pathSeparator);
    +        }
    +
    +        if (modules.length > 0) {
    +            jarjarCmd.setLength(jarjarCmd.length() - 1);
    --- End diff --
    
    It strips an extra pathSeparator character, but only if modules has any entries. It is
an afterthought on my part...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message