Browse Source

Generify

master
Gintas Grigelionis 7 years ago
parent
commit
1c9118e27e
21 changed files with 67 additions and 69 deletions
  1. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java
  2. +2
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  3. +1
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  4. +4
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java
  5. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
  6. +10
    -10
      src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
  7. +1
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java
  8. +15
    -19
      src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java
  9. +3
    -3
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
  10. +1
    -1
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java
  11. +2
    -2
      src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
  12. +1
    -1
      src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java
  13. +1
    -1
      src/tests/junit/org/apache/tools/ant/types/MapperTest.java
  14. +1
    -1
      src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java
  15. +4
    -4
      src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
  16. +2
    -1
      src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java
  17. +6
    -6
      src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java
  18. +1
    -1
      src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java
  19. +2
    -2
      src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java
  20. +5
    -5
      src/tests/junit/org/apache/tools/mail/MailMessageTest.java
  21. +2
    -2
      src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java

+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java View File

@@ -55,7 +55,7 @@ public class Javac12 extends DefaultCompilerAdapter {
// Create an instance of the compiler, redirecting output to // Create an instance of the compiler, redirecting output to
// the project log // the project log
Class<?> c = Class.forName(CLASSIC_COMPILER_CLASSNAME); Class<?> c = Class.forName(CLASSIC_COMPILER_CLASSNAME);
Constructor cons = c.getConstructor(OutputStream.class, String.class);
Constructor<?> cons = c.getConstructor(OutputStream.class, String.class);
Object compiler = cons.newInstance(logstr, "javac"); Object compiler = cons.newInstance(logstr, "javac");


// Call the compile() method // Call the compile() method


+ 2
- 2
src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java View File

@@ -335,7 +335,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
if ("org.apache.xalan.transformer.TransformerImpl" //NOSONAR if ("org.apache.xalan.transformer.TransformerImpl" //NOSONAR
.equals(transformer.getClass().getName())) { .equals(transformer.getClass().getName())) {
try { try {
final Class traceSupport =
final Class<?> traceSupport =
Class.forName("org.apache.tools.ant.taskdefs.optional." Class.forName("org.apache.tools.ant.taskdefs.optional."
+ "Xalan2TraceSupport", true, + "Xalan2TraceSupport", true,
Thread.currentThread() Thread.currentThread()
@@ -389,7 +389,7 @@ public class TraXLiaison implements XSLTLiaison4, ErrorListener, XSLTLoggerAware
tfactory = TransformerFactory.newInstance(); tfactory = TransformerFactory.newInstance();
} else { } else {
try { try {
Class clazz = null;
Class<?> clazz = null;
try { try {
clazz = clazz =
Class.forName(factoryName, true, Class.forName(factoryName, true,


+ 1
- 1
src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java View File

@@ -382,7 +382,7 @@ public class XMLValidateTask extends Task {
reader = createDefaultReaderOrParser(); reader = createDefaultReaderOrParser();
} else { } else {


Class readerClass = null;
Class<?> readerClass = null;
try { try {
// load the parser class // load the parser class
if (classpath != null) { if (classpath != null) {


+ 4
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java View File

@@ -80,8 +80,9 @@ public class AntStructureTest {
private int elementCalled = 0; private int elementCalled = 0;
private Project p; private Project p;


public void printHead(PrintWriter out, Project p, Hashtable tasks,
Hashtable types) {
public void printHead(PrintWriter out, Project p,
Hashtable<String, Class<?>> tasks,
Hashtable<String, Class<?>> types) {
assertTrue(!headCalled); assertTrue(!headCalled);
assertTrue(!targetCalled); assertTrue(!targetCalled);
assertTrue(!tailCalled); assertTrue(!tailCalled);
@@ -96,7 +97,7 @@ public class AntStructureTest {
targetCalled = true; targetCalled = true;
} }
public void printElementDecl(PrintWriter out, Project p, String name, public void printElementDecl(PrintWriter out, Project p, String name,
Class element) {
Class<?> element) {
assertTrue(headCalled); assertTrue(headCalled);
assertTrue(targetCalled); assertTrue(targetCalled);
assertTrue(!tailCalled); assertTrue(!tailCalled);


+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java View File

@@ -265,10 +265,10 @@ public class JarTest {
try { try {
buildRule.executeTarget("testIndexTests"); buildRule.executeTarget("testIndexTests");
archive = new ZipFile(new File(getOutputDir(), tempJar)); archive = new ZipFile(new File(getOutputDir(), tempJar));
Enumeration e = archive.entries();
Enumeration<? extends ZipEntry> e = archive.entries();
int numberOfIndexLists = 0; int numberOfIndexLists = 0;
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
ZipEntry ze = e.nextElement();
if (ze.getName().equals("META-INF/INDEX.LIST")) { if (ze.getName().equals("META-INF/INDEX.LIST")) {
numberOfIndexLists++; numberOfIndexLists++;
} }


+ 10
- 10
src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java View File

@@ -319,16 +319,16 @@ public class ManifestTest {
buildRule.executeTarget("testOrder1"); buildRule.executeTarget("testOrder1");


Manifest manifest = getManifest(expandedManifest); Manifest manifest = getManifest(expandedManifest);
Enumeration e = manifest.getSectionNames();
String section1 = (String) e.nextElement();
String section2 = (String) e.nextElement();
Enumeration<String> e = manifest.getSectionNames();
String section1 = e.nextElement();
String section2 = e.nextElement();
assertEquals("First section name unexpected", "Test1", section1); assertEquals("First section name unexpected", "Test1", section1);
assertEquals("Second section name unexpected", "Test2", section2); assertEquals("Second section name unexpected", "Test2", section2);


Manifest.Section section = manifest.getSection("Test1"); Manifest.Section section = manifest.getSection("Test1");
e = section.getAttributeKeys(); e = section.getAttributeKeys();
String attr1Key = (String) e.nextElement();
String attr2Key = (String) e.nextElement();
String attr1Key = e.nextElement();
String attr2Key = e.nextElement();
String attr1 = section.getAttribute(attr1Key).getName(); String attr1 = section.getAttribute(attr1Key).getName();
String attr2 = section.getAttribute(attr2Key).getName(); String attr2 = section.getAttribute(attr2Key).getName();
assertEquals("First attribute name unexpected", "TestAttr1", attr1); assertEquals("First attribute name unexpected", "TestAttr1", attr1);
@@ -343,16 +343,16 @@ public class ManifestTest {
buildRule.executeTarget("testOrder2"); buildRule.executeTarget("testOrder2");


Manifest manifest = getManifest(expandedManifest); Manifest manifest = getManifest(expandedManifest);
Enumeration e = manifest.getSectionNames();
String section1 = (String) e.nextElement();
String section2 = (String) e.nextElement();
Enumeration<String> e = manifest.getSectionNames();
String section1 = e.nextElement();
String section2 = e.nextElement();
assertEquals("First section name unexpected", "Test2", section1); assertEquals("First section name unexpected", "Test2", section1);
assertEquals("Second section name unexpected", "Test1", section2); assertEquals("Second section name unexpected", "Test1", section2);


Manifest.Section section = manifest.getSection("Test1"); Manifest.Section section = manifest.getSection("Test1");
e = section.getAttributeKeys(); e = section.getAttributeKeys();
String attr1Key = (String) e.nextElement();
String attr2Key = (String) e.nextElement();
String attr1Key = e.nextElement();
String attr2Key = e.nextElement();
String attr1 = section.getAttribute(attr1Key).getName(); String attr1 = section.getAttribute(attr1Key).getName();
String attr2 = section.getAttribute(attr2Key).getName(); String attr2 = section.getAttribute(attr2Key).getName();
assertEquals("First attribute name unexpected", "TestAttr2", attr1); assertEquals("First attribute name unexpected", "TestAttr2", attr1);


+ 1
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/TypeAdapterTest.java View File

@@ -136,7 +136,7 @@ public class TypeAdapterTest {
throw new BuildException(message); throw new BuildException(message);
} }
} }
public void checkProxyClass(Class proxyClass) {
public void checkProxyClass(Class<?> proxyClass) {
getExecuteMethod(proxyClass); getExecuteMethod(proxyClass);
} }




+ 15
- 19
src/tests/junit/org/apache/tools/ant/taskdefs/XmlPropertyTest.java View File

@@ -24,7 +24,9 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.Set;
import java.util.Vector; import java.util.Vector;


import org.apache.tools.ant.BuildFileRule; import org.apache.tools.ant.BuildFileRule;
@@ -145,10 +147,10 @@ public class XmlPropertyTest {
*/ */
private void doTest(String msg, boolean keepRoot, boolean collapse, private void doTest(String msg, boolean keepRoot, boolean collapse,
boolean semantic, boolean include, boolean localRoot) throws IOException { boolean semantic, boolean include, boolean localRoot) throws IOException {
Enumeration iter =
Enumeration<File> iter =
getFiles(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/xmlproperty/inputs")); getFiles(new File(System.getProperty("root"), "src/etc/testcases/taskdefs/xmlproperty/inputs"));
while (iter.hasMoreElements()) { while (iter.hasMoreElements()) {
File inputFile = (File) iter.nextElement();
File inputFile = iter.nextElement();
// What's the working directory? If local, then its the // What's the working directory? If local, then its the
// folder of the input file. Otherwise, its the "current" dir.. // folder of the input file. Otherwise, its the "current" dir..
File workingDir; File workingDir;
@@ -209,11 +211,9 @@ public class XmlPropertyTest {
private static void ensureProperties(String msg, File inputFile, private static void ensureProperties(String msg, File inputFile,
File workingDir, Project p, File workingDir, Project p,
Properties properties) { Properties properties) {
Hashtable xmlproperties = p.getProperties();
Hashtable<String, Object> xmlproperties = p.getProperties();
// Every key identified by the Properties must have been loaded. // Every key identified by the Properties must have been loaded.
Enumeration<?> propertyKeyEnum = properties.propertyNames();
while (propertyKeyEnum.hasMoreElements()) {
String currentKey = propertyKeyEnum.nextElement().toString();
for (String currentKey : properties.stringPropertyNames()) {
String assertMsg = msg + "-" + inputFile.getName() String assertMsg = msg + "-" + inputFile.getName()
+ " Key=" + currentKey; + " Key=" + currentKey;


@@ -266,24 +266,20 @@ public class XmlPropertyTest {
/** /**
* Debugging method to print the properties in the given hashtable * Debugging method to print the properties in the given hashtable
*/ */
private static void printProperties(Hashtable xmlproperties) {
Enumeration keyEnum = xmlproperties.keys();
while (keyEnum.hasMoreElements()) {
String currentKey = keyEnum.nextElement().toString();
System.out.println(currentKey + " = "
+ xmlproperties.get(currentKey));
private static void printProperties(Hashtable<Object, Object> xmlproperties) {
for (Map.Entry<Object, Object> entry : xmlproperties.entrySet()) {
System.out.println(entry.getKey() + " = " + entry.getValue());
} }
} }


/** /**
* Ensure all references loaded by the project are valid. * Ensure all references loaded by the project are valid.
*/ */
private static void ensureReferences (String msg, File inputFile,
Hashtable references) {
Enumeration referenceKeyEnum = references.keys();
while(referenceKeyEnum.hasMoreElements()){
String currentKey = referenceKeyEnum.nextElement().toString();
Object currentValue = references.get(currentKey);
private static void ensureReferences(String msg, File inputFile,
Hashtable<String, Object> references) {
for (Map.Entry<String, Object> entry : references.entrySet()) {
String currentKey = entry.getKey();
Object currentValue = entry.getValue();


if (!(currentValue instanceof Path) && !(currentValue instanceof String) if (!(currentValue instanceof Path) && !(currentValue instanceof String)
&& !currentKey.startsWith("ant.")) { && !currentKey.startsWith("ant.")) {
@@ -337,7 +333,7 @@ public class XmlPropertyTest {
* Retrieve a list of xml files in the specified folder * Retrieve a list of xml files in the specified folder
* and below. * and below.
*/ */
private static Enumeration getFiles (final File startingDir) {
private static Enumeration<File> getFiles (final File startingDir) {
Vector<File> result = new Vector<>(); Vector<File> result = new Vector<>();
getFiles(startingDir, result); getFiles(startingDir, result);
return result.elements(); return result.elements();


+ 3
- 3
src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java View File

@@ -65,7 +65,7 @@ public class DependTest {
FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5); FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);


buildRule.executeTarget("testdirect"); buildRule.executeTarget("testdirect");
Hashtable files = getResultFiles();
Hashtable<String, String> files = getResultFiles();
assertEquals("Depend did not leave correct number of files", 3, assertEquals("Depend did not leave correct number of files", 3,
files.size()); files.size());
assertTrue("Result did not contain A.class", assertTrue("Result did not contain A.class",
@@ -86,7 +86,7 @@ public class DependTest {
FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5); FileUtilities.rollbackTimestamps(new File(buildRule.getProject().getProperty("classes.dir")), 5);


buildRule.executeTarget("testclosure"); buildRule.executeTarget("testclosure");
Hashtable files = getResultFiles();
Hashtable<String, String> files = getResultFiles();
assertTrue("Depend did not leave correct number of files", assertTrue("Depend did not leave correct number of files",
files.size() <= 2); files.size() <= 2);
assertTrue("Result did not contain D.class", assertTrue("Result did not contain D.class",
@@ -159,7 +159,7 @@ public class DependTest {
* @return a Hashtable containing the names of the files in the result * @return a Hashtable containing the names of the files in the result
* fileset * fileset
*/ */
private Hashtable getResultFiles() {
private Hashtable<String, String> getResultFiles() {
FileSet resultFileSet = buildRule.getProject().getReference(RESULT_FILESET); FileSet resultFileSet = buildRule.getProject().getReference(RESULT_FILESET);
DirectoryScanner scanner = resultFileSet.getDirectoryScanner(buildRule.getProject()); DirectoryScanner scanner = resultFileSet.getDirectoryScanner(buildRule.getProject());
Hashtable<String, String> files = new Hashtable<>(); Hashtable<String, String> files = new Hashtable<>();


+ 1
- 1
src/tests/junit/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java View File

@@ -92,7 +92,7 @@ public class JUnitReportTest {
try { try {
assertTrue("This shouldn't be an empty stream.", reportStream.available() > 0); assertTrue("This shouldn't be an empty stream.", reportStream.available() > 0);
} finally { } finally {
FileUtils.getFileUtils().close(reportStream);
FileUtils.close(reportStream);
} }
} }




+ 2
- 2
src/tests/junit/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java View File

@@ -478,7 +478,7 @@ public class FTPTest {
* to parse the log output. * to parse the log output.
*/ */
private class CountLogListener extends DefaultLogger { private class CountLogListener extends DefaultLogger {
private Vector lastMatchGroups = null;
private Vector<String> lastMatchGroups = null;
private RegexpMatcher matcher = new RegexpMatcherFactory().newRegexpMatcher(); private RegexpMatcher matcher = new RegexpMatcherFactory().newRegexpMatcher();


/** /**
@@ -514,7 +514,7 @@ public class FTPTest {
if (this.lastMatchGroups == null) { if (this.lastMatchGroups == null) {
return -1; return -1;
} }
return Integer.parseInt((String) this.lastMatchGroups.get(1));
return Integer.parseInt(this.lastMatchGroups.get(1));
} }
} }




+ 1
- 1
src/tests/junit/org/apache/tools/ant/types/FilterSetTest.java View File

@@ -153,7 +153,7 @@ public class FilterSetTest {
buildRule.executeTarget("test-nested-filtersets"); buildRule.executeTarget("test-nested-filtersets");


FilterSet fs = buildRule.getProject().getReference("1"); FilterSet fs = buildRule.getProject().getReference("1");
Hashtable filters = fs.getFilterHash();
Hashtable<String, String> filters = fs.getFilterHash();
assertEquals(1, filters.size()); assertEquals(1, filters.size());
assertEquals("value1", filters.get("token1")); assertEquals("value1", filters.get("token1"));




+ 1
- 1
src/tests/junit/org/apache/tools/ant/types/MapperTest.java View File

@@ -175,7 +175,7 @@ public class MapperTest {
String[] targets = fileNameMapper.mapFileName("fromfilename"); String[] targets = fileNameMapper.mapFileName("fromfilename");
assertNotNull("no filenames mapped", targets); assertNotNull("no filenames mapped", targets);
assertEquals("wrong number of filenames mapped", 3, targets.length); assertEquals("wrong number of filenames mapped", 3, targets.length);
List list = Arrays.asList(targets);
List<String> list = Arrays.asList(targets);
assertTrue("cannot find expected target \"tofilename\"", assertTrue("cannot find expected target \"tofilename\"",
list.contains("tofilename")); list.contains("tofilename"));
assertTrue("cannot find expected target \"fromfilename\"", assertTrue("cannot find expected target \"fromfilename\"",


+ 1
- 1
src/tests/junit/org/apache/tools/ant/types/selectors/MockComparator.java View File

@@ -20,7 +20,7 @@ package org.apache.tools.ant.types.selectors;


import java.util.Comparator; import java.util.Comparator;


public class MockComparator implements Comparator {
public class MockComparator implements Comparator<Object> {


public int compare(Object o1, Object o2) { public int compare(Object o1, Object o2) {
return 0; return 0;


+ 4
- 4
src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java View File

@@ -408,7 +408,7 @@ public class ModifiedSelectorTest {
String value2 = "value2"; String value2 = "value2";


// given cache must be empty // given cache must be empty
Iterator it1 = cache.iterator();
Iterator<String> it1 = cache.iterator();
assertFalse("Cache is not empty", it1.hasNext()); assertFalse("Cache is not empty", it1.hasNext());


// cache must return a stored value // cache must return a stored value
@@ -418,8 +418,8 @@ public class ModifiedSelectorTest {
assertEquals("cache returned wrong value", value2, cache.get(key2)); assertEquals("cache returned wrong value", value2, cache.get(key2));


// test the iterator // test the iterator
Iterator it2 = cache.iterator();
Object returned = it2.next();
Iterator<String> it2 = cache.iterator();
String returned = it2.next();
boolean ok = (key1.equals(returned) || key2.equals(returned)); boolean ok = (key1.equals(returned) || key2.equals(returned));
String msg = "Iterator returned unexpected value." String msg = "Iterator returned unexpected value."
+ " key1.equals(returned)=" + key1.equals(returned) + " key1.equals(returned)=" + key1.equals(returned)
@@ -430,7 +430,7 @@ public class ModifiedSelectorTest {


// clear the cache // clear the cache
cache.delete(); cache.delete();
Iterator it3 = cache.iterator();
Iterator<String> it3 = cache.iterator();
assertFalse("Cache is not empty", it3.hasNext()); assertFalse("Cache is not empty", it3.hasNext());
} }




+ 2
- 1
src/tests/junit/org/apache/tools/ant/util/ClasspathUtilsTest.java View File

@@ -19,6 +19,7 @@
package org.apache.tools.ant.util; package org.apache.tools.ant.util;


import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.Enumeration; import java.util.Enumeration;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
@@ -46,7 +47,7 @@ public class ClasspathUtilsTest {


@Test @Test
public void testOnlyOneInstance() { public void testOnlyOneInstance() {
Enumeration enumeration;
Enumeration<URL> enumeration;
ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, null, false); ClassLoader c = ClasspathUtils.getUniqueClassLoaderForPath(p, null, false);
try { try {
enumeration = c.getResources( enumeration = c.getResources(


+ 6
- 6
src/tests/junit/org/apache/tools/ant/util/LinkedHashtableTest.java View File

@@ -46,7 +46,7 @@ public class LinkedHashtableTest {


public void testClone() { public void testClone() {
h.put(K1, V1); h.put(K1, V1);
Hashtable h2 = (Hashtable) h.clone();
Hashtable<Object, Object> h2 = (Hashtable) h.clone();
assertTrue(h2 instanceof LinkedHashtable); assertTrue(h2 instanceof LinkedHashtable);
assertTrue(h2.containsKey(K1)); assertTrue(h2.containsKey(K1));
} }
@@ -130,13 +130,13 @@ public class LinkedHashtableTest {
@Test @Test
public void testEntrySet() { public void testEntrySet() {
multiSetup(); multiSetup();
Iterator i = h.entrySet().iterator();
Iterator<Map.Entry<Object, Object>> i = h.entrySet().iterator();
assertTrue(i.hasNext()); assertTrue(i.hasNext());
Map.Entry e = (Map.Entry) i.next();
Map.Entry<Object, Object> e = i.next();
assertSame(K1, e.getKey()); assertSame(K1, e.getKey());
assertSame(V1, e.getValue()); assertSame(V1, e.getValue());
assertTrue(i.hasNext()); assertTrue(i.hasNext());
e = (Map.Entry) i.next();
e = i.next();
assertSame(K2, e.getKey()); assertSame(K2, e.getKey());
assertSame(V2, e.getValue()); assertSame(V2, e.getValue());
assertFalse(i.hasNext()); assertFalse(i.hasNext());
@@ -147,7 +147,7 @@ public class LinkedHashtableTest {
h.put(K2, V2); h.put(K2, V2);
} }


private static void assertKeys(Iterator i) {
private static void assertKeys(Iterator<Object> i) {
assertTrue(i.hasNext()); assertTrue(i.hasNext());
assertSame(K1, i.next()); assertSame(K1, i.next());
assertTrue(i.hasNext()); assertTrue(i.hasNext());
@@ -155,7 +155,7 @@ public class LinkedHashtableTest {
assertFalse(i.hasNext()); assertFalse(i.hasNext());
} }


private static void assertValues(Iterator i) {
private static void assertValues(Iterator<Object> i) {
assertTrue(i.hasNext()); assertTrue(i.hasNext());
assertSame(V1, i.next()); assertSame(V1, i.next());
assertTrue(i.hasNext()); assertTrue(i.hasNext());


+ 1
- 1
src/tests/junit/org/apache/tools/ant/util/VectorSetTest.java View File

@@ -80,7 +80,7 @@ public class VectorSetTest {
v.add(O); v.add(O);
Object o = v.clone(); Object o = v.clone();
assertTrue(o instanceof VectorSet); assertTrue(o instanceof VectorSet);
VectorSet<Object> vs = (VectorSet) o;
VectorSet<Object> vs = (VectorSet<Object>) o;
assertEquals(1, vs.size()); assertEquals(1, vs.size());
assertTrue(vs.contains(O)); assertTrue(vs.contains(O));
} }


+ 2
- 2
src/tests/junit/org/apache/tools/ant/util/regexp/RegexpMatcherTest.java View File

@@ -78,7 +78,7 @@ public abstract class RegexpMatcherTest {
@Test @Test
public void testGroups() { public void testGroups() {
reg.setPattern("aaaa"); reg.setPattern("aaaa");
Vector v = reg.getGroups("xaaaa");
Vector<String> v = reg.getGroups("xaaaa");
assertEquals("No parens -> no extra groups", 1, v.size()); assertEquals("No parens -> no extra groups", 1, v.size());
assertEquals("Trivial match with no parens", "aaaa", assertEquals("Trivial match with no parens", "aaaa",
v.elementAt(0)); v.elementAt(0));
@@ -102,7 +102,7 @@ public abstract class RegexpMatcherTest {
@Test @Test
public void testBugzillaReport14619() { public void testBugzillaReport14619() {
reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$"); reg.setPattern("^(.*)/src/((.*/)*)([a-zA-Z0-9_\\.]+)\\.java$");
Vector v = reg.getGroups("de/tom/src/Google.java");
Vector<String> v = reg.getGroups("de/tom/src/Google.java");
assertEquals(5, v.size()); assertEquals(5, v.size());
assertEquals("de/tom", v.elementAt(1)); assertEquals("de/tom", v.elementAt(1));
assertEquals("", v.elementAt(2)); assertEquals("", v.elementAt(2));


+ 5
- 5
src/tests/junit/org/apache/tools/mail/MailMessageTest.java View File

@@ -603,26 +603,26 @@ public class MailMessageTest {
try { try {
msg.from(from); msg.from(from);


Enumeration e;
Enumeration<String> e;


e = replyToList.elements(); e = replyToList.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
msg.replyto(e.nextElement().toString());
msg.replyto(e.nextElement());
} }


e = toList.elements(); e = toList.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
msg.to(e.nextElement().toString());
msg.to(e.nextElement());
} }


e = ccList.elements(); e = ccList.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
msg.cc(e.nextElement().toString());
msg.cc(e.nextElement());
} }


e = bccList.elements(); e = bccList.elements();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
msg.bcc(e.nextElement().toString());
msg.bcc(e.nextElement());
} }


if (subject != null) { if (subject != null) {


+ 2
- 2
src/tests/junit/org/apache/tools/zip/UTF8ZipFilesTest.java View File

@@ -200,9 +200,9 @@ public class UTF8ZipFilesTest {
try { try {
zf = new ZipFile(file, encoding, false); zf = new ZipFile(file, encoding, false);


Enumeration e = zf.getEntries();
Enumeration<ZipEntry> e = zf.getEntries();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
ZipEntry ze = (ZipEntry) e.nextElement();
ZipEntry ze = e.nextElement();


if (ze.getName().endsWith("sser.txt")) { if (ze.getName().endsWith("sser.txt")) {
assertUnicodeName(ze, OIL_BARREL_TXT, encoding); assertUnicodeName(ze, OIL_BARREL_TXT, encoding);


Loading…
Cancel
Save