Permalink
Browse files

Use foreach loops

  • Loading branch information...
Gintas Grigelionis
Gintas Grigelionis committed Apr 1, 2018
1 parent b4243b9 commit 1c80d507f496dde98869890e671edf635bef8dec
Showing with 675 additions and 845 deletions.
  1. +2 −4 src/main/org/apache/tools/ant/AntClassLoader.java
  2. +4 −6 src/main/org/apache/tools/ant/Diagnostics.java
  3. +13 −14 src/main/org/apache/tools/ant/DirectoryScanner.java
  4. +4 −10 src/main/org/apache/tools/ant/IntrospectionHelper.java
  5. +30 −41 src/main/org/apache/tools/ant/Project.java
  6. +3 −3 src/main/org/apache/tools/ant/ProjectHelper.java
  7. +4 −4 src/main/org/apache/tools/ant/PropertyHelper.java
  8. +1 −4 src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
  9. +5 −5 src/main/org/apache/tools/ant/filters/ConcatFilter.java
  10. +5 −5 src/main/org/apache/tools/ant/filters/HeadFilter.java
  11. +5 −5 src/main/org/apache/tools/ant/filters/LineContains.java
  12. +7 −7 src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
  13. +3 −3 src/main/org/apache/tools/ant/filters/PrefixLines.java
  14. +6 −7 src/main/org/apache/tools/ant/filters/SortFilter.java
  15. +3 −3 src/main/org/apache/tools/ant/filters/StripLineBreaks.java
  16. +3 −3 src/main/org/apache/tools/ant/filters/StripLineComments.java
  17. +3 −3 src/main/org/apache/tools/ant/filters/SuffixLines.java
  18. +4 −4 src/main/org/apache/tools/ant/filters/TabsToSpaces.java
  19. +5 −5 src/main/org/apache/tools/ant/filters/TailFilter.java
  20. +1 −2 src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
  21. +2 −2 src/main/org/apache/tools/ant/helper/DefaultExecutor.java
  22. +3 −3 src/main/org/apache/tools/ant/helper/IgnoreDependenciesExecutor.java
  23. +7 −6 src/main/org/apache/tools/ant/launch/Launcher.java
  24. +3 −6 src/main/org/apache/tools/ant/launch/Locator.java
  25. +2 −2 src/main/org/apache/tools/ant/taskdefs/AbstractCvsTask.java
  26. +2 −2 src/main/org/apache/tools/ant/taskdefs/AntStructure.java
  27. +2 −2 src/main/org/apache/tools/ant/taskdefs/Checksum.java
  28. +2 −3 src/main/org/apache/tools/ant/taskdefs/Classloader.java
  29. +15 −17 src/main/org/apache/tools/ant/taskdefs/Copy.java
  30. +2 −4 src/main/org/apache/tools/ant/taskdefs/CopyPath.java
  31. +1 −2 src/main/org/apache/tools/ant/taskdefs/Copydir.java
  32. +6 −8 src/main/org/apache/tools/ant/taskdefs/Delete.java
  33. +1 −3 src/main/org/apache/tools/ant/taskdefs/Deltree.java
  34. +8 −9 src/main/org/apache/tools/ant/taskdefs/ExecTask.java
  35. +1 −2 src/main/org/apache/tools/ant/taskdefs/Execute.java
  36. +2 −3 src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java
  37. +6 −8 src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java
  38. +8 −11 src/main/org/apache/tools/ant/taskdefs/Expand.java
  39. +2 −3 src/main/org/apache/tools/ant/taskdefs/FixCRLF.java
  40. +7 −10 src/main/org/apache/tools/ant/taskdefs/Jar.java
  41. +3 −5 src/main/org/apache/tools/ant/taskdefs/Javac.java
  42. +12 −21 src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  43. +2 −2 src/main/org/apache/tools/ant/taskdefs/Jikes.java
  44. +1 −2 src/main/org/apache/tools/ant/taskdefs/MacroDef.java
  45. +3 −4 src/main/org/apache/tools/ant/taskdefs/Move.java
  46. +3 −3 src/main/org/apache/tools/ant/taskdefs/Parallel.java
  47. +9 −12 src/main/org/apache/tools/ant/taskdefs/Recorder.java
  48. +1 −3 src/main/org/apache/tools/ant/taskdefs/Replace.java
  49. +2 −2 src/main/org/apache/tools/ant/taskdefs/SubAnt.java
  50. +12 −11 src/main/org/apache/tools/ant/taskdefs/Sync.java
  51. +2 −2 src/main/org/apache/tools/ant/taskdefs/Touch.java
  52. +2 −2 src/main/org/apache/tools/ant/taskdefs/Untar.java
  53. +6 −9 src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java
  54. +6 −7 src/main/org/apache/tools/ant/taskdefs/condition/AntVersion.java
  55. +2 −6 src/main/org/apache/tools/ant/taskdefs/condition/HasMethod.java
  56. +2 −2 src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java
  57. +11 −12 src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
  58. +4 −4 src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
  59. +3 −3 src/main/org/apache/tools/ant/taskdefs/optional/Native2Ascii.java
  60. +10 −20 src/main/org/apache/tools/ant/taskdefs/optional/TraXLiaison.java
  61. +8 −17 src/main/org/apache/tools/ant/taskdefs/optional/XMLValidateTask.java
  62. +4 −4 src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetDeploymentTool.java
  63. +4 −6 src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
  64. +2 −3 src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtensionUtil.java
  65. +8 −8 src/main/org/apache/tools/ant/taskdefs/optional/extension/LibraryDisplayer.java
  66. +6 −9 src/main/org/apache/tools/ant/taskdefs/optional/i18n/Translate.java
  67. +1 −2 src/main/org/apache/tools/ant/taskdefs/optional/image/Image.java
  68. +1 −4 src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
  69. +2 −2 src/main/org/apache/tools/ant/taskdefs/optional/jsp/JspC.java
  70. +2 −2 src/main/org/apache/tools/ant/taskdefs/optional/junit/BatchTest.java
  71. +1 −3 src/main/org/apache/tools/ant/taskdefs/optional/junit/FailureRecorder.java
  72. +6 −7 src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnit4TestMethodAdapter.java
  73. +11 −21 src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
  74. +43 −53 src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTestRunner.java
  75. +2 −4 src/main/org/apache/tools/ant/taskdefs/optional/junit/XMLResultAggregator.java
  76. +2 −2 src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/KaffeNative2Ascii.java
  77. +32 −35 src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  78. +32 −36 src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
  79. +3 −4 src/main/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java
  80. +6 −8 src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHSession.java
  81. +3 −4 src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  82. +5 −5 src/main/org/apache/tools/ant/taskdefs/rmic/KaffeRmic.java
  83. +4 −4 src/main/org/apache/tools/ant/types/AbstractFileSet.java
  84. +5 −7 src/main/org/apache/tools/ant/types/Commandline.java
  85. +2 −2 src/main/org/apache/tools/ant/types/CommandlineJava.java
  86. +1 −3 src/main/org/apache/tools/ant/types/FilterChain.java
  87. +2 −3 src/main/org/apache/tools/ant/types/FilterSet.java
  88. +18 −22 src/main/org/apache/tools/ant/types/Path.java
  89. +8 −8 src/main/org/apache/tools/ant/types/PatternSet.java
  90. +2 −2 src/main/org/apache/tools/ant/types/Quantifier.java
  91. +7 −8 src/main/org/apache/tools/ant/types/RedirectorElement.java
  92. +3 −4 src/main/org/apache/tools/ant/types/XMLCatalog.java
  93. +3 −4 src/main/org/apache/tools/ant/types/optional/depend/ClassfileSet.java
  94. +4 −4 src/main/org/apache/tools/ant/types/resources/BZip2Resource.java
  95. +4 −4 src/main/org/apache/tools/ant/types/resources/Files.java
  96. +6 −7 src/main/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java
  97. +5 −5 src/main/org/apache/tools/ant/types/selectors/ContainsSelector.java
  98. +10 −10 src/main/org/apache/tools/ant/types/selectors/DateSelector.java
  99. +6 −6 src/main/org/apache/tools/ant/types/selectors/DepthSelector.java
  100. +6 −6 src/main/org/apache/tools/ant/types/selectors/FilenameSelector.java
  101. +2 −2 src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java
  102. +6 −6 src/main/org/apache/tools/ant/types/selectors/SizeSelector.java
  103. +7 −7 src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
  104. +3 −3 src/main/org/apache/tools/ant/types/selectors/TypeSelector.java
  105. +20 −23 src/main/org/apache/tools/ant/types/selectors/modifiedselector/DigestAlgorithm.java
  106. +2 −2 src/main/org/apache/tools/ant/util/DOMElementWriter.java
  107. +2 −2 src/main/org/apache/tools/ant/util/JavaEnvUtils.java
  108. +1 −2 src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
  109. +5 −7 src/main/org/apache/tools/ant/util/ResourceUtils.java
  110. +3 −3 src/main/org/apache/tools/ant/util/SplitClassLoader.java
  111. +2 −2 src/main/org/apache/tools/ant/util/StringTokenizer.java
  112. +2 −2 src/main/org/apache/tools/ant/util/WeakishReference.java
  113. +2 −2 src/main/org/apache/tools/ant/util/depend/AbstractAnalyzer.java
  114. +4 −5 src/main/org/apache/tools/mail/MailMessage.java
  115. +1 −2 src/main/org/apache/tools/tar/TarUtils.java
  116. +2 −2 src/main/org/apache/tools/zip/Simple8BitZipEncoding.java
  117. +10 −12 src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
  118. +3 −3 src/tests/junit/org/apache/tools/ant/UnknownElementTest.java
  119. +6 −6 src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
  120. +6 −8 src/tests/junit/org/apache/tools/ant/taskdefs/FailTest.java
  121. +3 −4 src/tests/junit/org/apache/tools/ant/taskdefs/optional/depend/DependTest.java
  122. +4 −6 src/tests/junit/org/apache/tools/ant/taskdefs/optional/ssh/ScpTest.java
  123. +10 −10 src/tests/junit/org/apache/tools/ant/types/optional/depend/ClassFileSetTest.java
@@ -361,11 +361,9 @@ public void setProject(final Project project) {
public void setClassPath(final Path classpath) {
pathComponents.removeAllElements();
if (classpath != null) {
final Path actualClasspath = classpath.concatSystemClasspath("ignore");
final String[] pathElements = actualClasspath.list();
for (int i = 0; i < pathElements.length; ++i) {
for (String pathElement : classpath.concatSystemClasspath("ignore").list()) {
try {
addPathElement(pathElements[i]);
addPathElement(pathElement);
} catch (final BuildException e) {
// ignore path elements which are invalid
// relative to the project
@@ -410,8 +410,7 @@ private static void doReportAntProperties(PrintStream out) {
*/
private static void doReportAntHomeLibraries(PrintStream out) {
out.println(MagicNames.ANT_HOME + ": " + System.getProperty(MagicNames.ANT_HOME));
File[] libs = listLibraries();
printLibraries(libs, out);
printLibraries(listLibraries(), out);
}
/**
@@ -423,8 +422,7 @@ private static void doReportUserHomeLibraries(PrintStream out) {
String home = System.getProperty(Launcher.USER_HOMEDIR);
out.println("user.home: " + home);
File libDir = new File(home, Launcher.USER_LIBDIR);
File[] libs = listJarFiles(libDir);
printLibraries(libs, out);
printLibraries(listJarFiles(libDir), out);
}
/**
@@ -437,8 +435,8 @@ private static void printLibraries(File[] libs, PrintStream out) {
out.println("No such directory.");
return;
}
for (int i = 0; i < libs.length; i++) {
out.println(libs[i].getName() + " (" + libs[i].length() + " bytes)");
for (File lib : libs) {
out.println(lib.getName() + " (" + lib.length() + " bytes)");
}
}
@@ -1204,7 +1204,7 @@ private void scandir(final File dir, final TokenizedPath path, final boolean fas
}
private void scandir(final File dir, final TokenizedPath path, final boolean fast,
String[] newfiles, final Deque<String> directoryNamesFollowed) {
String[] newFiles, final Deque<String> directoryNamesFollowed) {
String vpath = path.toString();
if (vpath.length() > 0 && !vpath.endsWith(File.separator)) {
vpath += File.separator;
@@ -1216,35 +1216,35 @@ private void scandir(final File dir, final TokenizedPath path, final boolean fas
}
if (!followSymlinks) {
final ArrayList<String> noLinks = new ArrayList<>();
for (final String newfile : newfiles) {
for (final String newFile : newFiles) {
final Path filePath;
if (dir == null) {
filePath = Paths.get(newfile);
filePath = Paths.get(newFile);
} else {
filePath = Paths.get(dir.toPath().toString(), newfile);
filePath = Paths.get(dir.toPath().toString(), newFile);
}
if (Files.isSymbolicLink(filePath)) {
final String name = vpath + newfile;
final File file = new File(dir, newfile);
final String name = vpath + newFile;
final File file = new File(dir, newFile);
if (file.isDirectory()) {
dirsExcluded.addElement(name);
} else if (file.isFile()) {
filesExcluded.addElement(name);
}
accountForNotFollowedSymlink(name, file);
} else {
noLinks.add(newfile);
noLinks.add(newFile);
}
}
newfiles = noLinks.toArray(new String[noLinks.size()]);
newFiles = noLinks.toArray(new String[noLinks.size()]);
} else {
directoryNamesFollowed.addFirst(dir.getName());
}
for (int i = 0; i < newfiles.length; i++) {
final String name = vpath + newfiles[i];
final TokenizedPath newPath = new TokenizedPath(path, newfiles[i]);
final File file = new File(dir, newfiles[i]);
for (String newFile : newFiles) {
final String name = vpath + newFile;
final TokenizedPath newPath = new TokenizedPath(path, newFile);
final File file = new File(dir, newFile);
final String[] children = file.list();
if (children == null || (children.length == 0 && file.isFile())) {
if (isIncluded(newPath)) {
@@ -1256,8 +1256,7 @@ private void scandir(final File dir, final TokenizedPath path, final boolean fas
} else if (file.isDirectory()) { // dir
if (followSymlinks
&& causesIllegalSymlinkLoop(newfiles[i], dir,
directoryNamesFollowed)) {
&& causesIllegalSymlinkLoop(newFile, dir, directoryNamesFollowed)) {
// will be caught and redirected to Ant's logging system
System.err.println("skipping symbolic link "
+ file.getAbsolutePath()
@@ -179,10 +179,8 @@
*/
private IntrospectionHelper(final Class<?> bean) {
this.bean = bean;
final Method[] methods = bean.getMethods();
Method addTextMethod = null;
for (int i = 0; i < methods.length; i++) {
final Method m = methods[i];
for (final Method m : bean.getMethods()) {
final String name = m.getName();
final Class<?> returnType = m.getReturnType();
final Class<?>[] args = m.getParameterTypes();
@@ -205,7 +203,7 @@ private IntrospectionHelper(final Class<?> bean) {
}
if ("addText".equals(name) && Void.TYPE.equals(returnType)
&& args.length == 1 && String.class.equals(args[0])) {
addTextMethod = methods[i];
addTextMethod = m;
} else if (name.startsWith("set") && Void.TYPE.equals(returnType)
&& args.length == 1 && !args[0].isArray()) {
final String propName = getPropertyName(name, "set");
@@ -1641,9 +1639,7 @@ private Method findMatchingMethod(final Class<?> paramClass, final List<Method>
Class<?> matchedClass = null;
Method matchedMethod = null;
final int size = methods.size();
for (int i = 0; i < size; ++i) {
final Method method = methods.get(i);
for (final Method method : methods) {
final Class<?> methodClass = method.getParameterTypes()[0];
if (methodClass.isAssignableFrom(paramClass)) {
if (matchedClass == null) {
@@ -1689,9 +1685,7 @@ private AntTypeDefinition findRestrictedDefinition(
return null;
}
synchronized (definitions) {
final int size = definitions.size();
for (int i = 0; i < size; ++i) {
final AntTypeDefinition d = definitions.get(i);
for (final AntTypeDefinition d : definitions) {
final Class<?> exposedClass = d.getExposedClass(helper.getProject());
if (exposedClass == null) {
continue;
@@ -393,8 +393,8 @@ public ClassLoader getCoreLoader() {
public void addBuildListener(final BuildListener listener) {
synchronized (listenersLock) {
// If the listeners already has this listener, do nothing
for (int i = 0; i < listeners.length; i++) {
if (listeners[i] == listener) {
for (BuildListener buildListener : listeners) {
if (buildListener == listener) {
return;
}
}
@@ -439,8 +439,8 @@ public void removeBuildListener(final BuildListener listener) {
public Vector<BuildListener> getBuildListeners() {
synchronized (listenersLock) {
final Vector<BuildListener> r = new Vector<>(listeners.length);
for (int i = 0; i < listeners.length; i++) {
r.add(listeners[i]);
for (BuildListener listener : listeners) {
r.add(listener);
}
return r;
}
@@ -1826,13 +1826,13 @@ public static Project getProject(final Object o) {
// dependency tree, not just on the Targets that depend on the
// build Target.
for (int i = 0; i < roots.length; i++) {
final String st = state.get(roots[i]);
for (String root : roots) {
final String st = state.get(root);
if (st == null) {
tsort(roots[i], targetTable, state, visiting, ret);
tsort(root, targetTable, state, visiting, ret);
} else if (st == VISITING) {
throw new BuildException("Unexpected node in visiting state: "
+ roots[i]);
+ root);
}
}
final StringBuilder buf = new StringBuilder("Build sequence for target(s)");
@@ -2087,9 +2087,8 @@ public String getElementName(final Object element) {
*/
public void fireBuildStarted() {
final BuildEvent event = new BuildEvent(this);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].buildStarted(event);
for (BuildListener currListener : listeners) {
currListener.buildStarted(event);
}
}
@@ -2103,9 +2102,8 @@ public void fireBuildStarted() {
public void fireBuildFinished(final Throwable exception) {
final BuildEvent event = new BuildEvent(this);
event.setException(exception);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].buildFinished(event);
for (BuildListener currListener : listeners) {
currListener.buildFinished(event);
}
// Inform IH to clear the cache
IntrospectionHelper.clearCache();
@@ -2119,10 +2117,9 @@ public void fireBuildFinished(final Throwable exception) {
*/
public void fireSubBuildStarted() {
final BuildEvent event = new BuildEvent(this);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
if (currListeners[i] instanceof SubBuildListener) {
((SubBuildListener) currListeners[i]).subBuildStarted(event);
for (BuildListener currListener : listeners) {
if (currListener instanceof SubBuildListener) {
((SubBuildListener) currListener).subBuildStarted(event);
}
}
}
@@ -2139,10 +2136,9 @@ public void fireSubBuildStarted() {
public void fireSubBuildFinished(final Throwable exception) {
final BuildEvent event = new BuildEvent(this);
event.setException(exception);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
if (currListeners[i] instanceof SubBuildListener) {
((SubBuildListener) currListeners[i]).subBuildFinished(event);
for (BuildListener currListener : listeners) {
if (currListener instanceof SubBuildListener) {
((SubBuildListener) currListener).subBuildFinished(event);
}
}
}
@@ -2156,9 +2152,8 @@ public void fireSubBuildFinished(final Throwable exception) {
*/
protected void fireTargetStarted(final Target target) {
final BuildEvent event = new BuildEvent(target);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].targetStarted(event);
for (BuildListener currListener : listeners) {
currListener.targetStarted(event);
}
}
@@ -2176,9 +2171,8 @@ protected void fireTargetStarted(final Target target) {
protected void fireTargetFinished(final Target target, final Throwable exception) {
final BuildEvent event = new BuildEvent(target);
event.setException(exception);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].targetFinished(event);
for (BuildListener currListener : listeners) {
currListener.targetFinished(event);
}
}
@@ -2194,9 +2188,8 @@ protected void fireTaskStarted(final Task task) {
// register this as the current task on the current thread.
registerThreadTask(Thread.currentThread(), task);
final BuildEvent event = new BuildEvent(task);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].taskStarted(event);
for (BuildListener currListener : listeners) {
currListener.taskStarted(event);
}
}
@@ -2216,9 +2209,8 @@ protected void fireTaskFinished(final Task task, final Throwable exception) {
System.err.flush();
final BuildEvent event = new BuildEvent(task);
event.setException(exception);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].taskFinished(event);
for (BuildListener currListener : listeners) {
currListener.taskFinished(event);
}
}
@@ -2264,9 +2256,8 @@ private void fireMessageLoggedEvent(final BuildEvent event, String message,
}
try {
isLoggingMessage.set(Boolean.TRUE);
final BuildListener[] currListeners = listeners;
for (int i = 0; i < currListeners.length; i++) {
currListeners[i].messageLogged(event);
for (BuildListener currListener : listeners) {
currListener.messageLogged(event);
}
} finally {
isLoggingMessage.set(Boolean.FALSE);
@@ -2466,11 +2457,9 @@ public final void setProjectReference(final Object obj) {
return;
}
try {
final Method method =
obj.getClass().getMethod(
"setProject", new Class[] {Project.class});
final Method method = obj.getClass().getMethod("setProject", Project.class);
if (method != null) {
method.invoke(obj, new Object[] {this});
method.invoke(obj, this);
}
} catch (final Throwable e) {
// ignore this if the object does not have
@@ -136,9 +136,9 @@ public static OnMissingExtensionPoint valueOf(String name) {
if (name == null) {
throw new NullPointerException();
}
for (int i = 0; i < values.length; i++) {
if (name.equals(values[i].name())) {
return values[i];
for (OnMissingExtensionPoint value : values) {
if (name.equals(value.name())) {
return value;
}
}
throw new IllegalArgumentException(
@@ -1131,11 +1131,11 @@ public void add(Delegate delegate) {
final HashSet<Class<? extends Delegate>> result = new HashSet<>();
Class<?> c = d.getClass();
while (c != null) {
Class<?>[] ifs = c.getInterfaces();
for (int i = 0; i < ifs.length; i++) {
if (Delegate.class.isAssignableFrom(ifs[i])) {
for (Class<?> ifc : c.getInterfaces()) {
if (Delegate.class.isAssignableFrom(ifc)) {
@SuppressWarnings("unchecked")
final Class<? extends Delegate> delegateInterface = (Class<? extends Delegate>) ifs[i];
final Class<? extends Delegate> delegateInterface =
(Class<? extends Delegate>) ifc;
result.add(delegateInterface);
}
}
@@ -20,7 +20,6 @@
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import org.apache.tools.ant.ProjectComponent;
@@ -72,9 +71,7 @@ protected boolean convertResult(boolean val) {
Map<String, String> ret = new HashMap<>();
RuntimeConfigurable rc = el.getWrapper();
Hashtable<String, Object> attributes = rc.getAttributeMap(); // This does a copy!
for (Iterator<Map.Entry<String, Object>> i =
attributes.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Object> entry = i.next();
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
String key = entry.getKey();
String value = (String) entry.getValue();
if (key.startsWith("ant-attribute:param")) {
@@ -191,13 +191,13 @@ private void initialize() throws IOException {
// get parameters
final Parameter[] params = getParameters();
if (params != null) {
for (int i = 0; i < params.length; i++) {
if ("prepend".equals(params[i].getName())) {
setPrepend(new File(params[i].getValue()));
for (Parameter param : params) {
if ("prepend".equals(param.getName())) {
setPrepend(new File(param.getValue()));
continue;
}
if ("append".equals(params[i].getName())) {
setAppend(new File(params[i].getValue()));
if ("append".equals(param.getName())) {
setAppend(new File(param.getValue()));
continue;
}
}
Oops, something went wrong.

2 comments on commit 1c80d50

@twogee

This comment has been minimized.

Show comment
Hide comment
@twogee

twogee Apr 5, 2018

Contributor

You're right, there is no concise way to do backwards foreach loops in Java. I will revert them later today.

Contributor

twogee replied Apr 5, 2018

You're right, there is no concise way to do backwards foreach loops in Java. I will revert them later today.

@bodewig

This comment has been minimized.

Show comment
Hide comment
@bodewig

bodewig Apr 5, 2018

Member

👍

Member

bodewig replied Apr 5, 2018

👍

Please sign in to comment.