More Java 7 diamonds Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/3b28fffb Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/3b28fffb Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/3b28fffb
Branch: refs/heads/master Commit: 3b28fffbbac2a707906e35c7c014aa3eecef3510 Parents: 973704d Author: twogee <g.grigelio...@gmail.com> Authored: Tue Jun 13 22:07:19 2017 +0200 Committer: twogee <g.grigelio...@gmail.com> Committed: Tue Jun 13 22:07:19 2017 +0200 ---------------------------------------------------------------------- .../org/apache/ivy/ant/AntCallTriggerTest.java | 6 ++-- .../org/apache/ivy/ant/IvyBuildListTest.java | 3 +- .../org/apache/ivy/ant/IvyResourcesTest.java | 6 ++-- .../ivy/core/publish/PublishEventsTest.java | 8 ++--- .../apache/ivy/core/retrieve/RetrieveTest.java | 2 +- .../ivy/osgi/core/OsgiLatestStrategyTest.java | 12 +++---- .../latest/LatestRevisionStrategyTest.java | 16 ++++----- .../xml/XmlModuleDescriptorParserTest.java | 36 ++++++++++---------- .../ivy/plugins/resolver/MockResolver.java | 2 +- 9 files changed, 44 insertions(+), 47 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/AntCallTriggerTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java index f92a714..1383366 100644 --- a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java +++ b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java @@ -61,12 +61,12 @@ public class AntCallTriggerTest { } private void runAnt(File buildFile, String target, int messageLevel) throws BuildException { - Vector targets = new Vector(); + Vector<String> targets = new Vector<>(); targets.add(target); runAnt(buildFile, targets, messageLevel); } - private void runAnt(File buildFile, Vector targets, int messageLevel) throws BuildException { + private void runAnt(File buildFile, Vector<String> targets, int messageLevel) throws BuildException { runBuild(buildFile, targets, messageLevel); // this exits the jvm at the end of the call @@ -92,7 +92,7 @@ public class AntCallTriggerTest { // //////////////////////////////////////////////////////////////////////////// // miserable copy (updated to simple test cases) from ant Main class: // the only available way I found to easily run ant exits jvm at the end - private void runBuild(File buildFile, Vector targets, int messageLevel) throws BuildException { + private void runBuild(File buildFile, Vector<String> targets, int messageLevel) throws BuildException { final Project project = new Project(); project.setCoreLoader(null); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/IvyBuildListTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/ant/IvyBuildListTest.java b/test/java/org/apache/ivy/ant/IvyBuildListTest.java index cb5b4e4..01c0452 100644 --- a/test/java/org/apache/ivy/ant/IvyBuildListTest.java +++ b/test/java/org/apache/ivy/ant/IvyBuildListTest.java @@ -18,6 +18,7 @@ package org.apache.ivy.ant; import java.io.File; +import java.net.URI; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -383,7 +384,7 @@ public class IvyBuildListTest { assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D"}, files); // the order of E and E2 is undefined - List other = new ArrayList(); + List<URI> other = new ArrayList<>(); other.add(new File(files[4]).getAbsoluteFile().toURI()); other.add(new File(files[5]).getAbsoluteFile().toURI()); Collections.sort(other); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/IvyResourcesTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/ant/IvyResourcesTest.java b/test/java/org/apache/ivy/ant/IvyResourcesTest.java index ab60e6d..3103553 100644 --- a/test/java/org/apache/ivy/ant/IvyResourcesTest.java +++ b/test/java/org/apache/ivy/ant/IvyResourcesTest.java @@ -63,8 +63,8 @@ public class IvyResourcesTest { return resources.getIvyInstance(); } - private List asList(IvyResources ivyResources) { - List resources = new ArrayList(); + private List<File> asList(IvyResources ivyResources) { + List<File> resources = new ArrayList<>(); for (Object r : ivyResources) { assertTrue(r instanceof FileResource); resources.add(((FileResource) r).getFile()); @@ -202,7 +202,7 @@ public class IvyResourcesTest { IvyDependencyExclude exclude = dependency.createExclude(); exclude.setOrg("org1"); - List files = asList(resources); + List<File> files = asList(resources); assertEquals(3, files.size()); assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar"))); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/core/publish/PublishEventsTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java index 704a1fc..86a1401 100644 --- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java +++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java @@ -74,7 +74,7 @@ public class PublishEventsTest { private ModuleDescriptor publishModule; - private Collection publishSources; + private Collection<String> publishSources; private PublishOptions publishOptions; @@ -180,7 +180,7 @@ public class PublishEventsTest { // no modifications to input required for this case -- call out to the resolver, and verify // that // all of our test counters have been incremented. - Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(), + Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(), publishSources, "default", publishOptions); assertEquals("no missing artifacts", 0, missing.size()); @@ -203,7 +203,7 @@ public class PublishEventsTest { // set overwrite to true. InstrumentedResolver will verify that the correct argument value // was provided. publishOptions.setOverwrite(true); - Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(), + Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(), publishSources, "default", publishOptions); assertEquals("no missing artifacts", 0, missing.size()); @@ -224,7 +224,7 @@ public class PublishEventsTest { assertTrue("datafile has been destroyed", dataFile.delete()); PublishTestCase dataPublish = expectedPublications.get(dataArtifact.getId()); dataPublish.expectedSuccess = false; - Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(), + Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(), publishSources, "default", publishOptions); assertEquals("one missing artifact", 1, missing.size()); assertSameArtifact("missing artifact was returned", dataArtifact, (Artifact) missing http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java index 37a187c..12b92be 100644 --- a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java +++ b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java @@ -137,7 +137,7 @@ public class RetrieveTest { "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(), getResolveOptions(new String[] {"*"})); - final List events = new ArrayList(); + final List<IvyEvent> events = new ArrayList<>(); ivy.getEventManager().addIvyListener(new IvyListener() { public void progress(IvyEvent event) { events.add(event); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java index 8a9305e..c0f0a8e 100644 --- a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java +++ b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java @@ -37,7 +37,7 @@ public class OsgiLatestStrategyTest { "1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012", "2.0.0.xyz"}); - List shuffled = new ArrayList(Arrays.asList(revs)); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); Collections.shuffle(shuffled); Collections.sort(shuffled, new OsgiLatestStrategy().new ArtifactInfoComparator()); assertEquals(Arrays.asList(revs), shuffled); @@ -49,9 +49,8 @@ public class OsgiLatestStrategyTest { "1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012", "2.0.0.xyz"}); - List shuffled = new ArrayList(Arrays.asList(revs)); - ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled - .toArray(new ArtifactInfo[revs.length]); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); + ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]); OsgiLatestStrategy latestRevisionStrategy = new OsgiLatestStrategy(); List sorted = latestRevisionStrategy.sort(shuffledRevs); @@ -65,10 +64,9 @@ public class OsgiLatestStrategyTest { "1.0.0.beta1", "1.0.0.beta2", "1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0", "1.0.1", "2.0"}); - List shuffled = new ArrayList(Arrays.asList(revs)); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); Collections.shuffle(shuffled); - ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled - .toArray(new ArtifactInfo[revs.length]); + ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]); OsgiLatestStrategy latestRevisionStrategy = new OsgiLatestStrategy(); ArtifactInfo latest = latestRevisionStrategy.findLatest(shuffledRevs, new Date()); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java b/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java index b2df0dd..dbcf3e0 100644 --- a/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java +++ b/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java @@ -35,7 +35,7 @@ public class LatestRevisionStrategyTest { "1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2", "1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"}); - List shuffled = new ArrayList(Arrays.asList(revs)); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); Collections.shuffle(shuffled); Collections.sort(shuffled, new LatestRevisionStrategy().new ArtifactInfoComparator()); assertEquals(Arrays.asList(revs), shuffled); @@ -47,12 +47,11 @@ public class LatestRevisionStrategyTest { "1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2", "1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"}); - List shuffled = new ArrayList(Arrays.asList(revs)); - ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled - .toArray(new ArtifactInfo[revs.length]); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); + ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]); LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy(); - List sorted = latestRevisionStrategy.sort(shuffledRevs); + List<ArtifactInfo> sorted = latestRevisionStrategy.sort(shuffledRevs); assertEquals(Arrays.asList(revs), sorted); } @@ -62,9 +61,8 @@ public class LatestRevisionStrategyTest { "1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2", "1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"}); - List shuffled = new ArrayList(Arrays.asList(revs)); - ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled - .toArray(new ArtifactInfo[revs.length]); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); + ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]); LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy(); ArtifactInfo latest = latestRevisionStrategy.findLatest(shuffledRevs, new Date()); @@ -77,7 +75,7 @@ public class LatestRevisionStrategyTest { ArtifactInfo[] revs = toMockAI(new String[] {"0.1", "0.2-pre", "0.2-dev", "0.2-rc1", "0.2-final", "0.2-QA", "1.0-dev1"}); - List shuffled = new ArrayList(Arrays.asList(revs)); + List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs)); Collections.shuffle(shuffled); LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy(); LatestRevisionStrategy.SpecialMeaning specialMeaning = new LatestRevisionStrategy.SpecialMeaning(); http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java index d7baf8e..390d713 100644 --- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java +++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java @@ -334,8 +334,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("4.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet( - Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}), Arrays.asList(dd.getDependencyConfigurations("myconf1"))); assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}), @@ -350,8 +350,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("5.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet( - Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"yourconf1"}), Arrays.asList(dd.getDependencyConfigurations("myconf1"))); assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}), @@ -366,8 +366,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("11.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"*"})), - new HashSet(Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"myconf1"}), Arrays.asList(dd.getDependencyConfigurations("myconf1"))); assertEquals(Arrays.asList(new String[] {"myconf2"}), @@ -381,8 +381,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("latest.integration", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet( - Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"yourconf1"}), Arrays.asList(dd.getDependencyConfigurations("myconf1"))); assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}), @@ -396,8 +396,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("7.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet( - Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"yourconf1"}), Arrays.asList(dd.getDependencyConfigurations("myconf1"))); assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}), @@ -411,8 +411,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("8.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"*"})), - new HashSet(Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertDependencyArtifacts(dd, new String[] {"myconf1"}, new String[] {"yourartifact8-1", "yourartifact8-2"}); assertDependencyArtifacts(dd, new String[] {"myconf2"}, new String[] {"yourartifact8-1", @@ -426,8 +426,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("9.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2", "myconf3"})), - new HashSet(Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2", "myconf3"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertDependencyArtifacts(dd, new String[] {"myconf1"}, new String[] {"yourartifact9-1"}); assertDependencyArtifacts(dd, new String[] {"myconf2"}, new String[] {"yourartifact9-1", "yourartifact9-2"}); @@ -442,8 +442,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse assertNotNull(dd); assertEquals("yourorg", dd.getDependencyId().getOrganisation()); assertEquals("10.1", dd.getDependencyRevisionId().getRevision()); - assertEquals(new HashSet(Arrays.asList(new String[] {"*"})), - new HashSet(Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertDependencyArtifactIncludeRules(dd, new String[] {"myconf1"}, new String[] {"your.*", PatternMatcher.ANY_EXPRESSION}); assertDependencyArtifactIncludeRules(dd, new String[] {"myconf2"}, new String[] {"your.*", @@ -884,8 +884,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse // confs def: conf2,conf3->* dd = getDependency(dependencies, "mymodule2"); - assertEquals(new HashSet(Arrays.asList(new String[] {"conf2", "conf3"})), new HashSet( - Arrays.asList(dd.getModuleConfigurations()))); + assertEquals(new HashSet<>(Arrays.asList(new String[] {"conf2", "conf3"})), + new HashSet<>(Arrays.asList(dd.getModuleConfigurations()))); assertEquals(Arrays.asList(new String[] {"*"}), Arrays.asList(dd.getDependencyConfigurations("conf2"))); assertEquals(Arrays.asList(new String[] {"*"}), http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/resolver/MockResolver.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/plugins/resolver/MockResolver.java b/test/java/org/apache/ivy/plugins/resolver/MockResolver.java index bfedc55..d7c9f65 100644 --- a/test/java/org/apache/ivy/plugins/resolver/MockResolver.java +++ b/test/java/org/apache/ivy/plugins/resolver/MockResolver.java @@ -64,7 +64,7 @@ public class MockResolver extends AbstractResolver { return r; } - List askedDeps = new ArrayList(); + List<DependencyDescriptor> askedDeps = new ArrayList<>(); ResolvedModuleRevision rmr;