You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by mb...@apache.org on 2012/08/21 16:27:49 UTC
svn commit: r1375571 [1/3] - in
/ant/core/trunk/src/main/org/apache/tools/ant: ./ dispatch/ filters/
filters/util/ helper/ input/ launch/ listener/ loader/ property/ taskdefs/
taskdefs/email/ types/ types/resources/ types/spi/ util/
Author: mbenson
Date: Tue Aug 21 14:27:46 2012
New Revision: 1375571
URL: http://svn.apache.org/viewvc?rev=1375571&view=rev
Log:
java 5, continued
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/Main.java
ant/core/trunk/src/main/org/apache/tools/ant/Project.java
ant/core/trunk/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContains.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/SortFilter.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/TailFilter.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/TokenFilter.java
ant/core/trunk/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
ant/core/trunk/src/main/org/apache/tools/ant/helper/AntXMLContext.java
ant/core/trunk/src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java
ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
ant/core/trunk/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
ant/core/trunk/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java
ant/core/trunk/src/main/org/apache/tools/ant/input/SecureInputHandler.java
ant/core/trunk/src/main/org/apache/tools/ant/launch/LaunchException.java
ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java
ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java
ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java
ant/core/trunk/src/main/org/apache/tools/ant/loader/AntClassLoader5.java
ant/core/trunk/src/main/org/apache/tools/ant/property/ParseProperties.java
ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Antlib.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Apt.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/BindTargets.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Checksum.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Concat.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copy.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Copydir.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Definer.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Delete.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Execute.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Expand.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/GenerateKey.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/HostInfo.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/ImportTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Input.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/JDBCTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Jar.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Java.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javac.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/KeySubst.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Length.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadProperties.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/LoadResource.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MacroInstance.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/MakeUrl.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Manifest.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Zip.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/email/Mailer.java
ant/core/trunk/src/main/org/apache/tools/ant/types/AntFilterReader.java
ant/core/trunk/src/main/org/apache/tools/ant/types/DataType.java
ant/core/trunk/src/main/org/apache/tools/ant/types/Environment.java
ant/core/trunk/src/main/org/apache/tools/ant/types/FilterChain.java
ant/core/trunk/src/main/org/apache/tools/ant/types/Path.java
ant/core/trunk/src/main/org/apache/tools/ant/types/resources/Resources.java
ant/core/trunk/src/main/org/apache/tools/ant/types/spi/Service.java
ant/core/trunk/src/main/org/apache/tools/ant/util/IdentityStack.java
ant/core/trunk/src/main/org/apache/tools/ant/util/LinkedHashtable.java
ant/core/trunk/src/main/org/apache/tools/ant/util/ReflectUtil.java
ant/core/trunk/src/main/org/apache/tools/ant/util/StringUtils.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/Main.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Main.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Main.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Main.java Tue Aug 21 14:27:46 2012
@@ -843,17 +843,19 @@ public class Main implements AntMain {
project.init();
// resolve properties
- PropertyHelper propertyHelper = (PropertyHelper) PropertyHelper
- .getPropertyHelper(project);
- HashMap<Object, Object> props = new HashMap<Object, Object>(definedProps);
+ PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(project);
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ Map raw = new HashMap(definedProps);
+ @SuppressWarnings("unchecked")
+ Map<String, Object> props = raw;
ResolvePropertyMap resolver = new ResolvePropertyMap(project,
NOPROPERTIES, propertyHelper.getExpanders());
resolver.resolveAllProperties(props, null, false);
// set user-define properties
- for (Entry<Object, Object> ent : props.entrySet()) {
- String arg = (String) ent.getKey();
+ for (Entry<String, Object> ent : props.entrySet()) {
+ String arg = ent.getKey();
Object value = ent.getValue();
project.setUserProperty(arg, String.valueOf(value));
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/Project.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/Project.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/Project.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/Project.java Tue Aug 21 14:27:46 2012
@@ -2022,7 +2022,7 @@ public class Project implements Resource
* Must not be <code>null</code>.
*
* @return the reference with the specified ID, or <code>null</code> if
- * there is no such reference in the project.
+ * there is no such reference in the project, with type inference.
*/
public <T> T getReference(String key) {
@SuppressWarnings("unchecked")
Modified: ant/core/trunk/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/dispatch/DispatchUtils.java Tue Aug 21 14:27:46 2012
@@ -58,7 +58,7 @@ public class DispatchUtils {
if (name.length() > 1) {
mName += name.substring(1);
}
- final Class c = dispatchable.getClass();
+ final Class<? extends Dispatchable> c = dispatchable.getClass();
final Method actionM = c.getMethod(mName, new Class[0]);
if (actionM != null) {
final Object o = actionM.invoke(dispatchable, (Object[]) null);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ClassConstants.java Tue Aug 21 14:27:46 2012
@@ -106,10 +106,10 @@ public final class ClassConstants
} else {
final byte[] bytes = clazz.getBytes(ResourceUtils.ISO_8859_1);
try {
- final Class javaClassHelper =
+ final Class<?> javaClassHelper =
Class.forName(JAVA_CLASS_HELPER);
if (javaClassHelper != null) {
- final Class[] params = {
+ final Class<?>[] params = {
byte[].class
};
final Method getConstants =
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java Tue Aug 21 14:27:46 2012
@@ -435,10 +435,6 @@ public final class FixCrLfFilter extends
push(cs, 0, cs.length);
}
- public void push(String s) {
- push(s.toCharArray());
- }
-
/**
* Does this filter want to block edits on the last character returned
* by read()?
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContains.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContains.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContains.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContains.java Tue Aug 21 14:27:46 2012
@@ -55,7 +55,7 @@ public final class LineContains
private static final String NEGATE_KEY = "negate";
/** Vector that holds the strings that input lines must contain. */
- private Vector contains = new Vector();
+ private Vector<String> contains = new Vector<String>();
/**
* Remaining line to be read from this filter, or <code>null</code> if
@@ -163,7 +163,7 @@ public final class LineContains
* @param contains A vector of words which must be contained within a line
* in order for it to match in this filter. Must not be <code>null</code>.
*/
- private void setContains(final Vector contains) {
+ private void setContains(final Vector<String> contains) {
this.contains = contains;
}
@@ -176,7 +176,7 @@ public final class LineContains
* returned object is "live" - in other words, changes made to the
* returned object are mirrored in the filter.
*/
- private Vector getContains() {
+ private Vector<String> getContains() {
return contains;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java Tue Aug 21 14:27:46 2012
@@ -57,7 +57,7 @@ public final class LineContainsRegExp
private static final String CS_KEY = "casesensitive";
/** Vector that holds the expressions that input lines must contain. */
- private Vector regexps = new Vector();
+ private Vector<RegularExpression> regexps = new Vector<RegularExpression>();
/**
* Remaining line to be read from this filter, or <code>null</code> if
@@ -155,7 +155,7 @@ public final class LineContainsRegExp
* within a line in order for it to match in this filter. Must not be
* <code>null</code>.
*/
- private void setRegexps(final Vector regexps) {
+ private void setRegexps(final Vector<RegularExpression> regexps) {
this.regexps = regexps;
}
@@ -169,7 +169,7 @@ public final class LineContainsRegExp
* filter. The returned object is "live" - in other words, changes made to
* the returned object are mirrored in the filter.
*/
- private Vector getRegexps() {
+ private Vector<RegularExpression> getRegexps() {
return regexps;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/ReplaceTokens.java Tue Aug 21 14:27:46 2012
@@ -70,7 +70,7 @@ public final class ReplaceTokens
private int queueIndex = -1;
/** Hashtable to hold the replacee-replacer pairs (String to String). */
- private Hashtable hash = new Hashtable();
+ private Hashtable<String, String> hash = new Hashtable<String, String>();
/** Character marking the beginning of a token. */
private char beginToken = DEFAULT_BEGIN_TOKEN;
@@ -266,7 +266,7 @@ public final class ReplaceTokens
* @param hash A map (String->String) of token keys to replacement
* values. Must not be <code>null</code>.
*/
- private void setTokens(final Hashtable hash) {
+ private void setTokens(final Hashtable<String, String> hash) {
this.hash = hash;
}
@@ -276,7 +276,7 @@ public final class ReplaceTokens
* @return a map (String->String) of token keys to replacement
* values
*/
- private Hashtable getTokens() {
+ private Hashtable<String, String> getTokens() {
return hash;
}
@@ -339,7 +339,7 @@ public final class ReplaceTokens
private void makeTokensFromProperties(Resource r) {
Properties props = getProperties(r);
- for (Enumeration e = props.keys(); e.hasMoreElements();) {
+ for (Enumeration<?> e = props.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
String value = props.getProperty(key);
hash.put(key, value);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/SortFilter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/SortFilter.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/SortFilter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/SortFilter.java Tue Aug 21 14:27:46 2012
@@ -32,11 +32,11 @@ import org.apache.tools.ant.types.Parame
* <p>
* Sort a file before and/or after the file.
* </p>
- *
+ *
* <p>
* Examples:
* </p>
- *
+ *
* <pre>
* <copy todir="build">
* <fileset dir="input" includes="*.txt"/>
@@ -45,14 +45,14 @@ import org.apache.tools.ant.types.Parame
* </filterchain>
* </copy>
* </pre>
- *
+ *
* <p>
* Sort all files <code>*.txt</code> from <i>src</i> location and copy
* them into <i>build</i> location. The lines of each file are sorted
* in ascendant order comparing the lines via the
* <code>String.compareTo(Object o)</code> method.
* </p>
- *
+ *
* <pre>
* <copy todir="build">
* <fileset dir="input" includes="*.txt"/>
@@ -61,14 +61,14 @@ import org.apache.tools.ant.types.Parame
* </filterchain>
* </copy>
* </pre>
- *
+ *
* <p>
* Sort all files <code>*.txt</code> from <i>src</i> location into reverse
* order and copy them into <i>build</i> location. If reverse parameter has
* value <code>true</code> (default value), then the output line of the files
* will be in ascendant order.
* </p>
- *
+ *
* <pre>
* <copy todir="build">
* <fileset dir="input" includes="*.txt"/>
@@ -79,7 +79,7 @@ import org.apache.tools.ant.types.Parame
* </filterchain>
* </copy>
* </pre>
- *
+ *
* <p>
* Sort all files <code>*.txt</code> from <i>src</i> location using as
* sorting criterium <code>EvenFirstCmp</code> class, that sorts the file
@@ -89,7 +89,7 @@ import org.apache.tools.ant.types.Parame
* therefore in case of inner class has to be <em>static</em>. It also has to
* implement <code>java.util.Comparator</code> interface, for example:
* </p>
- *
+ *
* <pre>
* package org.apache.tools.ant.filters;
* ...(omitted)
@@ -99,9 +99,9 @@ import org.apache.tools.ant.types.Parame
* }
* }
* </pre>
- *
+ *
* <p>The example above is equivalent to:</p>
- *
+ *
* <blockquote><pre>
* <componentdef name="evenfirst"
* classname="org.apache.tools.ant.filters.EvenFirstCmp"/>
@@ -114,10 +114,10 @@ import org.apache.tools.ant.types.Parame
* </filterchain>
* </copy>
* </pre></blockquote>
- *
+ *
* <p> If parameter <code>comparator</code> is present, then
* <code>reverse</code> parameter will not be taken into account. </p>
- *
+ *
* @since Ant 1.8.0
*/
public final class SortFilter extends BaseParamFilterReader
@@ -135,7 +135,7 @@ public final class SortFilter extends Ba
/**
* Instance of comparator class to be used for sorting.
*/
- private Comparator comparator = null;
+ private Comparator<? super String> comparator = null;
/**
* Controls if the sorting process will be in ascendant/descendant order. If
@@ -148,7 +148,7 @@ public final class SortFilter extends Ba
/**
* Stores the lines to be sorted.
*/
- private List lines;
+ private List<String> lines;
/**
* Remaining line to be read from this filter, or <code>null</code> if the
@@ -157,11 +157,11 @@ public final class SortFilter extends Ba
*/
private String line = null;
- private Iterator iterator = null;
+ private Iterator<String> iterator = null;
/**
* Constructor for "dummy" instances.
- *
+ *
* @see BaseFilterReader#BaseFilterReader()
*/
public SortFilter() {
@@ -170,7 +170,7 @@ public final class SortFilter extends Ba
/**
* Creates a new filtered reader.
- *
+ *
* @param in
* A Reader object providing the underlying stream. Must not be
* <code>null</code>.
@@ -184,10 +184,10 @@ public final class SortFilter extends Ba
* of lines have already been read, the resulting stream is effectively at
* an end. Otherwise, the next character from the underlying stream is read
* and returned.
- *
+ *
* @return the next character in the resulting stream, or -1 if the end of
* the resulting stream has been reached
- *
+ *
* @exception IOException
* if the underlying stream throws an IOException during
* reading
@@ -213,7 +213,7 @@ public final class SortFilter extends Ba
} else {
if (lines == null) {
// We read all lines and sort them
- lines = new ArrayList();
+ lines = new ArrayList<String>();
for (line = readLine(); line != null; line = readLine()) {
lines.add(line);
}
@@ -237,11 +237,11 @@ public final class SortFilter extends Ba
/**
* Creates a new SortReader using the passed in Reader for instantiation.
- *
+ *
* @param rdr
* A Reader object providing the underlying stream. Must not be
* <code>null</code>.
- *
+ *
* @return a new filter based on this configuration, but filtering the
* specified reader
*/
@@ -256,7 +256,7 @@ public final class SortFilter extends Ba
/**
* Returns <code>true</code> if the sorting process will be in reverse
* order, otherwise the sorting process will be in ascendant order.
- *
+ *
* @return <code>true</code> if the sorting process will be in reverse
* order, otherwise the sorting process will be in ascendant order.
*/
@@ -267,7 +267,7 @@ public final class SortFilter extends Ba
/**
* Sets the sorting process will be in ascendant (<code>reverse=false</code>)
* or to descendant (<code>reverse=true</code>).
- *
+ *
* @param reverse
* Boolean representing reverse ordering process.
*/
@@ -277,30 +277,30 @@ public final class SortFilter extends Ba
/**
* Returns the comparator to be used for sorting.
- *
+ *
* @return the comparator
*/
- public Comparator getComparator() {
+ public Comparator<? super String> getComparator() {
return comparator;
}
/**
* Set the comparator to be used as sorting criterium.
- *
+ *
* @param comparator
* the comparator to set
*/
- public void setComparator(Comparator comparator) {
+ public void setComparator(Comparator<? super String> comparator) {
this.comparator = comparator;
}
/**
- * Set the comparator to be used as sorting criterium as nested element.
- *
+ * Set the comparator to be used as sorting criterion as nested element.
+ *
* @param comparator
* the comparator to set
*/
- public void add(Comparator comparator) {
+ public void add(Comparator<? super String> comparator) {
if (this.comparator != null && comparator != null) {
throw new BuildException("can't have more than one comparator");
}
@@ -324,8 +324,10 @@ public final class SortFilter extends Ba
if (COMPARATOR_KEY.equals(paramName)) {
try {
String className = (String) params[i].getValue();
- setComparator((Comparator) (Class.forName(className)
- .newInstance()));
+ @SuppressWarnings("unchecked")
+ final Comparator<? super String> comparatorInstance = (Comparator<? super String>) (Class
+ .forName(className).newInstance());
+ setComparator(comparatorInstance);
continue;
} catch (InstantiationException e) {
throw new BuildException(e);
@@ -353,15 +355,13 @@ public final class SortFilter extends Ba
/**
* Sorts the read lines (<code>lines</code>)acording to the sorting
* criteria defined by the user.
- *
+ *
*/
private void sort() {
if (comparator == null) {
if (reverse) {
- Collections.sort(lines, new Comparator() {
- public int compare(Object o1, Object o2) {
- String s1 = (String) o1;
- String s2 = (String) o2;
+ Collections.sort(lines, new Comparator<String>() {
+ public int compare(String s1, String s2) {
return (-s1.compareTo(s2));
}
});
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/StripLineComments.java Tue Aug 21 14:27:46 2012
@@ -54,7 +54,7 @@ public final class StripLineComments
private static final String COMMENTS_KEY = "comment";
/** Vector that holds the comment prefixes. */
- private Vector comments = new Vector();
+ private Vector<String> comments = new Vector<String>();
/** The line that has been read ahead. */
private String line = null;
@@ -110,7 +110,7 @@ public final class StripLineComments
while (line != null) {
for (int i = 0; i < commentsSize; i++) {
- String comment = (String) comments.elementAt(i);
+ String comment = comments.elementAt(i);
if (line.startsWith(comment)) {
line = null;
break;
@@ -149,7 +149,7 @@ public final class StripLineComments
* @param comments A list of strings, each of which is a prefix
* for a comment line. Must not be <code>null</code>.
*/
- private void setComments(final Vector comments) {
+ private void setComments(final Vector<String> comments) {
this.comments = comments;
}
@@ -158,7 +158,7 @@ public final class StripLineComments
*
* @return the list of comment prefixes to strip.
*/
- private Vector getComments() {
+ private Vector<String> getComments() {
return comments;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/TailFilter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/TailFilter.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/TailFilter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/TailFilter.java Tue Aug 21 14:27:46 2012
@@ -65,7 +65,7 @@ public final class TailFilter extends Ba
/** the position in the current line */
private int linePos = 0;
- private LinkedList lineList = new LinkedList();
+ private LinkedList<String> lineList = new LinkedList<String>();
/**
* Constructor for "dummy" instances.
@@ -212,7 +212,7 @@ public final class TailFilter extends Ba
lineList.add(line);
if (lines == -1) {
if (lineList.size() > skip) {
- return (String) lineList.removeFirst();
+ return lineList.removeFirst();
}
} else {
long linesToKeep = lines + (skip > 0 ? skip : 0);
@@ -235,7 +235,7 @@ public final class TailFilter extends Ba
}
}
if (lineList.size() > 0) {
- return (String) lineList.removeFirst();
+ return lineList.removeFirst();
}
return null;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/TokenFilter.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/TokenFilter.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/TokenFilter.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/TokenFilter.java Tue Aug 21 14:27:46 2012
@@ -58,7 +58,7 @@ public class TokenFilter extends BaseFil
/** string filters */
- private Vector filters = new Vector();
+ private Vector<Filter> filters = new Vector<Filter>();
/** the tokenizer to use on the input stream */
private Tokenizer tokenizer = null;
/** the output token termination */
@@ -109,8 +109,8 @@ public class TokenFilter extends BaseFil
if (line == null) {
return -1;
}
- for (Enumeration e = filters.elements(); e.hasMoreElements();) {
- Filter filter = (Filter) e.nextElement();
+ for (Enumeration<Filter> e = filters.elements(); e.hasMoreElements();) {
+ Filter filter = e.nextElement();
line = filter.filter(line);
if (line == null) {
break;
Modified: ant/core/trunk/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java Tue Aug 21 14:27:46 2012
@@ -60,7 +60,7 @@ public final class ChainReaderHelper {
/**
* Chain of filters
*/
- public Vector filterChains = new Vector();
+ public Vector<FilterChain> filterChains = new Vector<FilterChain>();
/** The Ant project */
private Project project = null;
@@ -106,7 +106,7 @@ public final class ChainReaderHelper {
*
* @param fchain the filter chains collection
*/
- public void setFilterChains(Vector fchain) {
+ public void setFilterChains(Vector<FilterChain> fchain) {
filterChains = fchain;
}
@@ -122,14 +122,14 @@ public final class ChainReaderHelper {
Reader instream = primaryReader;
final int filterReadersCount = filterChains.size();
- final Vector finalFilters = new Vector();
- final ArrayList/*<AntClassLoader>*/ classLoadersToCleanUp =
- new ArrayList/*<AntClassLoader>*/();
+ final Vector<Object> finalFilters = new Vector<Object>();
+ final ArrayList<AntClassLoader> classLoadersToCleanUp =
+ new ArrayList<AntClassLoader>();
for (int i = 0; i < filterReadersCount; i++) {
final FilterChain filterchain =
- (FilterChain) filterChains.elementAt(i);
- final Vector filterReaders = filterchain.getFilterReaders();
+ filterChains.elementAt(i);
+ final Vector<Object> filterReaders = filterchain.getFilterReaders();
final int readerCount = filterReaders.size();
for (int j = 0; j < readerCount; j++) {
finalFilters.addElement(filterReaders.elementAt(j));
@@ -197,9 +197,9 @@ public final class ChainReaderHelper {
/**
* Deregisters Classloaders from the project so GC can remove them later.
*/
- private static void cleanUpClassLoaders(List/*<AntClassLoader>*/ loaders) {
- for (Iterator it = loaders.iterator(); it.hasNext(); ) {
- ((AntClassLoader) it.next()).cleanup();
+ private static void cleanUpClassLoaders(List<AntClassLoader> loaders) {
+ for (Iterator<AntClassLoader> it = loaders.iterator(); it.hasNext(); ) {
+ it.next().cleanup();
}
}
@@ -223,13 +223,13 @@ public final class ChainReaderHelper {
*/
private Reader expandReader(final AntFilterReader filter,
final Reader ancestor,
- final List/*<AntClassLoader>*/ classLoadersToCleanUp) {
+ final List<AntClassLoader> classLoadersToCleanUp) {
final String className = filter.getClassName();
final Path classpath = filter.getClasspath();
final Project pro = filter.getProject();
if (className != null) {
try {
- Class clazz = null;
+ Class<?> clazz = null;
if (classpath == null) {
clazz = Class.forName(className);
} else {
@@ -242,11 +242,11 @@ public final class ChainReaderHelper {
throw new BuildException(className + " does not extend"
+ " java.io.FilterReader");
}
- final Constructor[] constructors = clazz.getConstructors();
+ final Constructor<?>[] constructors = clazz.getConstructors();
int j = 0;
boolean consPresent = false;
for (; j < constructors.length; j++) {
- Class[] types = constructors[j].getParameterTypes();
+ Class<?>[] types = constructors[j].getParameterTypes();
if (types.length == 1
&& types[0].isAssignableFrom(Reader.class)) {
consPresent = true;
Modified: ant/core/trunk/src/main/org/apache/tools/ant/helper/AntXMLContext.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/helper/AntXMLContext.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/helper/AntXMLContext.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/helper/AntXMLContext.java Tue Aug 21 14:27:46 2012
@@ -54,7 +54,7 @@ public class AntXMLContext {
* defined. Project maintains a Hashtable, which is not ordered.
* This will allow description to know the original order.
*/
- private Vector targetVector = new Vector();
+ private Vector<Target> targetVector = new Vector<Target>();
/**
* Parent directory of the build file. Used for resolving entities
@@ -92,7 +92,7 @@ public class AntXMLContext {
/** The stack of RuntimeConfigurable2 wrapping the
objects.
*/
- private Vector wStack = new Vector();
+ private Vector<RuntimeConfigurable> wStack = new Vector<RuntimeConfigurable>();
/**
* Indicates whether the project tag attributes are to be ignored
@@ -101,11 +101,11 @@ public class AntXMLContext {
private boolean ignoreProjectTag = false;
/** Keeps track of prefix -> uri mapping during parsing */
- private Map prefixMapping = new HashMap();
+ private Map<String, List<String>> prefixMapping = new HashMap<String, List<String>>();
/** Keeps track of targets in files */
- private Map currentTargets = null;
+ private Map<String, Target> currentTargets = null;
/**
* constructor
@@ -253,7 +253,7 @@ public class AntXMLContext {
* access the stack of wrappers
* @return the stack of wrappers
*/
- public Vector getWrapperStack() {
+ public Vector<RuntimeConfigurable> getWrapperStack() {
return wStack;
}
@@ -302,7 +302,7 @@ public class AntXMLContext {
* access the vector of targets
* @return vector of targets
*/
- public Vector getTargets() {
+ public Vector<Target> getTargets() {
return targetVector;
}
@@ -362,9 +362,9 @@ public class AntXMLContext {
* @param uri a namespace uri
*/
public void startPrefixMapping(String prefix, String uri) {
- List list = (List) prefixMapping.get(prefix);
+ List<String> list = prefixMapping.get(prefix);
if (list == null) {
- list = new ArrayList();
+ list = new ArrayList<String>();
prefixMapping.put(prefix, list);
}
list.add(uri);
@@ -376,7 +376,7 @@ public class AntXMLContext {
* @param prefix the namespace prefix
*/
public void endPrefixMapping(String prefix) {
- List list = (List) prefixMapping.get(prefix);
+ List<String> list = prefixMapping.get(prefix);
if (list == null || list.size() == 0) {
return; // Should not happen
}
@@ -390,7 +390,7 @@ public class AntXMLContext {
* @return the uri for this prefix, null if not present
*/
public String getPrefixMapping(String prefix) {
- List list = (List) prefixMapping.get(prefix);
+ List<String> list = prefixMapping.get(prefix);
if (list == null || list.size() == 0) {
return null;
}
@@ -401,7 +401,7 @@ public class AntXMLContext {
* Get the targets in the current source file.
* @return the current targets.
*/
- public Map getCurrentTargets() {
+ public Map<String, Target> getCurrentTargets() {
return currentTargets;
}
@@ -409,7 +409,7 @@ public class AntXMLContext {
* Set the map of the targets in the current source file.
* @param currentTargets a map of targets.
*/
- public void setCurrentTargets(Map currentTargets) {
+ public void setCurrentTargets(Map<String, Target> currentTargets) {
this.currentTargets = currentTargets;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java Tue Aug 21 14:27:46 2012
@@ -40,11 +40,11 @@ public class IgnoreDependenciesExecutor
/** {@inheritDoc}. */
public void executeTargets(Project project, String[] targetNames)
throws BuildException {
- Hashtable targets = project.getTargets();
+ Hashtable<String, Target> targets = project.getTargets();
BuildException thrownException = null;
for (int i = 0; i < targetNames.length; i++) {
try {
- Target t = (Target) targets.get(targetNames[i]);
+ Target t = targets.get(targetNames[i]);
if (t == null) {
throw new BuildException("Unknown target " + targetNames[i]);
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelper2.java Tue Aug 21 14:27:46 2012
@@ -50,7 +50,6 @@ import java.io.UnsupportedEncodingExcept
import java.net.URL;
import java.util.HashMap;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Map;
import java.util.Stack;
@@ -157,13 +156,13 @@ public class ProjectHelper2 extends Proj
context.setIgnoreProjectTag(true);
Target currentTarget = context.getCurrentTarget();
Target currentImplicit = context.getImplicitTarget();
- Map currentTargets = context.getCurrentTargets();
+ Map<String, Target> currentTargets = context.getCurrentTargets();
try {
Target newCurrent = new Target();
newCurrent.setProject(project);
newCurrent.setName("");
context.setCurrentTarget(newCurrent);
- context.setCurrentTargets(new HashMap());
+ context.setCurrentTargets(new HashMap<String, Target>());
context.setImplicitTarget(newCurrent);
parse(project, source, new RootHandler(context, mainHandler));
newCurrent.execute();
@@ -174,7 +173,7 @@ public class ProjectHelper2 extends Proj
}
} else {
// top level file
- context.setCurrentTargets(new HashMap());
+ context.setCurrentTargets(new HashMap<String, Target>());
parse(project, source, new RootHandler(context, mainHandler));
// Execute the top-level target
context.getImplicitTarget().execute();
@@ -485,7 +484,7 @@ public class ProjectHelper2 extends Proj
* with the implicit execution stack )
*/
public static class RootHandler extends DefaultHandler {
- private Stack antHandlers = new Stack();
+ private Stack<AntHandler> antHandlers = new Stack<AntHandler>();
private AntHandler currentHandler = null;
private AntXMLContext context;
@@ -962,7 +961,7 @@ public class ProjectHelper2 extends Proj
throw new BuildException("Duplicate target '" + name + "'",
target.getLocation());
}
- Hashtable projectTargets = project.getTargets();
+ Hashtable<String, Target> projectTargets = project.getTargets();
boolean usedTarget = false;
// If the name has not already been defined define it
if (projectTargets.containsKey(name)) {
@@ -979,12 +978,9 @@ public class ProjectHelper2 extends Proj
if (!isInIncludeMode) {
target.setDepends(depends);
} else {
- for (Iterator iter =
- Target.parseDepends(depends, name, "depends")
- .iterator();
- iter.hasNext(); ) {
- target.addDependency(prefix + sep + iter.next());
- }
+ for (String string : Target.parseDepends(depends, name, "depends")) {
+ target.addDependency(prefix + sep + string);
+ }
}
}
if (!isInIncludeMode && context.isIgnoringProjectTag()
@@ -1003,7 +999,7 @@ public class ProjectHelper2 extends Proj
}
if (extensionPointMissing != null && extensionPoint == null) {
throw new BuildException("onMissingExtensionPoint attribute cannot " +
- "be specified unless extensionOf is specified",
+ "be specified unless extensionOf is specified",
target.getLocation());
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java Tue Aug 21 14:27:46 2012
@@ -855,7 +855,7 @@ public class ProjectHelperImpl extends P
* BuildException being thrown during configuration.
*/
public void init(String propType, AttributeList attrs) throws SAXParseException {
- Class parentClass = parent.getClass();
+ Class<?> parentClass = parent.getClass();
IntrospectionHelper ih = IntrospectionHelper.getHelper(helperImpl.project, parentClass);
try {
Modified: ant/core/trunk/src/main/org/apache/tools/ant/input/DefaultInputHandler.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/input/DefaultInputHandler.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/input/DefaultInputHandler.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/input/DefaultInputHandler.java Tue Aug 21 14:27:46 2012
@@ -22,7 +22,6 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.util.Enumeration;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.util.KeepAliveInputStream;
@@ -86,16 +85,12 @@ public class DefaultInputHandler impleme
String prompt = request.getPrompt();
String def = request.getDefaultValue();
if (request instanceof MultipleChoiceInputRequest) {
- StringBuffer sb = new StringBuffer(prompt);
- sb.append(" (");
- Enumeration e =
- ((MultipleChoiceInputRequest) request).getChoices().elements();
+ StringBuilder sb = new StringBuilder(prompt).append(" (");
boolean first = true;
- while (e.hasMoreElements()) {
+ for (String next : ((MultipleChoiceInputRequest) request).getChoices()) {
if (!first) {
sb.append(", ");
}
- String next = (String) e.nextElement();
if (next.equals(def)) {
sb.append('[');
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/input/MultipleChoiceInputRequest.java Tue Aug 21 14:27:46 2012
@@ -27,26 +27,26 @@ import java.util.Vector;
* @since Ant 1.5
*/
public class MultipleChoiceInputRequest extends InputRequest {
- private final LinkedHashSet choices;
+ private final LinkedHashSet<String> choices;
/**
* @param prompt The prompt to show to the user. Must not be null.
* @param choices holds all input values that are allowed.
* Must not be null.
*/
- public MultipleChoiceInputRequest(String prompt, Vector choices) {
+ public MultipleChoiceInputRequest(String prompt, Vector<String> choices) {
super(prompt);
if (choices == null) {
throw new IllegalArgumentException("choices must not be null");
}
- this.choices = new LinkedHashSet(choices);
+ this.choices = new LinkedHashSet<String>(choices);
}
/**
* @return The possible values.
*/
- public Vector getChoices() {
- return new Vector(choices);
+ public Vector<String> getChoices() {
+ return new Vector<String>(choices);
}
/**
Modified: ant/core/trunk/src/main/org/apache/tools/ant/input/SecureInputHandler.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/input/SecureInputHandler.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/input/SecureInputHandler.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/input/SecureInputHandler.java Tue Aug 21 14:27:46 2012
@@ -42,8 +42,7 @@ public class SecureInputHandler extends
public void handleInput(InputRequest request) throws BuildException {
String prompt = getPrompt(request);
try {
- Class system = Class.forName("java.lang.System");
- Object console = ReflectUtil.invokeStatic(system, "console");
+ Object console = ReflectUtil.invokeStatic(System.class, "console");
do {
char[] input = (char[]) ReflectUtil.invoke(
console, "readPassword", String.class, prompt,
Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/LaunchException.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/LaunchException.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/LaunchException.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/LaunchException.java Tue Aug 21 14:27:46 2012
@@ -23,6 +23,7 @@ package org.apache.tools.ant.launch;
* @since Ant 1.6
*/
public class LaunchException extends Exception {
+ private static final long serialVersionUID = 1L;
/**
* Constructs an exception with the given descriptive message.
Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Launcher.java Tue Aug 21 14:27:46 2012
@@ -24,7 +24,6 @@ import java.io.File;
import java.util.StringTokenizer;
import java.util.List;
import java.util.ArrayList;
-import java.util.Iterator;
@@ -133,7 +132,7 @@ public class Launcher {
* @param libPathURLs the list of paths to add to
* @throws MalformedURLException if we can't create a URL
*/
- private void addPath(String path, boolean getJars, List libPathURLs)
+ private void addPath(String path, boolean getJars, List<URL> libPathURLs)
throws MalformedURLException {
StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator);
while (tokenizer.hasMoreElements()) {
@@ -190,9 +189,9 @@ public class Launcher {
+ "ant could not be located (estimated value="+antHome.getAbsolutePath()+")");
}
- List libPaths = new ArrayList();
+ List<String> libPaths = new ArrayList<String>();
String cpString = null;
- List argList = new ArrayList();
+ List<String> argList = new ArrayList<String>();
String[] newArgs;
boolean noUserLib = false;
boolean noClassPath = false;
@@ -271,7 +270,7 @@ public class Launcher {
URLClassLoader loader = new URLClassLoader(jars, Launcher.class.getClassLoader());
Thread.currentThread().setContextClassLoader(loader);
- Class mainClass = null;
+ Class<?> mainClass = null;
int exitCode = 0;
Throwable thrown=null;
try {
@@ -311,20 +310,19 @@ public class Launcher {
* @return an array of URLs.
* @throws MalformedURLException if the URLs cannot be created.
*/
- private URL[] getLibPathURLs(String cpString, List libPaths)
+ private URL[] getLibPathURLs(String cpString, List<String> libPaths)
throws MalformedURLException {
- List libPathURLs = new ArrayList();
+ List<URL> libPathURLs = new ArrayList<URL>();
if (cpString != null) {
addPath(cpString, false, libPathURLs);
}
- for (Iterator i = libPaths.iterator(); i.hasNext();) {
- String libPath = (String) i.next();
+ for (String libPath : libPaths) {
addPath(libPath, true, libPathURLs);
}
- return (URL[]) libPathURLs.toArray(new URL[libPathURLs.size()]);
+ return libPathURLs.toArray(new URL[libPathURLs.size()]);
}
/**
Modified: ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/launch/Locator.java Tue Aug 21 14:27:46 2012
@@ -113,7 +113,7 @@ public final class Locator {
*
* @since Ant 1.6
*/
- public static File getClassSource(Class c) {
+ public static File getClassSource(Class<?> c) {
String classResource = c.getName().replace('.', '/') + ".class";
return getResourceSource(c.getClassLoader(), classResource);
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/listener/MailLogger.java Tue Aug 21 14:27:46 2012
@@ -17,6 +17,7 @@
*/
package org.apache.tools.ant.listener;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -32,6 +33,7 @@ import org.apache.tools.ant.BuildExcepti
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.email.EmailAddress;
+import org.apache.tools.ant.taskdefs.email.Header;
import org.apache.tools.ant.taskdefs.email.Message;
import org.apache.tools.ant.taskdefs.email.Mailer;
import org.apache.tools.ant.util.ClasspathUtils;
@@ -100,7 +102,7 @@ public class MailLogger extends DefaultL
super.buildFinished(event);
Project project = event.getProject();
- Hashtable properties = project.getProperties();
+ Hashtable<String, Object> properties = project.getProperties();
// overlay specified properties file (if any), which overrides project
// settings
@@ -118,7 +120,7 @@ public class MailLogger extends DefaultL
}
}
- for (Enumeration e = fileProperties.keys(); e.hasMoreElements();) {
+ for (Enumeration<?> e = fileProperties.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
String value = fileProperties.getProperty(key);
properties.put(key, project.replaceProperties(value));
@@ -298,7 +300,7 @@ public class MailLogger extends DefaultL
* @exception Exception thrown if no default value is specified and the
* property is not present in properties.
*/
- private String getValue(Hashtable properties, String name,
+ private String getValue(Hashtable<String, Object> properties, String name,
String defaultValue) throws Exception {
String propertyName = "MailLogger." + name;
String value = (String) properties.get(propertyName);
@@ -371,7 +373,7 @@ public class MailLogger extends DefaultL
return;
}
// convert the replyTo string into a vector of emailaddresses
- Vector replyToList = vectorizeEmailAddresses(values.replytoList());
+ Vector<EmailAddress> replyToList = vectorizeEmailAddresses(values.replytoList());
mailer.setHost(values.mailhost());
mailer.setPort(values.port());
mailer.setUser(values.user());
@@ -388,17 +390,17 @@ public class MailLogger extends DefaultL
mailer.setMessage(mymessage);
mailer.setFrom(new EmailAddress(values.from()));
mailer.setReplyToList(replyToList);
- Vector toList = vectorizeEmailAddresses(values.toList());
+ Vector<EmailAddress> toList = vectorizeEmailAddresses(values.toList());
mailer.setToList(toList);
- mailer.setCcList(new Vector());
- mailer.setBccList(new Vector());
- mailer.setFiles(new Vector());
+ mailer.setCcList(new Vector<EmailAddress>());
+ mailer.setBccList(new Vector<EmailAddress>());
+ mailer.setFiles(new Vector<File>());
mailer.setSubject(values.subject());
- mailer.setHeaders(new Vector());
+ mailer.setHeaders(new Vector<Header>());
mailer.send();
}
- private Vector vectorizeEmailAddresses(String listString) {
- Vector emailList = new Vector();
+ private Vector<EmailAddress> vectorizeEmailAddresses(String listString) {
+ Vector<EmailAddress> emailList = new Vector<EmailAddress>();
StringTokenizer tokens = new StringTokenizer(listString, ",");
while (tokens.hasMoreTokens()) {
emailList.addElement(new EmailAddress(tokens.nextToken()));
Modified: ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/listener/ProfileLogger.java Tue Aug 21 14:27:46 2012
@@ -32,7 +32,7 @@ import org.apache.tools.ant.util.StringU
*/
public class ProfileLogger extends DefaultLogger {
- private Map profileData = new HashMap(); // <Object, Date>
+ private Map<Object, Date> profileData = new HashMap<Object, Date>();
/**
* Logs a message to say that the target has started.
Modified: ant/core/trunk/src/main/org/apache/tools/ant/loader/AntClassLoader5.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/loader/AntClassLoader5.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/loader/AntClassLoader5.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/loader/AntClassLoader5.java Tue Aug 21 14:27:46 2012
@@ -21,6 +21,8 @@ package org.apache.tools.ant.loader;
import java.util.Enumeration;
import java.io.Closeable;
import java.io.IOException;
+import java.net.URL;
+
import org.apache.tools.ant.AntClassLoader;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Path;
@@ -52,7 +54,7 @@ public class AntClassLoader5 extends Ant
}
/** {@inheritDoc} */
- public Enumeration getResources(String name) throws IOException {
+ public Enumeration<URL> getResources(String name) throws IOException {
return getNamedResources(name);
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/property/ParseProperties.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/property/ParseProperties.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/property/ParseProperties.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/property/ParseProperties.java Tue Aug 21 14:27:46 2012
@@ -19,7 +19,6 @@ package org.apache.tools.ant.property;
import java.text.ParsePosition;
import java.util.Collection;
-import java.util.Iterator;
import org.apache.tools.ant.Project;
/**
@@ -31,7 +30,7 @@ public class ParseProperties implements
private final Project project;
private final GetProperty getProperty;
- private final Collection expanders;
+ private final Collection<PropertyExpander> expanders;
/**
* Constructor with a getProperty.
@@ -39,7 +38,7 @@ public class ParseProperties implements
* @param expanders a sequence of expanders
* @param getProperty property resolver.
*/
- public ParseProperties(Project project, Collection expanders, GetProperty getProperty) {
+ public ParseProperties(Project project, Collection<PropertyExpander> expanders, GetProperty getProperty) {
this.project = project;
this.expanders = expanders;
this.getProperty = getProperty;
@@ -183,9 +182,8 @@ public class ParseProperties implements
}
private String parsePropertyName(String value, ParsePosition pos) {
- for (Iterator iter = expanders.iterator(); iter.hasNext();) {
- String propertyName = ((PropertyExpander) iter.next())
- .parsePropertyName(value, pos, this);
+ for (PropertyExpander propertyExpander : expanders) {
+ String propertyName = propertyExpander.parsePropertyName(value, pos, this);
if (propertyName == null) {
continue;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/property/ResolvePropertyMap.java Tue Aug 21 14:27:46 2012
@@ -17,7 +17,6 @@
*/
package org.apache.tools.ant.property;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.HashSet;
@@ -31,10 +30,10 @@ import org.apache.tools.ant.BuildExcepti
* @since Ant 1.8.0
*/
public class ResolvePropertyMap implements GetProperty {
- private final Set seen = new HashSet();
+ private final Set<String> seen = new HashSet<String>();
private final ParseProperties parseProperties;
private final GetProperty master;
- private Map map;
+ private Map<String, Object> map;
private String prefix;
// whether properties of the value side of the map should be
// expanded
@@ -49,7 +48,7 @@ public class ResolvePropertyMap implemen
* @param master the master property holder (usually PropertyHelper)
* @param expanders a collection of expanders (usually from PropertyHelper).
*/
- public ResolvePropertyMap(Project project, GetProperty master, Collection expanders) {
+ public ResolvePropertyMap(Project project, GetProperty master, Collection<PropertyExpander> expanders) {
this.master = master;
this.parseProperties = new ParseProperties(project, expanders, this);
}
@@ -102,7 +101,7 @@ public class ResolvePropertyMap implemen
* @param map the map to resolve properties in.
* @deprecated since Ant 1.8.2, use the three-arg method instead.
*/
- public void resolveAllProperties(Map map) {
+ public void resolveAllProperties(Map<String, Object> map) {
resolveAllProperties(map, null, false);
}
@@ -113,7 +112,7 @@ public class ResolvePropertyMap implemen
* will finally receive - may be null.
* @deprecated since Ant 1.8.2, use the three-arg method instead.
*/
- public void resolveAllProperties(Map map, String prefix) {
+ public void resolveAllProperties(Map<String, Object> map, String prefix) {
resolveAllProperties(map, null, false);
}
@@ -125,7 +124,7 @@ public class ResolvePropertyMap implemen
* @param prefixValues - whether the prefix will be applied
* to properties on the value side of the map as well.
*/
- public void resolveAllProperties(Map map, String prefix,
+ public void resolveAllProperties(Map<String, Object> map, String prefix,
boolean prefixValues) {
// The map, prefix and prefixValues flag get used in the
// getProperty callback
@@ -133,9 +132,8 @@ public class ResolvePropertyMap implemen
this.prefix = prefix;
this.prefixValues = prefixValues;
- for (Iterator i = map.keySet().iterator(); i.hasNext();) {
+ for (String key : map.keySet()) {
expandingLHS = true;
- String key = (String) i.next();
Object result = getProperty(key);
String value = result == null ? "" : result.toString();
map.put(key, value);
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java Tue Aug 21 14:27:46 2012
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -55,10 +54,10 @@ public abstract class AbstractCvsTask ex
private Commandline cmd = new Commandline();
- private ArrayList modules = new ArrayList();
+ private ArrayList<Module> modules = new ArrayList<Module>();
/** list of Commandline children */
- private Vector vecCommandlines = new Vector();
+ private Vector<Commandline> vecCommandlines = new Vector<Commandline>();
/**
* the CVSROOT variable.
@@ -769,8 +768,7 @@ public abstract class AbstractCvsTask ex
if (cvsPackage != null) {
c.createArgument().setLine(cvsPackage);
}
- for (Iterator iter = modules.iterator(); iter.hasNext(); ) {
- Module m = (Module) iter.next();
+ for (Module m : modules) {
c.createArgument().setValue(m.getName());
}
if (this.compression > 0
@@ -855,8 +853,10 @@ public abstract class AbstractCvsTask ex
modules.add(m);
}
- protected List getModules() {
- return (List) modules.clone();
+ protected List<Module> getModules() {
+ @SuppressWarnings("unchecked")
+ final List<Module> clone = (List<Module>) modules.clone();
+ return clone;
}
public static final class Module {
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java Tue Aug 21 14:27:46 2012
@@ -19,7 +19,6 @@
package org.apache.tools.ant.taskdefs;
import java.io.File;
-import java.util.Enumeration;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
@@ -74,7 +73,7 @@ public abstract class AbstractJarSignerT
/**
* the filesets of the jars to sign
*/
- protected Vector filesets = new Vector();
+ protected Vector<FileSet> filesets = new Vector<FileSet>();
/**
* name of JDK program we are looking for
*/
@@ -291,10 +290,7 @@ public abstract class AbstractJarSignerT
}
//now patch in all system properties
- Vector props = sysProperties.getVariablesVector();
- Enumeration e = props.elements();
- while (e.hasMoreElements()) {
- Environment.Variable variable = (Environment.Variable) e.nextElement();
+ for (Environment.Variable variable : sysProperties.getVariablesVector()) {
declareSysProperty(cmd, variable);
}
}
@@ -358,8 +354,9 @@ public abstract class AbstractJarSignerT
* fileset, if is defined
* @return a vector of FileSet instances
*/
- protected Vector createUnifiedSources() {
- Vector sources = (Vector) filesets.clone();
+ protected Vector<FileSet> createUnifiedSources() {
+ @SuppressWarnings("unchecked")
+ Vector<FileSet> sources = (Vector<FileSet>) filesets.clone();
if (jar != null) {
//we create a fileset with the source file.
//this lets us combine our logic for handling output directories,
@@ -382,10 +379,8 @@ public abstract class AbstractJarSignerT
*/
protected Path createUnifiedSourcePath() {
Path p = path == null ? new Path(getProject()) : (Path) path.clone();
- Vector s = createUnifiedSources();
- Enumeration e = s.elements();
- while (e.hasMoreElements()) {
- p.add((FileSet) e.nextElement());
+ for (FileSet fileSet : createUnifiedSources()) {
+ p.add(fileSet);
}
return p;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Ant.java Tue Aug 21 14:27:46 2012
@@ -87,10 +87,10 @@ public class Ant extends Task {
private boolean inheritRefs = false;
/** the properties to pass to the new project */
- private Vector properties = new Vector();
+ private Vector<Property> properties = new Vector<Property>();
/** the references to pass to the new project */
- private Vector references = new Vector();
+ private Vector<Reference> references = new Vector<Reference>();
/** the temporary project created to run the build file */
private Project newProject;
@@ -99,10 +99,10 @@ public class Ant extends Task {
private PrintStream out = null;
/** the sets of properties to pass to the new project */
- private Vector propertySets = new Vector();
+ private Vector<PropertySet> propertySets = new Vector<PropertySet>();
/** the targets to call on the new project */
- private Vector targets = new Vector();
+ private Vector<String> targets = new Vector<String>();
/** whether the target attribute was specified **/
private boolean targetAttributeSet = false;
@@ -192,7 +192,7 @@ public class Ant extends Task {
private void initializeProject() {
newProject.setInputHandler(getProject().getInputHandler());
- Iterator iter = getBuildListeners();
+ Iterator<BuildListener> iter = getBuildListeners();
while (iter.hasNext()) {
newProject.addBuildListener((BuildListener) iter.next());
}
@@ -232,9 +232,7 @@ public class Ant extends Task {
addAlmostAll(getProject().getProperties(), PropertyType.PLAIN);
}
- Enumeration e = propertySets.elements();
- while (e.hasMoreElements()) {
- PropertySet ps = (PropertySet) e.nextElement();
+ for (PropertySet ps : propertySets) {
addAlmostAll(ps.getProperties(), PropertyType.PLAIN);
}
}
@@ -334,7 +332,7 @@ public class Ant extends Task {
public void execute() throws BuildException {
File savedDir = dir;
String savedAntFile = antFile;
- Vector locals = new VectorSet(targets);
+ Vector<String> locals = new VectorSet<String>(targets);
try {
getNewProject();
@@ -414,10 +412,10 @@ public class Ant extends Task {
+ "its own parent target.");
}
boolean circular = false;
- for (Iterator it = locals.iterator();
+ for (Iterator<String> it = locals.iterator();
!circular && it.hasNext();) {
Target other =
- (Target) (getProject().getTargets().get(it.next()));
+ getProject().getTargets().get(it.next());
circular |= (other != null
&& other.dependsOn(owningTargetName));
}
@@ -452,9 +450,7 @@ public class Ant extends Task {
} finally {
// help the gc
newProject = null;
- Enumeration e = properties.elements();
- while (e.hasMoreElements()) {
- Property p = (Property) e.nextElement();
+ for (Property p : properties) {
p.setProject(null);
}
@@ -475,7 +471,7 @@ public class Ant extends Task {
* <p>
* This function may be overrided by providers of custom ProjectHelper so they can implement easily their sub
* launcher.
- *
+ *
* @return the name of the default file
* @since Ant 1.8.0
*/
@@ -491,9 +487,9 @@ public class Ant extends Task {
private void overrideProperties() throws BuildException {
// remove duplicate properties - last property wins
// Needed for backward compatibility
- Set set = new HashSet();
+ Set<String> set = new HashSet<String>();
for (int i = properties.size() - 1; i >= 0; --i) {
- Property p = (Property) properties.get(i);
+ Property p = properties.get(i);
if (p.getName() != null && !p.getName().equals("")) {
if (set.contains(p.getName())) {
properties.remove(i);
@@ -502,9 +498,9 @@ public class Ant extends Task {
}
}
}
- Enumeration e = properties.elements();
+ Enumeration<Property> e = properties.elements();
while (e.hasMoreElements()) {
- Property p = (Property) e.nextElement();
+ Property p = e.nextElement();
p.setProject(newProject);
p.execute();
}
@@ -524,39 +520,35 @@ public class Ant extends Task {
* @throws BuildException if a reference does not have a refid.
*/
private void addReferences() throws BuildException {
- Hashtable thisReferences
- = (Hashtable) getProject().getReferences().clone();
- Hashtable newReferences = newProject.getReferences();
- Enumeration e;
- if (references.size() > 0) {
- for (e = references.elements(); e.hasMoreElements();) {
- Reference ref = (Reference) e.nextElement();
- String refid = ref.getRefId();
- if (refid == null) {
- throw new BuildException("the refid attribute is required"
- + " for reference elements");
- }
- if (!thisReferences.containsKey(refid)) {
- log("Parent project doesn't contain any reference '"
- + refid + "'",
- Project.MSG_WARN);
- continue;
- }
+ @SuppressWarnings("unchecked")
+ Hashtable<String, Object> thisReferences
+ = (Hashtable<String, Object>) getProject().getReferences().clone();
+ for (Reference ref : references) {
+ String refid = ref.getRefId();
+ if (refid == null) {
+ throw new BuildException("the refid attribute is required"
+ + " for reference elements");
+ }
+ if (!thisReferences.containsKey(refid)) {
+ log("Parent project doesn't contain any reference '"
+ + refid + "'",
+ Project.MSG_WARN);
+ continue;
+ }
- thisReferences.remove(refid);
- String toRefid = ref.getToRefid();
- if (toRefid == null) {
- toRefid = refid;
- }
- copyReference(refid, toRefid);
+ thisReferences.remove(refid);
+ String toRefid = ref.getToRefid();
+ if (toRefid == null) {
+ toRefid = refid;
}
+ copyReference(refid, toRefid);
}
// Now add all references that are not defined in the
// subproject, if inheritRefs is true
if (inheritRefs) {
- for (e = thisReferences.keys(); e.hasMoreElements();) {
- String key = (String) e.nextElement();
+ Hashtable<String, Object> newReferences = newProject.getReferences();
+ for (String key : thisReferences.keySet()) {
if (newReferences.containsKey(key)) {
continue;
}
@@ -584,7 +576,7 @@ public class Ant extends Task {
return;
}
- Class c = orig.getClass();
+ Class<?> c = orig.getClass();
Object copy = orig;
try {
Method cloneM = c.getMethod("clone", new Class[0]);
@@ -628,8 +620,8 @@ public class Ant extends Task {
* user property or an inherited property).
* @since Ant 1.8.0
*/
- private void addAlmostAll(Hashtable props, PropertyType type) {
- Enumeration e = props.keys();
+ private void addAlmostAll(Hashtable<?, ?> props, PropertyType type) {
+ Enumeration<?> e = props.keys();
while (e.hasMoreElements()) {
String key = e.nextElement().toString();
if (MagicNames.PROJECT_BASEDIR.equals(key)
@@ -763,7 +755,7 @@ public class Ant extends Task {
/**
* @since Ant 1.6.2
*/
- private Iterator getBuildListeners() {
+ private Iterator<BuildListener> getBuildListeners() {
return getProject().getBuildListeners().iterator();
}
@@ -776,7 +768,7 @@ public class Ant extends Task {
/** Creates a reference to be configured by Ant. */
public Reference() {
- super();
+ super();
}
private String targetid = null;
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AntStructure.java Tue Aug 21 14:27:46 2012
@@ -27,7 +27,6 @@ import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.IntrospectionHelper;
@@ -96,26 +95,21 @@ public class AntStructure extends Task {
}
printer.printHead(out, getProject(),
- new Hashtable(getProject().getTaskDefinitions()),
- new Hashtable(getProject().getDataTypeDefinitions()));
+ new Hashtable<String, Class<?>>(getProject().getTaskDefinitions()),
+ new Hashtable<String, Class<?>>(getProject().getDataTypeDefinitions()));
printer.printTargetDecl(out);
- Iterator dataTypes = getProject().getCopyOfDataTypeDefinitions()
- .keySet().iterator();
- while (dataTypes.hasNext()) {
- String typeName = (String) dataTypes.next();
+ for (String typeName : getProject().getCopyOfDataTypeDefinitions()
+ .keySet()) {
printer.printElementDecl(
- out, getProject(), typeName,
- (Class) getProject().getDataTypeDefinitions().get(typeName));
+ out, getProject(), typeName,
+ getProject().getDataTypeDefinitions().get(typeName));
}
- Iterator tasks = getProject().getCopyOfTaskDefinitions().keySet()
- .iterator();
- while (tasks.hasNext()) {
- String tName = (String) tasks.next();
+ for (String tName : getProject().getCopyOfTaskDefinitions().keySet()) {
printer.printElementDecl(out, getProject(), tName,
- (Class) getProject().getTaskDefinitions().get(tName));
+ getProject().getTaskDefinitions().get(tName));
}
printer.printTail(out);
@@ -151,8 +145,8 @@ public class AntStructure extends Task {
* @param types map (name to implementing class)
* data types.
*/
- void printHead(PrintWriter out, Project p, Hashtable tasks,
- Hashtable types);
+ void printHead(PrintWriter out, Project p, Hashtable<String, Class<?>> tasks,
+ Hashtable<String, Class<?>> types);
/**
* Prints the definition for the target element.
@@ -169,7 +163,7 @@ public class AntStructure extends Task {
* @param element class of the defined element.
*/
void printElementDecl(PrintWriter out, Project p, String name,
- Class element);
+ Class<?> element);
/**
* Prints the trailer.
@@ -184,13 +178,14 @@ public class AntStructure extends Task {
private static final String TASKS = "%tasks;";
private static final String TYPES = "%types;";
- private Hashtable visited = new Hashtable();
+ private Hashtable<String, String> visited = new Hashtable<String, String>();
public void printTail(PrintWriter out) {
visited.clear();
}
- 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) {
printHead(out, tasks.keys(), types.keys());
}
@@ -201,14 +196,14 @@ public class AntStructure extends Task {
* <p>Basically this prints the XML declaration, defines some
* entities and the project element.</p>
*/
- private void printHead(PrintWriter out, Enumeration tasks,
- Enumeration types) {
+ private void printHead(PrintWriter out, Enumeration<String> tasks,
+ Enumeration<String> types) {
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
out.println("<!ENTITY % boolean \"(true|false|on|off|yes|no)\">");
out.print("<!ENTITY % tasks \"");
boolean first = true;
while (tasks.hasMoreElements()) {
- String tName = (String) tasks.nextElement();
+ String tName = tasks.nextElement();
if (!first) {
out.print(" | ");
} else {
@@ -220,7 +215,7 @@ public class AntStructure extends Task {
out.print("<!ENTITY % types \"");
first = true;
while (types.hasMoreElements()) {
- String typeName = (String) types.nextElement();
+ String typeName = types.nextElement();
if (!first) {
out.print(" | ");
} else {
@@ -281,7 +276,7 @@ public class AntStructure extends Task {
* Print the definition for a given element.
*/
public void printElementDecl(PrintWriter out, Project p,
- String name, Class element) {
+ String name, Class<?> element) {
if (visited.containsKey(name)) {
return;
@@ -313,7 +308,7 @@ public class AntStructure extends Task {
return;
}
- Vector v = new Vector();
+ Vector<String> v = new Vector<String>();
if (ih.supportsCharacters()) {
v.addElement("#PCDATA");
}
@@ -322,7 +317,7 @@ public class AntStructure extends Task {
v.addElement(TASKS);
}
- Enumeration e = ih.getNestedElements();
+ Enumeration<String> e = ih.getNestedElements();
while (e.hasMoreElements()) {
v.addElement(e.nextElement());
}
@@ -359,7 +354,7 @@ public class AntStructure extends Task {
sb.append(LINE_SEP).append(" ")
.append(attrName).append(" ");
- Class type = ih.getAttributeType(attrName);
+ Class<?> type = ih.getAttributeType(attrName);
if (type.equals(java.lang.Boolean.class)
|| type.equals(java.lang.Boolean.TYPE)) {
sb.append(BOOLEAN).append(" ");
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Antlib.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Antlib.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Antlib.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Antlib.java Tue Aug 21 14:27:46 2012
@@ -113,7 +113,7 @@ public class Antlib extends Task impleme
//
private ClassLoader classLoader;
private String uri = "";
- private List tasks = new ArrayList();
+ private List<Object> tasks = new ArrayList<Object>();
/**
* Set the class loader for this antlib.
@@ -155,7 +155,8 @@ public class Antlib extends Task impleme
* any tasks that derive from Definer.
*/
public void execute() {
- for (Iterator i = tasks.iterator(); i.hasNext();) {
+ //TODO handle tasks added via #addTask()
+ for (Iterator<Object> i = tasks.iterator(); i.hasNext();) {
UnknownElement ue = (UnknownElement) i.next();
setLocation(ue.getLocation());
ue.maybeConfigure();
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Apt.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Apt.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Apt.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Apt.java Tue Aug 21 14:27:46 2012
@@ -41,7 +41,7 @@ public class Apt
private boolean compile = true;
private String factory;
private Path factoryPath;
- private Vector options = new Vector();
+ private Vector<Option> options = new Vector<Option>();
private File preprocessDir;
/** The name of the apt tool. */
public static final String EXECUTABLE_NAME = "apt";
@@ -234,7 +234,7 @@ public class Apt
* Each option will use '"-E" name ["=" value]' argument.
* @return the options.
*/
- public Vector getOptions() {
+ public Vector<Option> getOptions() {
return options;
}
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java?rev=1375571&r1=1375570&r2=1375571&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/AugmentReference.java Tue Aug 21 14:27:46 2012
@@ -32,7 +32,7 @@ public class AugmentReference extends Ta
/**
* {@inheritDoc}
*/
- public void checkProxyClass(Class proxyClass) {
+ public void checkProxyClass(Class<?> proxyClass) {
}
/**