You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by gi...@apache.org on 2018/04/05 05:33:26 UTC

[1/6] ant git commit: Checkstyle and simplify assertions

Repository: ant
Updated Branches:
  refs/heads/master 20b616398 -> 845c2c5b3


Checkstyle and simplify assertions

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/4a242817
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/4a242817
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/4a242817

Branch: refs/heads/master
Commit: 4a242817bda06af545a80804ce431fab0f27b792
Parents: 20b6163
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Wed Apr 4 15:26:32 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Wed Apr 4 15:26:32 2018 +0200

----------------------------------------------------------------------
 .../org/apache/tools/ant/taskdefs/EchoXML.java  |  2 +-
 .../taskdefs/launcher/VmsCommandLauncher.java   |  2 +-
 .../org/apache/tools/ant/DispatchTaskTest.java  |  2 +-
 .../tools/ant/IntrospectionHelperTest.java      | 53 +++++++++-----------
 .../junit/org/apache/tools/ant/ProjectTest.java |  3 +-
 .../apache/tools/ant/PropertyExpansionTest.java |  5 +-
 .../tools/ant/taskdefs/AntStructureTest.java    | 18 ++++---
 .../org/apache/tools/ant/taskdefs/AntTest.java  | 12 ++---
 .../apache/tools/ant/taskdefs/ConcatTest.java   |  5 +-
 .../org/apache/tools/ant/taskdefs/CopyTest.java |  3 +-
 .../tools/ant/taskdefs/DefaultExcludesTest.java |  7 ++-
 .../org/apache/tools/ant/taskdefs/EchoTest.java |  2 +-
 .../tools/ant/taskdefs/ExecuteWatchdogTest.java |  5 +-
 .../org/apache/tools/ant/taskdefs/JarTest.java  |  2 +-
 .../apache/tools/ant/taskdefs/ManifestTest.java |  3 +-
 .../org/apache/tools/ant/taskdefs/MoveTest.java | 39 +++++++-------
 .../apache/tools/ant/taskdefs/SQLExecTest.java  |  3 +-
 .../apache/tools/ant/taskdefs/SignJarTest.java  |  2 +-
 .../org/apache/tools/ant/taskdefs/SyncTest.java | 11 ++--
 .../ant/taskdefs/condition/ContainsTest.java    |  3 +-
 .../ant/taskdefs/condition/EqualsTest.java      |  5 +-
 .../ant/taskdefs/condition/IsReferenceTest.java |  2 +-
 .../taskdefs/condition/ParserSupportsTest.java  |  6 +--
 .../tools/ant/taskdefs/email/EmailTaskTest.java |  4 +-
 .../tools/ant/taskdefs/optional/PvcsTest.java   |  2 +-
 .../ant/taskdefs/optional/XmlValidateTest.java  |  4 +-
 .../tools/ant/taskdefs/optional/XsltTest.java   |  2 +-
 .../taskdefs/optional/script/ScriptDefTest.java | 20 ++++----
 .../ant/types/optional/ScriptSelectorTest.java  |  2 +-
 .../tools/ant/util/CollectionUtilsTest.java     | 37 +++++++-------
 .../apache/tools/ant/util/FileUtilsTest.java    |  2 +-
 .../util/LayoutPreservingPropertiesTest.java    | 14 +++---
 .../apache/tools/ant/util/XMLFragmentTest.java  |  4 +-
 .../ant/util/facade/FacadeTaskHelperTest.java   |  2 +-
 34 files changed, 150 insertions(+), 138 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/main/org/apache/tools/ant/taskdefs/EchoXML.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/EchoXML.java b/src/main/org/apache/tools/ant/taskdefs/EchoXML.java
index 34baf6b..91b6d8b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/EchoXML.java
+++ b/src/main/org/apache/tools/ant/taskdefs/EchoXML.java
@@ -57,7 +57,7 @@ public class EchoXML extends XMLFragment {
 
     /**
      * Set the namespace policy for the xml file
-     * @param n namespace policy: "ignore," "elementsOnly," or "all"
+     * @param n namespace policy: "ignore", "elementsOnly", or "all"
      * @see org.apache.tools.ant.util.DOMElementWriter.XmlNamespacePolicy
      */
     public void setNamespacePolicy(NamespacePolicy n) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java b/src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
index fe05b68..695223b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
+++ b/src/main/org/apache/tools/ant/taskdefs/launcher/VmsCommandLauncher.java
@@ -125,7 +125,7 @@ public class VmsCommandLauncher extends Java13CommandLauncher {
         new Thread(() -> {
             try {
                 p.waitFor();
-            } catch(InterruptedException e) {
+            } catch (InterruptedException e) {
                 // ignore
             }
             FileUtils.delete(f);

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java b/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
index c682093..dab734f 100644
--- a/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/DispatchTaskTest.java
@@ -39,7 +39,7 @@ public class DispatchTaskTest {
         try {
             buildRule.executeTarget("disp");
             fail("BuildException should have been thrown");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //FIXME the previous method used here ignored the build exception - what are we trying to test
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
index 90c8bd7..5a20f38 100644
--- a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java
@@ -259,12 +259,12 @@ public class IntrospectionHelperTest {
     }
 
     private void assertElemMethod(String elemName, String methodName,
-                                  Class returnType, Class methodArg) {
+                                  Class<?> returnType, Class<?> methodArg) {
         Method m = ih.getElementMethod(elemName);
         assertEquals("Method name", methodName, m.getName());
-        Class expectedReturnType = (returnType == null)? Void.TYPE: returnType;
+        Class<?> expectedReturnType = (returnType == null)? Void.TYPE: returnType;
         assertEquals("Return type", expectedReturnType, m.getReturnType());
-        Class[] args = m.getParameterTypes();
+        Class<?>[] args = m.getParameterTypes();
         if (methodArg != null) {
             assertEquals("Arg Count", 1, args.length);
             assertEquals("Arg Type", methodArg, args[0]);
@@ -491,14 +491,14 @@ public class IntrospectionHelperTest {
 
     @Test
     public void testGetAttributes() {
-        Map attrMap = getExpectedAttributes();
-        Enumeration e = ih.getAttributes();
+        Map<String, Class<?>> attrMap = getExpectedAttributes();
+        Enumeration<String> e = ih.getAttributes();
         while (e.hasMoreElements()) {
-            String name = (String) e.nextElement();
-            Class expect = (Class) attrMap.get(name);
-            assertNotNull("Support for "+name+" in IntrospectionHelperTest?",
+            String name = e.nextElement();
+            Class<?> expect = attrMap.get(name);
+            assertNotNull("Support for " + name + " in IntrospectionHelperTest?",
                           expect);
-            assertEquals("Type of "+name, expect, ih.getAttributeType(name));
+            assertEquals("Type of " + name, expect, ih.getAttributeType(name));
             attrMap.remove(name);
         }
         attrMap.remove("name");
@@ -511,7 +511,7 @@ public class IntrospectionHelperTest {
         Map<String, Class<?>> actualMap = ih.getAttributeMap();
         for (Map.Entry<String, Class<?>> entry : actualMap.entrySet()) {
             String attrName = entry.getKey();
-            Class attrClass = attrMap.get(attrName);
+            Class<?> attrClass = attrMap.get(attrName);
             assertNotNull("Support for " + attrName +
                           " in IntrospectionHelperTest?", attrClass);
             assertEquals("Type of " + attrName, attrClass, entry.getValue());
@@ -568,7 +568,7 @@ public class IntrospectionHelperTest {
     }
 
     private void assertAttrMethod(String attrName, String methodName,
-                                  Class methodArg, Object arg, Object badArg) {
+                                  Class<?> methodArg, Object arg, Object badArg) {
         Method m = ih.getAttributeMethod(attrName);
         assertMethod(m, methodName, methodArg, arg, badArg);
     }
@@ -614,14 +614,14 @@ public class IntrospectionHelperTest {
     }
 
     public void setEleven(boolean b) {
-        assertTrue(!b);
+        assertFalse(b);
     }
 
     public void setTwelve(Boolean b) {
-        assertTrue(!b);
+        assertFalse(b);
     }
 
-    public void setThirteen(Class c) {
+    public void setThirteen(Class<?> c) {
         assertEquals(Project.class, c);
     }
 
@@ -664,7 +664,7 @@ public class IntrospectionHelperTest {
 
     @Test
     public void testGetExtensionPoints() {
-        List extensions = ih.getExtensionPoints();
+        List<Method> extensions = ih.getExtensionPoints();
         final int adders = 2;
         assertEquals("extension count", adders, extensions.size());
 
@@ -675,28 +675,23 @@ public class IntrospectionHelperTest {
         // combinatorics are too hard to check.  We really only want
         // to ensure that the more derived Hashtable can be found
         // before Map.
-//        assertExtMethod(extensions.get(0), "add", Number.class,
+//        assertMethod(extensions.get(0), "add", Number.class,
 //                        new Integer(2), new Integer(3));
 
         // addConfigured(Hashtable) should come before addConfigured(Map)
-        assertExtMethod(extensions.get(adders - 2),
+        assertMethod(extensions.get(adders - 2),
                         "addConfigured", Hashtable.class,
                         makeTable("key", "value"), makeTable("1", "2"));
 
-        assertExtMethod(extensions.get(adders - 1), "addConfigured", Map.class,
-                        new HashMap(), makeTable("1", "2"));
-    }
-
-    private void assertExtMethod(Object mo, String methodName, Class methodArg,
-                                 Object arg, Object badArg) {
-        assertMethod((Method) mo, methodName, methodArg, arg, badArg);
+        assertMethod(extensions.get(adders - 1), "addConfigured", Map.class,
+                        new HashMap<String, String>(), makeTable("1", "2"));
     }
 
-    private void assertMethod(Method m, String methodName, Class methodArg,
+    private void assertMethod(Method m, String methodName, Class<?> methodArg,
                               Object arg, Object badArg) {
         assertEquals("Method name", methodName, m.getName());
         assertEquals("Return type", Void.TYPE, m.getReturnType());
-        Class[] args = m.getParameterTypes();
+        Class<?>[] args = m.getParameterTypes();
         assertEquals("Arg Count", 1, args.length);
         assertEquals("Arg Type", methodArg, args[0]);
 
@@ -717,7 +712,7 @@ public class IntrospectionHelperTest {
         }
     }
 
-    public List add(List l) {
+    public List<Object> add(List l) {
         // INVALID extension point
         return null;
     }
@@ -728,11 +723,11 @@ public class IntrospectionHelperTest {
 //        assertEquals(2, n.intValue());
 //    }
 
-    public void add(List l, int i) {
+    public void add(List<Object> l, int i) {
         // INVALID extension point
     }
 
-    public void addConfigured(Map m) {
+    public void addConfigured(Map<Object, Object> m) {
         // Valid extension point
         assertTrue(m.isEmpty());
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/ProjectTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/ProjectTest.java b/src/tests/junit/org/apache/tools/ant/ProjectTest.java
index 120c009..15340b6 100644
--- a/src/tests/junit/org/apache/tools/ant/ProjectTest.java
+++ b/src/tests/junit/org/apache/tools/ant/ProjectTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
@@ -189,7 +190,7 @@ public class ProjectTest {
         } catch (BuildException e) {
             assertEquals(message, e.getMessage());
             mbl.assertEmpty();
-            assertTrue(!p.getTaskDefinitions().containsKey(dummyName));
+            assertFalse(p.getTaskDefinitions().containsKey(dummyName));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/PropertyExpansionTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/PropertyExpansionTest.java b/src/tests/junit/org/apache/tools/ant/PropertyExpansionTest.java
index c943d3e..5b338bb 100644
--- a/src/tests/junit/org/apache/tools/ant/PropertyExpansionTest.java
+++ b/src/tests/junit/org/apache/tools/ant/PropertyExpansionTest.java
@@ -90,9 +90,8 @@ public class PropertyExpansionTest {
     /**
      * little helper method to validate stuff
      */
-    private void assertExpandsTo(String source,String expected) {
-        String actual = buildRule.getProject().replaceProperties(source);
-        assertEquals(source,expected,actual);
+    private void assertExpandsTo(String source, String expected) {
+        assertEquals(source, expected, buildRule.getProject().replaceProperties(source));
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java
index 5c19bc4..1eb24bc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntStructureTest.java
@@ -31,6 +31,7 @@ import java.util.Hashtable;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -83,31 +84,34 @@ public class AntStructureTest {
         public void printHead(PrintWriter out, Project p,
                               Hashtable<String, Class<?>> tasks,
                               Hashtable<String, Class<?>> types) {
-            assertTrue(!headCalled);
-            assertTrue(!targetCalled);
-            assertTrue(!tailCalled);
+            assertFalse(headCalled);
+            assertFalse(targetCalled);
+            assertFalse(tailCalled);
             assertEquals(0, elementCalled);
             headCalled = true;
         }
+
         public void printTargetDecl(PrintWriter out) {
             assertTrue(headCalled);
-            assertTrue(!targetCalled);
-            assertTrue(!tailCalled);
+            assertFalse(targetCalled);
+            assertFalse(tailCalled);
             assertEquals(0, elementCalled);
             targetCalled = true;
         }
+
         public void printElementDecl(PrintWriter out, Project p, String name,
                                      Class<?> element) {
             assertTrue(headCalled);
             assertTrue(targetCalled);
-            assertTrue(!tailCalled);
+            assertFalse(tailCalled);
             elementCalled++;
             this.p = p;
         }
+
         public void printTail(PrintWriter out) {
             assertTrue(headCalled);
             assertTrue(targetCalled);
-            assertTrue(!tailCalled);
+            assertFalse(tailCalled);
             assertTrue(elementCalled > 0);
             tailCalled = true;
             p.log(TAIL_CALLED);

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
index 5fddd80..86049f8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
@@ -65,7 +65,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("test1");
             fail("recursive call");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -76,7 +76,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("test2");
             fail("required argument not specified");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -87,7 +87,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("test1");
             fail("recursive call");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -107,7 +107,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("test4b");
             fail("target doesn't exist");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -327,7 +327,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("infinite-loop-via-depends");
             fail("recursive call");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -371,7 +371,7 @@ public class AntTest {
         try {
             buildRule.executeTarget("blank-target");
             fail("target name must not be empty");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
index daec44b..58b883d 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
@@ -31,6 +31,7 @@ import java.io.IOException;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -240,7 +241,7 @@ public class ConcatTest {
         try {
             buildRule.executeTarget("samefile");
             fail("Build exception should have been thrown - output file same as input");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert value
         }
     }
@@ -261,7 +262,7 @@ public class ConcatTest {
     public void testmultireader() {
         buildRule.executeTarget("testmultireader");
         assertTrue(buildRule.getLog().contains("Bye"));
-        assertTrue(!buildRule.getLog().contains("Hello"));
+        assertFalse(buildRule.getLog().contains("Hello"));
     }
     /**
      * Check if fixlastline works

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
index 5b36d05..f261289 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CopyTest.java
@@ -35,6 +35,7 @@ import java.io.IOException;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -105,7 +106,7 @@ public class CopyTest {
     @Test
     public void testFilterTest() {
         buildRule.executeTarget("filtertest");
-        assertTrue(!buildRule.getLog().contains("loop in tokens"));
+        assertFalse(buildRule.getLog().contains("loop in tokens"));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
index 06ca3a2..c1392d2 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
@@ -159,8 +159,11 @@ public class DefaultExcludesTest {
         assertEquals(message + " : string array length match", expected.length, actual.length);
         for (String element : expected) {
             boolean found = false;
-            for (int i = 0; !found && i < actual.length; i++) {
-                found |= element.equals(actual[i]);
+            for (String member : actual) {
+                found |= element.equals(member);
+                if (found) {
+                    break;
+                }
             }
             assertTrue(message + " : didn't find element "
                     + element + " in array match", found);

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
index 6f0c7a9..67715dc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/EchoTest.java
@@ -68,7 +68,7 @@ public class EchoTest {
         echo.setEncoding("UTF-8");
         echo.execute();
         String x = FileUtils.readFully(new InputStreamReader(new FileInputStream(removeThis), "UTF-8"));
-        assertEquals(x,"\u00e4\u00a9");
+        assertEquals(x, "\u00e4\u00a9");
     }
 
     @After

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
index 4b8efa3..80a4ac3 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ExecuteWatchdogTest.java
@@ -28,6 +28,7 @@ import org.junit.internal.AssumptionViolatedException;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -127,7 +128,7 @@ public class ExecuteWatchdogTest {
         watchdog.start(process);
         int retCode = process.waitFor();
         assertFalse("process should not have been killed", watchdog.killedProcess());
-        assertTrue("return code is invalid: " + retCode, retCode!=0);
+        assertNotEquals("return code is invalid: " + retCode, 0, retCode);
     }
 
     @Test
@@ -139,7 +140,7 @@ public class ExecuteWatchdogTest {
         Thread thread = new Thread(() -> {
             try {
                 process.waitFor();
-            } catch(InterruptedException e) {
+            } catch (InterruptedException e) {
                 // not very nice but will do the job
                 throw new AssumptionViolatedException("process interrupted in thread", e);
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
index 86b18fd..3ef9b3f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JarTest.java
@@ -300,7 +300,7 @@ public class JarTest {
             }
 
             assertTrue(foundSub);
-            assertTrue(!foundSubFoo);
+            assertFalse(foundSubFoo);
             assertTrue(foundFoo);
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
index 247d919..3dbcdf1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestTest.java
@@ -37,6 +37,7 @@ import org.junit.Test;
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -389,7 +390,7 @@ public class ManifestTest {
         buildRule.executeTarget("testUpdate");
         Manifest mf = getManifest(new File(outDir, "mftest.mf"));
         assertNotNull(mf);
-        assertTrue(!Manifest.getDefaultManifest().equals(mf));
+        assertNotEquals(Manifest.getDefaultManifest(), mf);
         String mfAsString = mf.toString();
         assertNotNull(mfAsString);
         assertTrue(mfAsString.startsWith("Manifest-Version: 2.0"));

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
index c09b6ba..529d220 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/MoveTest.java
@@ -28,6 +28,7 @@ import java.io.File;
 import java.io.IOException;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -69,14 +70,14 @@ public class MoveTest {
 
         buildRule.executeTarget("testDirectoryRemoval");
         String output = buildRule.getProject().getProperty("output");
-        assertTrue(!new File(output,"E/B/1").exists());
+        assertFalse(new File(output, "E/B/1").exists());
         assertTrue(new File(output, "E/C/2").exists());
-        assertTrue(new File(output,"E/D/3").exists());
-        assertTrue(new File(output,"A/B/1").exists());
-        assertTrue(!new File(output,"A/C/2").exists());
-        assertTrue(!new File(output,"A/D/3").exists());
-        assertTrue(!new File(output,"A/C").exists());
-        assertTrue(!new File(output,"A/D").exists());
+        assertTrue(new File(output, "E/D/3").exists());
+        assertTrue(new File(output, "A/B/1").exists());
+        assertFalse(new File(output, "A/C/2").exists());
+        assertFalse(new File(output, "A/D/3").exists());
+        assertFalse(new File(output, "A/C").exists());
+        assertFalse(new File(output, "A/D").exists());
     }
 
     /** Bugzilla Report 18886 */
@@ -84,10 +85,10 @@ public class MoveTest {
     public void testDirectoryRetaining() {
         buildRule.executeTarget("testDirectoryRetaining");
         String output = buildRule.getProject().getProperty("output");
-        assertTrue(new File(output,"E").exists());
-        assertTrue(new File(output,"E/1").exists());
-        assertTrue(!new File(output,"A/1").exists());
-        assertTrue(new File(output,"A").exists());
+        assertTrue(new File(output, "E").exists());
+        assertTrue(new File(output, "E/1").exists());
+        assertFalse(new File(output, "A/1").exists());
+        assertTrue(new File(output, "A").exists());
     }
 
     @Test
@@ -103,21 +104,21 @@ public class MoveTest {
     private void testCompleteDirectoryMove(String target) {
         buildRule.executeTarget(target);
         String output = buildRule.getProject().getProperty("output");
-        assertTrue(new File(output,"E").exists());
-        assertTrue(new File(output,"E/1").exists());
-        assertTrue(!new File(output,"A/1").exists());
+        assertTrue(new File(output, "E").exists());
+        assertTrue(new File(output, "E/1").exists());
+        assertFalse(new File(output, "A/1").exists());
         // <path> swallows the basedir, it seems
-        //assertTrue(!new File(getOutputDir(),"A").exists());
+        //assertFalse(new File(getOutputDir(), "A").exists());
     }
 
     @Test
     public void testPathElementMove() {
         buildRule.executeTarget("testPathElementMove");
         String output = buildRule.getProject().getProperty("output");
-        assertTrue(new File(output,"E").exists());
-        assertTrue(new File(output,"E/1").exists());
-        assertTrue(!new File(output,"A/1").exists());
-        assertTrue(new File(output,"A").exists());
+        assertTrue(new File(output, "E").exists());
+        assertTrue(new File(output, "E/1").exists());
+        assertFalse(new File(output, "A/1").exists());
+        assertTrue(new File(output, "A").exists());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
index f5b72c8..3bd5b0b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SQLExecTest.java
@@ -34,6 +34,7 @@ import org.junit.Test;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -72,7 +73,7 @@ public class SQLExecTest {
     @Test
     public void testDriverCaching() {
         SQLExec sql = createTask(getProperties(NULL));
-        assertTrue(!SQLExec.getLoaderMap().containsKey(NULL_DRIVER));
+        assertFalse(SQLExec.getLoaderMap().containsKey(NULL_DRIVER));
         try {
             sql.execute();
             fail("BuildException should have been thrown");

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
index a73854a..6a0a8ad 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SignJarTest.java
@@ -109,7 +109,7 @@ public class SignJarTest {
         try {
             buildRule.executeTarget("testTsaLocalhost");
             fail("Should have thrown exception - no TSA at localhost:0");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertEquals("jarsigner returned: 1", ex.getMessage());
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java
index b296b7b..cb696f1 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/SyncTest.java
@@ -24,6 +24,7 @@ import org.junit.Rule;
 import org.junit.Test;
 
 import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 public class SyncTest {
@@ -41,7 +42,7 @@ public class SyncTest {
         buildRule.executeTarget("simplecopy");
         String d = buildRule.getProject().getProperty("dest") + "/a/b/c/d";
         assertFileIsPresent(d);
-        assertTrue(!buildRule.getFullLog().contains("dangling"));
+        assertFalse(buildRule.getFullLog().contains("dangling"));
     }
 
     @Test
@@ -51,7 +52,7 @@ public class SyncTest {
         assertFileIsNotPresent(d);
         String c = buildRule.getProject().getProperty("dest") + "/a/b/c";
         assertFileIsNotPresent(c);
-        assertTrue(!buildRule.getFullLog().contains("dangling"));
+        assertFalse(buildRule.getFullLog().contains("dangling"));
     }
 
     @Test
@@ -61,7 +62,7 @@ public class SyncTest {
         assertFileIsNotPresent(d);
         String c = buildRule.getProject().getProperty("dest") + "/a/b/c";
         assertFileIsPresent(c);
-        assertTrue(!buildRule.getFullLog().contains("dangling"));
+        assertFalse(buildRule.getFullLog().contains("dangling"));
     }
 
     @Test
@@ -123,7 +124,7 @@ public class SyncTest {
         assertFileIsPresent(d);
         String f = buildRule.getProject().getProperty("dest") + "/e/f";
         assertFileIsPresent(f);
-        assertTrue(!buildRule.getFullLog().contains("Removing orphan file:"));
+        assertFalse(buildRule.getFullLog().contains("Removing orphan file:"));
     }
 
     @Test
@@ -133,7 +134,7 @@ public class SyncTest {
         assertFileIsPresent(d);
         String f = buildRule.getProject().getProperty("dest") + "/e/f";
         assertFileIsPresent(f);
-        assertTrue(!buildRule.getFullLog().contains("Removing orphan file:"));
+        assertFalse(buildRule.getFullLog().contains("Removing orphan file:"));
     }
 
     public void assertFileIsPresent(String f) {

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ContainsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ContainsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ContainsTest.java
index a45b511..337b3b7 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ContainsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ContainsTest.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.condition;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -33,7 +34,7 @@ public class ContainsTest  {
         Contains con = new Contains();
         con.setString("abc");
         con.setSubstring("A");
-        assertTrue(!con.eval());
+        assertFalse(con.eval());
 
         con.setCasesensitive(false);
         assertTrue(con.eval());

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/condition/EqualsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/EqualsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/EqualsTest.java
index 5f9b996..b8c40b3 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/EqualsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/EqualsTest.java
@@ -20,6 +20,7 @@ package org.apache.tools.ant.taskdefs.condition;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -33,7 +34,7 @@ public class EqualsTest {
         Equals eq = new Equals();
         eq.setArg1("a");
         eq.setArg2(" a");
-        assertTrue(!eq.eval());
+        assertFalse(eq.eval());
 
         eq.setTrim(true);
         assertTrue(eq.eval());
@@ -47,7 +48,7 @@ public class EqualsTest {
         Equals eq = new Equals();
         eq.setArg1("a");
         eq.setArg2("A");
-        assertTrue(!eq.eval());
+        assertFalse(eq.eval());
 
         eq.setCasesensitive(false);
         assertTrue(eq.eval());

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReferenceTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReferenceTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReferenceTest.java
index 01b6b47..e8e178b 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReferenceTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReferenceTest.java
@@ -54,7 +54,7 @@ public class IsReferenceTest {
         try {
             buildRule.executeTarget("isreference-incomplete");
             fail("Build exception expected: refid attirbute has been omitted");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertEquals("No reference specified for isreference condition", ex.getMessage());
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
index 271c19b..c5c2f04 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/ParserSupportsTest.java
@@ -46,7 +46,7 @@ public class ParserSupportsTest {
         try {
             buildRule.executeTarget("testEmpty");
             fail("Build exception expected: " + ParserSupports.ERROR_NO_ATTRIBUTES);
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertEquals(ParserSupports.ERROR_NO_ATTRIBUTES, ex.getMessage());
         }
     }
@@ -56,7 +56,7 @@ public class ParserSupportsTest {
         try {
             buildRule.executeTarget("testBoth");
             fail("Build exception expected: " + ParserSupports.ERROR_BOTH_ATTRIBUTES);
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertEquals(ParserSupports.ERROR_BOTH_ATTRIBUTES, ex.getMessage());
         }
     }
@@ -71,7 +71,7 @@ public class ParserSupportsTest {
         try {
             buildRule.executeTarget("testPropertyNoValue");
             fail("Build exception expected: " + ParserSupports.ERROR_NO_VALUE);
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertEquals(ParserSupports.ERROR_NO_VALUE, ex.getMessage());
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailTaskTest.java
index 6363f90..f3dc622 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/email/EmailTaskTest.java
@@ -45,7 +45,7 @@ public class EmailTaskTest {
         try {
             buildRule.executeTarget("test1");
             fail("Build exception expected: SMTP auth only possibly with MIME mail");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }
@@ -55,7 +55,7 @@ public class EmailTaskTest {
         try {
             buildRule.executeTarget("test2");
             fail("Build exception expected: SSL only possibly with MIME mail");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
index 29b2685..c89ccd0 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/PvcsTest.java
@@ -72,7 +72,7 @@ public class PvcsTest {
             buildRule.executeTarget("test6");
             fail("Failed executing: /never/heard/of/a/directory/structure/like/this/pcli lvf -z " +
                     "-aw -pr//ct4serv2/pvcs/monitor /. Exception: /never/heard/of/a/directory/structure/like/this/pcli: not found");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
index f0b32b0..3e9c258 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XmlValidateTest.java
@@ -165,7 +165,7 @@ public class XmlValidateTest {
         try {
             buildRule.executeTarget("testUtf8");
             fail("Invalid characters in file");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
           //TODO assert exception message
         }
     }
@@ -181,7 +181,7 @@ public class XmlValidateTest {
         try {
             buildRule.executeTarget("testProperty.invalidXML");
             fail("XML file does not satisfy schema");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
index c4aec20..66b4882 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/XsltTest.java
@@ -50,7 +50,7 @@ public class XsltTest {
         try {
             buildRule.executeTarget("testCatchNoDtd");
             fail("Expected failure");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             //TODO assert exception message
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
index 7dd9e60..7b2d327 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/script/ScriptDefTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant.taskdefs.optional.script;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
@@ -28,6 +27,7 @@ import org.junit.Test;
 
 import java.io.File;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -67,8 +67,8 @@ public class ScriptDefTest {
         try {
             buildRule.executeTarget("nolang");
             fail("Absence of language attribute not detected");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("requires a language attribute", ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains("requires a language attribute", ex.getMessage());
         }
     }
 
@@ -77,8 +77,8 @@ public class ScriptDefTest {
         try {
             buildRule.executeTarget("noname");
             fail("Absence of name attribute not detected");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("scriptdef requires a name attribute", ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains("scriptdef requires a name attribute", ex.getMessage());
         }
     }
 
@@ -108,8 +108,8 @@ public class ScriptDefTest {
         try {
             buildRule.executeTarget("exception");
             fail("Should have thrown an exception in the script");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("TypeError", ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains("TypeError", ex.getMessage());
         }
     }
 
@@ -126,8 +126,8 @@ public class ScriptDefTest {
         try {
             buildRule.executeTarget("doubleAttributeDef");
             fail("Should have detected duplicate attirbute definition");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("attr1 attribute more than once", ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains("attr1 attribute more than once", ex.getMessage());
         }
     }
 
@@ -156,7 +156,7 @@ public class ScriptDefTest {
             fail("should have failed with reader's encoding [" + readerEncoding +
                 "] different from the writer's encoding [" +
                 buildRule.getProject().getProperty("useSrcAndEncoding.encoding") + "]");
-        } catch(BuildException e) {
+        } catch (BuildException e) {
             assertTrue(e.getMessage().matches(
                     "expected <eacute \\[\u00e9]> but was <eacute \\[\u00c3\u00a9]>"));
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
index 304d6d0..a75a663 100644
--- a/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/optional/ScriptSelectorTest.java
@@ -44,7 +44,7 @@ public class ScriptSelectorTest {
         try {
             buildRule.executeTarget("testNolanguage");
             fail("Absence of language attribute not detected");
-        } catch(BuildException ex) {
+        } catch (BuildException ex) {
             assertContains("script language must be specified", ex.getMessage());
 
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
index 9a4d50b..a1aa45f 100644
--- a/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/CollectionUtilsTest.java
@@ -25,6 +25,7 @@ import java.util.Vector;
 
 import org.junit.Test;
 
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 /**
@@ -36,8 +37,8 @@ public class CollectionUtilsTest {
 
     @Test
     public void testVectorEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Vector()));
-        assertTrue(!CollectionUtils.equals(new Vector(), null));
+        assertFalse(CollectionUtils.equals(null, new Vector()));
+        assertFalse(CollectionUtils.equals(new Vector(), null));
         assertTrue(CollectionUtils.equals(new Vector(), new Vector()));
         Vector<String> v1 = new Vector<>();
         Stack<String> s2 = new Stack<>();
@@ -46,27 +47,27 @@ public class CollectionUtilsTest {
         assertTrue(CollectionUtils.equals(v1, s2));
         assertTrue(CollectionUtils.equals(s2, v1));
         v1.addElement("bar");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
+        assertFalse(CollectionUtils.equals(v1, s2));
+        assertFalse(CollectionUtils.equals(s2, v1));
         s2.push("bar");
         assertTrue(CollectionUtils.equals(v1, s2));
         assertTrue(CollectionUtils.equals(s2, v1));
         s2.push("baz");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
+        assertFalse(CollectionUtils.equals(v1, s2));
+        assertFalse(CollectionUtils.equals(s2, v1));
         v1.addElement("baz");
         assertTrue(CollectionUtils.equals(v1, s2));
         assertTrue(CollectionUtils.equals(s2, v1));
         v1.addElement("zyzzy");
         s2.push("zyzzy2");
-        assertTrue(!CollectionUtils.equals(v1, s2));
-        assertTrue(!CollectionUtils.equals(s2, v1));
+        assertFalse(CollectionUtils.equals(v1, s2));
+        assertFalse(CollectionUtils.equals(s2, v1));
     }
 
     @Test
     public void testDictionaryEquals() {
-        assertTrue(!CollectionUtils.equals(null, new Hashtable()));
-        assertTrue(!CollectionUtils.equals(new Hashtable(), null));
+        assertFalse(CollectionUtils.equals(null, new Hashtable()));
+        assertFalse(CollectionUtils.equals(new Hashtable(), null));
         assertTrue(CollectionUtils.equals(new Hashtable(), new Properties()));
         Hashtable<String, String> h1 = new Hashtable<>();
         Properties p2 = new Properties();
@@ -75,28 +76,28 @@ public class CollectionUtilsTest {
         assertTrue(CollectionUtils.equals(h1, p2));
         assertTrue(CollectionUtils.equals(p2, h1));
         h1.put("bar", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
+        assertFalse(CollectionUtils.equals(h1, p2));
+        assertFalse(CollectionUtils.equals(p2, h1));
         p2.put("bar", "");
         assertTrue(CollectionUtils.equals(h1, p2));
         assertTrue(CollectionUtils.equals(p2, h1));
         p2.put("baz", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
+        assertFalse(CollectionUtils.equals(h1, p2));
+        assertFalse(CollectionUtils.equals(p2, h1));
         h1.put("baz", "");
         assertTrue(CollectionUtils.equals(h1, p2));
         assertTrue(CollectionUtils.equals(p2, h1));
         h1.put("zyzzy", "");
         p2.put("zyzzy2", "");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
+        assertFalse(CollectionUtils.equals(h1, p2));
+        assertFalse(CollectionUtils.equals(p2, h1));
         p2.put("zyzzy", "");
         h1.put("zyzzy2", "");
         assertTrue(CollectionUtils.equals(h1, p2));
         assertTrue(CollectionUtils.equals(p2, h1));
         h1.put("dada", "1");
         p2.put("dada", "2");
-        assertTrue(!CollectionUtils.equals(h1, p2));
-        assertTrue(!CollectionUtils.equals(p2, h1));
+        assertFalse(CollectionUtils.equals(h1, p2));
+        assertFalse(CollectionUtils.equals(p2, h1));
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
index 1987236..3bdede4 100644
--- a/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/FileUtilsTest.java
@@ -413,7 +413,7 @@ public class FileUtilsTest {
     @Test
     public void testCreateNewFile() throws IOException {
         removeThis = new File("dummy");
-        assertTrue(!removeThis.exists());
+        assertFalse(removeThis.exists());
         FILE_UTILS.createNewFile(removeThis);
         assertTrue(removeThis.exists());
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
index 409f755..f12f9aa 100644
--- a/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/LayoutPreservingPropertiesTest.java
@@ -126,12 +126,12 @@ public class LayoutPreservingPropertiesTest {
         // and check that the resulting file looks okay
         String s = readFile(tmp);
 
-        assertTrue(!s.contains("\\ prop\\ one\\ =\\ \\ leading and"
+        assertFalse(s.contains("\\ prop\\ one\\ =\\ \\ leading and"
                 + " trailing spaces "));
         assertTrue(s.contains("\\ prop\\ one\\ =new one"));
-        assertTrue(!s.contains("prop\\ttwo=contains\\ttab"));
+        assertFalse(s.contains("prop\\ttwo=contains\\ttab"));
         assertTrue(s.contains("prop\\ttwo=new two"));
-        assertTrue(!s.contains("prop\\nthree=contains\\nnewline"));
+        assertFalse(s.contains("prop\\nthree=contains\\nnewline"));
         assertTrue(s.contains("prop\\nthree=new three"));
     }
 
@@ -291,10 +291,10 @@ public class LayoutPreservingPropertiesTest {
         assertTrue(s.contains("alpha=new value for alpha"));
         assertTrue(s.contains("beta=new value for beta"));
 
-        assertTrue(!s.contains("prop\\:seven=contains\\:colon"));
-        assertTrue(!s.contains("prop\\=eight=contains\\=equals"));
-        assertTrue(!s.contains("alpha:set with a colon"));
-        assertTrue(!s.contains("beta set with a space"));
+        assertFalse(s.contains("prop\\:seven=contains\\:colon"));
+        assertFalse(s.contains("prop\\=eight=contains\\=equals"));
+        assertFalse(s.contains("alpha:set with a colon"));
+        assertFalse(s.contains("beta set with a space"));
     }
 
     private static String readFile(File f) throws IOException {

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
index 576ec77..3967f25 100644
--- a/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/XMLFragmentTest.java
@@ -66,7 +66,7 @@ public class XMLFragmentTest {
         assertEquals(Node.ELEMENT_NODE, nl.item(0).getNodeType());
         Element child1 = (Element) nl.item(0);
         assertEquals("child1", child1.getTagName());
-        assertTrue(!child1.hasAttributes());
+        assertFalse(child1.hasAttributes());
         NodeList nl2 = child1.getChildNodes();
         assertEquals(1, nl2.getLength());
         assertEquals(Node.TEXT_NODE, nl2.item(0).getNodeType());
@@ -83,7 +83,7 @@ public class XMLFragmentTest {
         assertEquals(Node.ELEMENT_NODE, nl.item(2).getNodeType());
         Element child3 = (Element) nl.item(2);
         assertEquals("child3", child3.getTagName());
-        assertTrue(!child3.hasAttributes());
+        assertFalse(child3.hasAttributes());
         nl2 = child3.getChildNodes();
         assertEquals(1, nl2.getLength());
         assertEquals(Node.ELEMENT_NODE, nl2.item(0).getNodeType());

http://git-wip-us.apache.org/repos/asf/ant/blob/4a242817/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
index 6220955..d75cc05 100644
--- a/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/facade/FacadeTaskHelperTest.java
@@ -58,7 +58,7 @@ public class FacadeTaskHelperTest {
         fth.setMagicValue("foo");
         assertTrue("magic has been set", fth.hasBeenSet());
         fth.setMagicValue(null);
-        assertTrue(!fth.hasBeenSet());
+        assertFalse(fth.hasBeenSet());
         fth.setImplementation("baz");
         assertTrue("set explicitly", fth.hasBeenSet());
     }


[3/6] ant git commit: Checkstyle and simplify, next iteration

Posted by gi...@apache.org.
http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/LazyHashtable.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LazyHashtable.java b/src/main/org/apache/tools/ant/util/LazyHashtable.java
index 9ef9091..e9632b8 100644
--- a/src/main/org/apache/tools/ant/util/LazyHashtable.java
+++ b/src/main/org/apache/tools/ant/util/LazyHashtable.java
@@ -29,7 +29,7 @@ import java.util.Hashtable;
  * @since Ant 1.6
  */
 @Deprecated
-public class LazyHashtable extends Hashtable {
+public class LazyHashtable<K, V> extends Hashtable<K, V> {
     // CheckStyle:VisibilityModifier OFF - bc
     protected boolean initAllDone = false;
     // CheckStyle:VisibilityModifier OFF - bc
@@ -55,7 +55,7 @@ public class LazyHashtable extends Hashtable {
      * Get a enumeration over the elements.
      * @return an enumeration.
      */
-    public Enumeration elements() {
+    public Enumeration<V> elements() {
         initAll();
         return super.elements();
     }
@@ -111,7 +111,7 @@ public class LazyHashtable extends Hashtable {
      * Get an enumeration over the keys.
      * @return an enumeration.
      */
-    public Enumeration keys() {
+    public Enumeration<K> keys() {
         initAll();
         return super.keys();
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java
index 1813061..f54a79f 100644
--- a/src/main/org/apache/tools/ant/util/ResourceUtils.java
+++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java
@@ -796,14 +796,9 @@ public class ResourceUtils {
             return false;
         }
         final FileProvider fileResource1 = resource1.as(FileProvider.class);
-        if (fileResource1 == null) {
-            return false;
-        }
         final FileProvider fileResource2 = resource2.as(FileProvider.class);
-        if (fileResource2 == null) {
-            return false;
-        }
-        return FileUtils.getFileUtils().areSame(fileResource1.getFile(), fileResource2.getFile());
+        return fileResource1 != null && fileResource2 != null
+                && FileUtils.getFileUtils().areSame(fileResource1.getFile(), fileResource2.getFile());
     }
 
     private static void log(final Project project, final String message) {

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java b/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
index ac27b99..8eb3561 100644
--- a/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
+++ b/src/main/org/apache/tools/ant/util/regexp/Jdk14RegexpMatcher.java
@@ -61,9 +61,8 @@ public class Jdk14RegexpMatcher implements RegexpMatcher {
      */
     protected Pattern getCompiledPattern(int options)
         throws BuildException {
-        int cOptions = getCompilerOptions(options);
         try {
-            return Pattern.compile(this.pattern, cOptions);
+            return Pattern.compile(this.pattern, getCompilerOptions(options));
         } catch (PatternSyntaxException e) {
             throw new BuildException(e);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/bzip2/BlockSort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/BlockSort.java b/src/main/org/apache/tools/bzip2/BlockSort.java
index f165b9b..d39d705 100644
--- a/src/main/org/apache/tools/bzip2/BlockSort.java
+++ b/src/main/org/apache/tools/bzip2/BlockSort.java
@@ -729,10 +729,8 @@ class BlockSort {
                                                 }
                                                 break;
                                             } // while x > 0
-                                            else {
-                                                if ((block[i1] & 0xff) <= (block[i2] & 0xff)) {
-                                                    break;
-                                                }
+                                            else if ((block[i1] & 0xff) <= (block[i2] & 0xff)) {
+                                                break;
                                             }
                                         } else if ((block[i1 + 5] & 0xff) <= (block[i2 + 5] & 0xff)) {
                                             break;

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
index 0e000e3..e4d4980 100644
--- a/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
+++ b/src/main/org/apache/tools/bzip2/CBZip2InputStream.java
@@ -74,7 +74,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
 
     private int currentChar = -1;
 
-    private static final int EOF                  = 0;
+    private static final int EOF               = 0;
     private static final int START_BLOCK_STATE = 1;
     private static final int RAND_PART_A_STATE = 2;
     private static final int RAND_PART_B_STATE = 3;
@@ -85,8 +85,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
 
     private int currentState = START_BLOCK_STATE;
 
-    private int storedBlockCRC, storedCombinedCRC;
-    private int computedBlockCRC, computedCombinedCRC;
+    private int storedBlockCRC;
+    private int storedCombinedCRC;
+    private int computedBlockCRC;
+    private int computedCombinedCRC;
 
     // Variables used by setup* methods exclusively
 

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/tar/TarEntry.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/tar/TarEntry.java b/src/main/org/apache/tools/tar/TarEntry.java
index c565812..e7fe561 100644
--- a/src/main/org/apache/tools/tar/TarEntry.java
+++ b/src/main/org/apache/tools/tar/TarEntry.java
@@ -343,10 +343,7 @@ public class TarEntry implements TarConstants {
      */
     @Override
     public boolean equals(Object it) {
-        if (it == null || getClass() != it.getClass()) {
-            return false;
-        }
-        return equals((TarEntry) it);
+        return it != null && getClass() == it.getClass() && equals((TarEntry) it);
     }
 
     /**
@@ -425,7 +422,7 @@ public class TarEntry implements TarConstants {
      */
     @Deprecated
     public int getUserId() {
-        return (int) (userId & 0xffffffff);
+        return (int) userId;
     }
 
     /**
@@ -466,7 +463,7 @@ public class TarEntry implements TarConstants {
      */
     @Deprecated
     public int getGroupId() {
-        return (int) (groupId & 0xffffffff);
+        return (int) groupId;
     }
 
     /**
@@ -753,13 +750,8 @@ public class TarEntry implements TarConstants {
      * @return <i>true</i> if it is a 'normal' file
      */
     public boolean isFile() {
-        if (file != null) {
-            return file.isFile();
-        }
-        if (linkFlag == LF_OLDNORM || linkFlag == LF_NORMAL) {
-            return true;
-        }
-        return !getName().endsWith("/");
+        return file != null ? file.isFile()
+                : linkFlag == LF_OLDNORM || linkFlag == LF_NORMAL || !getName().endsWith("/");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/zip/ZipEightByteInteger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipEightByteInteger.java b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
index c76b5d0..46ba932 100644
--- a/src/main/org/apache/tools/zip/ZipEightByteInteger.java
+++ b/src/main/org/apache/tools/zip/ZipEightByteInteger.java
@@ -207,10 +207,8 @@ public final class ZipEightByteInteger {
      */
     @Override
     public boolean equals(Object o) {
-        if (o instanceof ZipEightByteInteger) {
-            return value.equals(((ZipEightByteInteger) o).getValue());
-        }
-        return false;
+        return o instanceof ZipEightByteInteger
+                && value.equals(((ZipEightByteInteger) o).getValue());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/zip/ZipLong.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipLong.java b/src/main/org/apache/tools/zip/ZipLong.java
index a84da70..69d6ca4 100644
--- a/src/main/org/apache/tools/zip/ZipLong.java
+++ b/src/main/org/apache/tools/zip/ZipLong.java
@@ -168,10 +168,7 @@ public final class ZipLong implements Cloneable {
      */
     @Override
     public boolean equals(Object o) {
-        if (o instanceof ZipLong) {
-            return value == ((ZipLong) o).getValue();
-        }
-        return false;
+        return o instanceof ZipLong && value == ((ZipLong) o).getValue();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/zip/ZipShort.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/ZipShort.java b/src/main/org/apache/tools/zip/ZipShort.java
index e18c0d4..3dbe2cb 100644
--- a/src/main/org/apache/tools/zip/ZipShort.java
+++ b/src/main/org/apache/tools/zip/ZipShort.java
@@ -133,10 +133,7 @@ public final class ZipShort implements Cloneable {
      */
     @Override
     public boolean equals(Object o) {
-        if (o instanceof ZipShort) {
-            return value == ((ZipShort) o).getValue();
-        }
-        return false;
+        return o instanceof ZipShort && value == ((ZipShort) o).getValue();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
index 9fc03c7..bc0d127 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DirnameTest.java
@@ -29,6 +29,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import java.io.File;
+
 /**
  */
 public class DirnameTest {
@@ -75,8 +77,7 @@ public class DirnameTest {
     public void test4() {
         assumeFalse("Test not possible on DOS or Netware family OS", Os.isFamily("netware") || Os.isFamily("dos"));
         buildRule.executeTarget("test4");
-        String filesep = System.getProperty("file.separator");
-        String expected = filesep + "usr" + filesep + "local";
+        String expected = File.separator + "usr" + File.separator + "local";
         String checkprop = buildRule.getProject().getProperty("local.dir");
         assertEquals("dirname failed", expected, checkprop);
     }


[6/6] ant git commit: Avoid line.separator

Posted by gi...@apache.org.
Avoid line.separator

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/845c2c5b
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/845c2c5b
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/845c2c5b

Branch: refs/heads/master
Commit: 845c2c5b393951d3e1828d992feff50a65d02772
Parents: 02adb46
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Thu Apr 5 07:33:06 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Thu Apr 5 07:33:06 2018 +0200

----------------------------------------------------------------------
 .../org/apache/tools/ant/DefaultLogger.java     |  3 ++-
 src/main/org/apache/tools/ant/Main.java         |  2 +-
 .../org/apache/tools/ant/ProjectHelper.java     |  6 ++---
 .../tools/ant/TaskConfigurationChecker.java     | 10 +++-----
 .../tools/ant/filters/util/JavaClassHelper.java |  8 +------
 .../apache/tools/ant/taskdefs/AntStructure.java | 24 +++++++-------------
 .../org/apache/tools/ant/taskdefs/Copy.java     | 14 ++++++------
 src/main/org/apache/tools/ant/taskdefs/Jar.java |  5 +---
 .../compilers/DefaultCompilerAdapter.java       |  1 +
 .../ant/taskdefs/cvslib/ChangeLogParser.java    |  8 +++----
 .../tools/ant/taskdefs/optional/NetRexxC.java   |  4 +---
 .../compilers/DefaultJspCompilerAdapter.java    | 11 ++++-----
 .../ant/taskdefs/optional/junit/JUnitTask.java  | 11 ++++-----
 .../junit/SummaryJUnitResultFormatter.java      | 14 ++++--------
 .../AbstractJUnitResultFormatter.java           |  2 --
 .../LegacyPlainResultFormatter.java             |  3 +--
 .../org/apache/tools/ant/types/Commandline.java | 18 ++++-----------
 .../apache/tools/ant/util/DOMElementWriter.java |  8 +++----
 .../LineOrientedOutputStreamRedirector.java     |  9 ++------
 .../org/apache/tools/ant/util/StringUtils.java  |  2 +-
 .../apache/tools/ant/taskdefs/CVSPassTest.java  |  2 +-
 .../apache/tools/ant/taskdefs/ConcatTest.java   |  2 +-
 22 files changed, 58 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/DefaultLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/DefaultLogger.java b/src/main/org/apache/tools/ant/DefaultLogger.java
index db3cb68..cebd26f 100644
--- a/src/main/org/apache/tools/ant/DefaultLogger.java
+++ b/src/main/org/apache/tools/ant/DefaultLogger.java
@@ -58,6 +58,7 @@ public class DefaultLogger implements BuildLogger {
 
     // CheckStyle:ConstantNameCheck OFF - bc
     /** Line separator */
+    @Deprecated
     protected static final String lSep = StringUtils.LINE_SEP;
     // CheckStyle:ConstantNameCheck ON
 
@@ -149,7 +150,7 @@ public class DefaultLogger implements BuildLogger {
         if (verbose || !(error instanceof BuildException)) {
             m.append(StringUtils.getStackTrace(error));
         } else {
-            m.append(error).append(lSep);
+            m.append(error).append(StringUtils.LINE_SEP);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/Main.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Main.java b/src/main/org/apache/tools/ant/Main.java
index 260581e..242e432 100644
--- a/src/main/org/apache/tools/ant/Main.java
+++ b/src/main/org/apache/tools/ant/Main.java
@@ -1269,7 +1269,7 @@ public class Main implements AntMain {
                                      final String heading,
                                      final int maxlen) {
         // now, start printing the targets and their descriptions
-        final String lSep = System.getProperty("line.separator");
+        final String lSep = System.lineSeparator();
         // got a bit annoyed that I couldn't find a pad function
         StringBuilder spaces = new StringBuilder("    ");
         while (spaces.length() <= maxlen) {

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/ProjectHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java
index 84a8991..64a2ea5 100644
--- a/src/main/org/apache/tools/ant/ProjectHelper.java
+++ b/src/main/org/apache/tools/ant/ProjectHelper.java
@@ -556,10 +556,8 @@ public class ProjectHelper {
             return ex;
         }
         String errorMessage
-            = "The following error occurred while executing this line:"
-            + System.getProperty("line.separator")
-            + ex.getLocation().toString()
-            + ex.getMessage();
+            = String.format("The following error occurred while executing this line:%n%s%s",
+                ex.getLocation().toString(), ex.getMessage());
         if (ex instanceof ExitStatusException) {
             int exitStatus = ((ExitStatusException) ex).getStatus();
             if (newLocation == null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/TaskConfigurationChecker.java b/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
index 942b2dc..ce6bcf6 100644
--- a/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
+++ b/src/main/org/apache/tools/ant/TaskConfigurationChecker.java
@@ -94,14 +94,10 @@ public class TaskConfigurationChecker {
      */
     public void checkErrors() throws BuildException {
         if (!errors.isEmpty()) {
-            StringBuilder sb = new StringBuilder("Configuration error on <");
-            sb.append(task.getTaskName());
-            sb.append(">:");
-            sb.append(System.getProperty("line.separator"));
+            StringBuilder sb = new StringBuilder(String.format("Configuration error on <%s>:%n",
+                    task.getTaskName()));
             for (String msg : errors) {
-                sb.append("- ");
-                sb.append(msg);
-                sb.append(System.getProperty("line.separator"));
+                sb.append(String.format("- %s%n", msg));
             }
             throw new BuildException(sb.toString(), task.getLocation());
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
index f60f3ad..70d763f 100644
--- a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
+++ b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
@@ -31,9 +31,6 @@ import org.apache.bcel.classfile.JavaClass;
  *
  */
 public final class JavaClassHelper {
-    /** System specific line separator. */
-    private static final String LS = System.getProperty("line.separator");
-
     /**
      * Get the constants declared in a file as name=value
      *
@@ -55,10 +52,7 @@ public final class JavaClassHelper {
                     if (cvs.startsWith("\"") && cvs.endsWith("\"")) {
                         cvs = cvs.substring(1, cvs.length() - 1);
                     }
-                    sb.append(field.getName());
-                    sb.append('=');
-                    sb.append(cvs);
-                    sb.append(LS);
+                    sb.append(String.format("%s=%s%n", field.getName(), cvs));
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
index 49ff449..ffe5366 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -54,9 +54,6 @@ import org.apache.tools.ant.util.FileUtils;
  */
 public class AntStructure extends Task {
 
-    private static final String LINE_SEP
-        = System.getProperty("line.separator");
-
     private File output;
     private StructurePrinter printer = new DTDPrinter();
 
@@ -293,15 +290,12 @@ public class AntStructure extends Task {
                 return;
             }
 
-            StringBuilder sb =
-                new StringBuilder("<!ELEMENT ").append(name).append(" ");
+            StringBuilder sb = new StringBuilder("<!ELEMENT ").append(name).append(" ");
 
             if (Reference.class.equals(element)) {
-                sb.append("EMPTY>").append(LINE_SEP);
-                sb.append("<!ATTLIST ").append(name);
-                sb.append(LINE_SEP).append("          id ID #IMPLIED");
-                sb.append(LINE_SEP).append("          refid IDREF #IMPLIED");
-                sb.append(">").append(LINE_SEP);
+                sb.append(String.format("EMPTY>%n<!ATTLIST %s%n"
+                                + "          id ID #IMPLIED%n          refid IDREF #IMPLIED>%n",
+                        name));
                 out.println(sb);
                 return;
             }
@@ -334,9 +328,8 @@ public class AntStructure extends Task {
             sb.append(">");
             out.println(sb);
 
-            sb = new StringBuilder("<!ATTLIST ");
-            sb.append(name);
-            sb.append(LINE_SEP).append("          id ID #IMPLIED");
+            sb = new StringBuilder();
+            sb.append(String.format("<!ATTLIST %s%n          id ID #IMPLIED", name));
 
             e = ih.getAttributes();
             while (e.hasMoreElements()) {
@@ -345,8 +338,7 @@ public class AntStructure extends Task {
                     continue;
                 }
 
-                sb.append(LINE_SEP).append("          ")
-                    .append(attrName).append(" ");
+                sb.append(String.format("%n          %s ", attrName));
                 final Class<?> type = ih.getAttributeType(attrName);
                 if (type.equals(Boolean.class) || type.equals(Boolean.TYPE)) {
                     sb.append(BOOLEAN).append(" ");
@@ -384,7 +376,7 @@ public class AntStructure extends Task {
                 }
                 sb.append("#IMPLIED");
             }
-            sb.append(">").append(LINE_SEP);
+            sb.append(">").append(System.lineSeparator());
             out.println(sb);
 
             for (String nestedName : v) {

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/Copy.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java
index a492150..d1fcec9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Copy.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java
@@ -50,6 +50,7 @@ import org.apache.tools.ant.util.IdentityMapper;
 import org.apache.tools.ant.util.LinkedHashtable;
 import org.apache.tools.ant.util.ResourceUtils;
 import org.apache.tools.ant.util.SourceFileScanner;
+import org.apache.tools.ant.util.StringUtils;
 
 /**
  * <p>Copies a file or directory to a new file
@@ -70,8 +71,9 @@ public class Copy extends Task {
     private static final String MSG_WHEN_COPYING_EMPTY_RC_TO_FILE =
         "Cannot perform operation from directory to file.";
 
+    @Deprecated
+    static final String LINE_SEPARATOR = StringUtils.LINE_SEP;
     static final File NULL_FILE_PLACEHOLDER = new File("/NULL_FILE");
-    static final String LINE_SEPARATOR = System.getProperty("line.separator");
     // CheckStyle:VisibilityModifier OFF - bc
     protected File file = null;     // the source file
     protected File destFile = null; // the destination file
@@ -1083,15 +1085,13 @@ public class Copy extends Task {
             message.append(ex.getMessage());
         }
         if (ex.getClass().getName().contains("MalformedInput")) {
-            message.append(LINE_SEPARATOR);
-            message.append(
-                "This is normally due to the input file containing invalid");
-             message.append(LINE_SEPARATOR);
-            message.append("bytes for the character encoding used : ");
+            message.append(String.format(
+                    "%nThis is normally due to the input file containing invalid"
+                            + "%nbytes for the character encoding used : "));
             message.append(
                 (inputEncoding == null
                  ? fileUtils.getDefaultEncoding() : inputEncoding));
-            message.append(LINE_SEPARATOR);
+            message.append(System.lineSeparator());
         }
         return message.toString();
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/Jar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java
index fafa597..437aaa3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Jar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java
@@ -906,7 +906,6 @@ public class Jar extends Zip {
      */
     // CheckStyle:LineLength ON
     private void checkJarSpec() {
-        String br = System.getProperty("line.separator");
         StringBuilder message = new StringBuilder();
         Section mainSection = (configuredManifest == null)
                             ? null
@@ -929,9 +928,7 @@ public class Jar extends Zip {
         }
 
         if (message.length() > 0) {
-            message.append(br);
-            message.append("Location: ").append(getLocation());
-            message.append(br);
+            message.append(String.format("%nLocation: %s%n", getLocation()));
             if ("fail".equalsIgnoreCase(strict.getValue())) {
                 throw new BuildException(message.toString(), getLocation());
             }

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
index 9ed7017..1e0ad54 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
@@ -63,6 +63,7 @@ public abstract class DefaultCompilerAdapter
 
     //must keep for subclass BC, though unused:
     // CheckStyle:ConstantNameCheck OFF - bc
+    @Deprecated
     protected static final String lSep = StringUtils.LINE_SEP;
     // CheckStyle:ConstantNameCheck ON
 

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
index 15f8678..b3ea9f0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
+++ b/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java
@@ -31,6 +31,7 @@ import java.util.TimeZone;
 
 import org.apache.tools.ant.taskdefs.AbstractCvsTask;
 import org.apache.tools.ant.taskdefs.AbstractCvsTask.Module;
+import org.apache.tools.ant.util.StringUtils;
 
 /**
  * A class used to parse the output of the CVS log command.
@@ -146,23 +147,22 @@ class ChangeLogParser {
      * @param line the line
      */
     private void processComment(final String line) {
-        final String lineSeparator = System.getProperty("line.separator");
         if ("============================================================================="
             .equals(line)) {
             //We have ended changelog for that particular file
             //so we can save it
             final int end
-                = comment.length() - lineSeparator.length(); //was -1
+                = comment.length() - StringUtils.LINE_SEP.length(); //was -1
             comment = comment.substring(0, end);
             saveEntry();
             status = GET_FILE;
         } else if ("----------------------------".equals(line)) {
             final int end
-                = comment.length() - lineSeparator.length(); //was -1
+                = comment.length() - StringUtils.LINE_SEP.length(); //was -1
             comment = comment.substring(0, end);
             status = GET_PREVIOUS_REV;
         } else {
-            comment += line + lineSeparator;
+            comment += line + StringUtils.LINE_SEP;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index a1261f8..c978638 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -777,9 +777,7 @@ public class NetRexxC extends MatchingTask {
 
         log("Files to be compiled:", Project.MSG_VERBOSE);
 
-        final String eol = System.getProperty("line.separator");
-        log(
-            compileList.stream().map(s -> "    " + s).collect(Collectors.joining(eol)),
+        log(compileList.stream().map(s -> "    " + s).collect(Collectors.joining(System.lineSeparator())),
                 Project.MSG_VERBOSE);
 
         // create a single array of arguments for the compiler

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
index 6b8dde3..c9de17c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jsp/compilers/DefaultJspCompilerAdapter.java
@@ -35,8 +35,6 @@ import org.apache.tools.ant.types.CommandlineJava;
 public abstract class DefaultJspCompilerAdapter
     implements JspCompilerAdapter {
 
-    private static String lSep = System.lineSeparator();
-
     /**
      * Logs the compilation parameters, adds the files to compile and logs the
      * &quot;niceSourceList&quot;
@@ -50,13 +48,12 @@ public abstract class DefaultJspCompilerAdapter
         jspc.log("Compilation " + cmd.describeJavaCommand(),
                  Project.MSG_VERBOSE);
 
-        String niceSourceList = (compileList.size() == 1 ? "File" : "Files") +
-                " to be compiled:" + lSep +
-                compileList.stream()
+        String niceSourceList = compileList.stream()
                         .peek(arg -> cmd.createArgument().setValue(arg))
                         .map(arg -> "    " + arg)
-                        .collect(Collectors.joining(lSep));
-        jspc.log(niceSourceList, Project.MSG_VERBOSE);
+                        .collect(Collectors.joining(System.lineSeparator()));
+        jspc.log(String.format("File%s to be compiled:%n%s",
+                compileList.size() == 1 ? "" : "s", niceSourceList), Project.MSG_VERBOSE);
     }
 
     // CheckStyle:VisibilityModifier OFF - bc

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index 03f34ce..060f748 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -133,8 +133,6 @@ import org.apache.tools.ant.util.StringUtils;
  */
 public class JUnitTask extends Task {
 
-    private static final String LINE_SEP
-        = System.getProperty("line.separator");
     private static final String CLASSPATH = "CLASSPATH";
 
     private static final int STRING_BUFFER_SIZE = 128;
@@ -1381,11 +1379,10 @@ public class JUnitTask extends Task {
                      e.hasMoreElements();) {
                     final URL current = e.nextElement();
                     if (previous != null && !urlEquals(current, previous)) {
-                        log("WARNING: multiple versions of ant detected "
-                            + "in path for junit "
-                            + LINE_SEP + "         " + previous
-                            + LINE_SEP + "     and " + current,
-                            Project.MSG_WARN);
+                        log(String.format(
+                                "WARNING: multiple versions of ant detected in path for junit%n"
+                                        + "         %s%n     and %s", previous, current),
+                                Project.MSG_WARN);
                         return;
                     }
                     previous = current;

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
index 27239d6..264c3b0 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/SummaryJUnitResultFormatter.java
@@ -77,7 +77,6 @@ public class SummaryJUnitResultFormatter
      */
     @Override
     public void startTestSuite(JUnitTest suite) {
-        String newLine = System.getProperty("line.separator");
         StringBuilder sb = new StringBuilder("Running ");
         int antThreadID = suite.getThread();
 
@@ -87,7 +86,7 @@ public class SummaryJUnitResultFormatter
             sb.append(" in thread ");
             sb.append(antThreadID);
         }
-        sb.append(newLine);
+        sb.append(System.lineSeparator());
         writeOutputLine(sb.toString().getBytes());
     }
     /**
@@ -166,8 +165,7 @@ public class SummaryJUnitResultFormatter
      */
     @Override
     public void endTestSuite(JUnitTest suite) throws BuildException {
-        String newLine = System.getProperty("line.separator");
-        StringBuilder sb = new StringBuilder("Tests run: ");
+         StringBuilder sb = new StringBuilder("Tests run: ");
         sb.append(suite.runCount());
         sb.append(", Failures: ");
         sb.append(suite.failureCount());
@@ -189,17 +187,15 @@ public class SummaryJUnitResultFormatter
             sb.append(", Class: ");
             sb.append(suite.getName());
         }
-        sb.append(newLine);
+        sb.append(System.lineSeparator());
 
         if (withOutAndErr) {
             if (systemOutput != null && systemOutput.length() > 0) {
-                sb.append("Output:").append(newLine).append(systemOutput)
-                    .append(newLine);
+                sb.append(String.format("Output:%n%s%n", systemOutput));
             }
 
             if (systemError != null && systemError.length() > 0) {
-                sb.append("Error: ").append(newLine).append(systemError)
-                    .append(newLine);
+                sb.append(String.format("Output:%n%s%n", systemError));
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
index e28e826..16ff97f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/AbstractJUnitResultFormatter.java
@@ -28,8 +28,6 @@ import java.util.Optional;
  */
 abstract class AbstractJUnitResultFormatter implements TestResultFormatter {
 
-
-    protected static String NEW_LINE = System.getProperty("line.separator");
     protected TestExecutionContext context;
 
     private SysOutErrContentStore sysOutStore;

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java
index 49ce7e3..0e6dab7 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LegacyPlainResultFormatter.java
@@ -258,8 +258,7 @@ class LegacyPlainResultFormatter extends AbstractJUnitResultFormatter implements
             return;
         }
         final Throwable throwable = result.getThrowable().get();
-        sb.append(": ").append(throwable.getMessage());
-        sb.append(NEW_LINE);
+        sb.append(String.format(": %s%n", throwable.getMessage()));
         final StringWriter stacktrace = new StringWriter();
         throwable.printStackTrace(new PrintWriter(stacktrace));
         sb.append(stacktrace.toString());

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/types/Commandline.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/Commandline.java b/src/main/org/apache/tools/ant/types/Commandline.java
index 2355fb7..f843801 100644
--- a/src/main/org/apache/tools/ant/types/Commandline.java
+++ b/src/main/org/apache/tools/ant/types/Commandline.java
@@ -66,12 +66,8 @@ public class Commandline implements Cloneable {
      */
     private String executable = null;
 
-    protected static final String DISCLAIMER =
-        StringUtils.LINE_SEP
-        + "The \' characters around the executable and arguments are"
-        + StringUtils.LINE_SEP
-        + "not part of the command."
-        + StringUtils.LINE_SEP;
+    protected static final String DISCLAIMER = String.format(
+            "%nThe ' characters around the executable and arguments are%nnot part of the command.%n");
 
     /**
      * Create a command line from a string.
@@ -676,14 +672,10 @@ public class Commandline implements Cloneable {
         if (args == null || args.length <= offset) {
             return "";
         }
-        StringBuilder buf = new StringBuilder("argument");
-        if (args.length > offset) {
-            buf.append("s");
-        }
-        buf.append(":").append(StringUtils.LINE_SEP);
+        StringBuilder buf = new StringBuilder();
+        buf.append(String.format("argument%s:%n", args.length > offset ? "s" : ""));
         for (int i = offset; i < args.length; i++) {
-            buf.append("\'").append(args[i]).append("\'")
-                .append(StringUtils.LINE_SEP);
+            buf.append(String.format("\'%s\'%n", args[i]));
         }
         buf.append(DISCLAIMER);
         return buf.toString();

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
index 18de730..0104c34 100644
--- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java
+++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
@@ -151,8 +151,6 @@ public class DOMElementWriter {
         this.namespacePolicy = namespacePolicy;
     }
 
-    private static String lSep = System.getProperty("line.separator");
-
     // CheckStyle:VisibilityModifier OFF - bc
     /**
      * Don't try to be too smart but at least recognize the predefined
@@ -219,7 +217,7 @@ public class DOMElementWriter {
                 case Node.ELEMENT_NODE:
                     hasChildElements = true;
                     if (i == 0) {
-                        out.write(lSep);
+                        out.write(StringUtils.LINE_SEP);
                     }
                     write((Element) child, out, indent + 1, indentWith);
                     break;
@@ -367,7 +365,7 @@ public class DOMElementWriter {
         } else {
             removeNSDefinitions(element);
             out.write(" />");
-            out.write(lSep);
+            out.write(StringUtils.LINE_SEP);
             out.flush();
         }
     }
@@ -408,7 +406,7 @@ public class DOMElementWriter {
         }
         out.write(element.getTagName());
         out.write(">");
-        out.write(lSep);
+        out.write(StringUtils.LINE_SEP);
         out.flush();
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java b/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java
index 48bad5c..7adab10 100644
--- a/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java
+++ b/src/main/org/apache/tools/ant/util/LineOrientedOutputStreamRedirector.java
@@ -34,11 +34,6 @@ public class LineOrientedOutputStreamRedirector
 
     private OutputStream stream;
 
-    // these should be in the ASCII range and hopefully are single bytes
-    // (for LF and CR respectively) for any encoding thrown at this class
-    private static final byte[] EOL =
-        System.getProperty("line.separator").getBytes();
-
     public LineOrientedOutputStreamRedirector(OutputStream stream) {
         this.stream = stream;
     }
@@ -46,12 +41,12 @@ public class LineOrientedOutputStreamRedirector
     @Override
     protected void processLine(byte[] b) throws IOException {
         stream.write(b);
-        stream.write(EOL);
+        stream.write(System.lineSeparator().getBytes());
     }
 
     @Override
     protected void processLine(String line) throws IOException {
-        stream.write((line + System.getProperty("line.separator")).getBytes());
+        stream.write(String.format("%s%n", line).getBytes());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/main/org/apache/tools/ant/util/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/StringUtils.java b/src/main/org/apache/tools/ant/util/StringUtils.java
index 7e3123c..c9f4f7a 100644
--- a/src/main/org/apache/tools/ant/util/StringUtils.java
+++ b/src/main/org/apache/tools/ant/util/StringUtils.java
@@ -45,7 +45,7 @@ public final class StringUtils {
     }
 
     /** the line separator for this OS */
-    public static final String LINE_SEP = System.getProperty("line.separator");
+    public static final String LINE_SEP = System.lineSeparator();
 
     /**
      * Splits up a string into a list of lines. It is equivalent

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
index 63ee645..a83a9c3 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CVSPassTest.java
@@ -37,7 +37,7 @@ import static org.junit.Assert.fail;
  *
  */
 public class CVSPassTest {
-    private final String EOL = System.getProperty("line.separator");
+    private final String EOL = System.lineSeparator();
     private static final String JAKARTA_URL =
         ":pserver:anoncvs@jakarta.apache.org:/home/cvspublic Ay=0=h<Z";
     private static final String XML_URL =

http://git-wip-us.apache.org/repos/asf/ant/blob/845c2c5b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
index 58b883d..2491937 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/ConcatTest.java
@@ -270,7 +270,7 @@ public class ConcatTest {
     @Test
     public void testfixlastline() throws IOException {
         buildRule.executeTarget("testfixlastline");
-        assertContains("end of line" + System.getProperty("line.separator") + "This has",
+        assertContains("end of line" + System.lineSeparator() + "This has",
                 FileUtilities.getFileContents(buildRule.getProject(), "concat.line4"));
     }
 


[5/6] ant git commit: POSIX tar specifies 64-bit UID/GID

Posted by gi...@apache.org.
POSIX tar specifies 64-bit UID/GID

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/02adb467
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/02adb467
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/02adb467

Branch: refs/heads/master
Commit: 02adb467e426de1a62a76105c36ecd645b1024bd
Parents: dccbf1f
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Thu Apr 5 07:29:33 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Thu Apr 5 07:29:33 2018 +0200

----------------------------------------------------------------------
 src/main/org/apache/tools/ant/taskdefs/Tar.java |  4 +--
 .../tools/ant/types/resources/TarResource.java  | 34 +++++++++++++++-----
 2 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/02adb467/src/main/org/apache/tools/ant/taskdefs/Tar.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Tar.java b/src/main/org/apache/tools/ant/taskdefs/Tar.java
index 51bb8cd..737e68c 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Tar.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Tar.java
@@ -461,9 +461,9 @@ public class Tar extends MatchingTask {
             if (r instanceof TarResource) {
                 final TarResource tr = (TarResource) r;
                 te.setUserName(tr.getUserName());
-                te.setUserId(tr.getUid());
+                te.setUserId(tr.getLongUid());
                 te.setGroupName(tr.getGroup());
-                te.setGroupId(tr.getGid());
+                te.setGroupId(tr.getLongGid());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/02adb467/src/main/org/apache/tools/ant/types/resources/TarResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/TarResource.java b/src/main/org/apache/tools/ant/types/resources/TarResource.java
index 36b0e38..1279bd8 100644
--- a/src/main/org/apache/tools/ant/types/resources/TarResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/TarResource.java
@@ -37,8 +37,8 @@ public class TarResource extends ArchiveResource {
 
     private String userName = "";
     private String groupName = "";
-    private int    uid;
-    private int    gid;
+    private long   uid;
+    private long   gid;
 
     /**
      * Default constructor.
@@ -134,27 +134,45 @@ public class TarResource extends ArchiveResource {
 
     /**
      * @return the uid for the tar entry
+     * @since 1.10.4
      */
-    public int getUid() {
+    public long getLongUid() {
         if (isReference()) {
-            return getCheckedRef().getUid();
+            return getCheckedRef().getLongUid();
         }
         checkEntry();
         return uid;
     }
 
     /**
+     * @return the uid for the tar entry
+     */
+    @Deprecated
+    public int getUid() {
+        return (int) getLongUid();
+    }
+
+    /**
      * @return the gid for the tar entry
+     * @since 1.10.4
      */
-    public int getGid() {
+    public long getLongGid() {
         if (isReference()) {
-            return getCheckedRef().getGid();
+            return getCheckedRef().getLongGid();
         }
         checkEntry();
         return gid;
     }
 
     /**
+     * @return the uid for the tar entry
+     */
+    @Deprecated
+    public int getGid() {
+        return (int) getLongGid();
+    }
+
+    /**
      * fetches information from the named entry inside the archive.
      */
     @Override
@@ -194,8 +212,8 @@ public class TarResource extends ArchiveResource {
         setMode(e.getMode());
         userName = e.getUserName();
         groupName = e.getGroupName();
-        uid = e.getUserId();
-        gid = e.getGroupId();
+        uid = e.getLongUserId();
+        gid = e.getLongGroupId();
     }
 
 }


[2/6] ant git commit: Statically import string contains assertions

Posted by gi...@apache.org.
Statically import string contains assertions

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/cdb0348e
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/cdb0348e
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/cdb0348e

Branch: refs/heads/master
Commit: cdb0348e9dbdd4a65673dfc1775995539cff9521
Parents: 4a24281
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Wed Apr 4 15:27:06 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Wed Apr 4 15:27:06 2018 +0200

----------------------------------------------------------------------
 .../tools/ant/taskdefs/AbstractCvsTaskTest.java |  6 +++---
 .../org/apache/tools/ant/taskdefs/AntTest.java  | 10 ++++-----
 .../tools/ant/taskdefs/CallTargetTest.java      |  6 +++---
 .../apache/tools/ant/taskdefs/FixCrLfTest.java  |  4 ++--
 .../org/apache/tools/ant/taskdefs/GetTest.java  | 15 ++++++-------
 .../tools/ant/taskdefs/RmicAdvancedTest.java    |  4 ++--
 .../taskdefs/condition/IsFileSelectedTest.java  |  6 +++---
 .../ant/taskdefs/condition/IsReachableTest.java |  6 +++---
 .../ant/taskdefs/condition/TypeFoundTest.java   |  6 +++---
 .../taskdefs/optional/SchemaValidateTest.java   | 12 +++++------
 .../ant/taskdefs/optional/image/ImageTest.java  | 18 ++++++++--------
 .../taskdefs/optional/jdepend/JDependTest.java  | 15 ++++++-------
 .../org/apache/tools/ant/types/AddTypeTest.java | 22 ++++++++++----------
 .../org/apache/tools/ant/types/PolyTest.java    | 11 +++++-----
 .../tools/ant/types/RedirectorElementTest.java  |  4 ++--
 .../types/selectors/ModifiedSelectorTest.java   |  4 ++--
 16 files changed, 76 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java
index 39aed26..1f5ceea 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AbstractCvsTaskTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.After;
 import org.junit.Before;
@@ -26,6 +25,7 @@ import org.junit.Test;
 
 import java.io.File;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -57,7 +57,7 @@ public class AbstractCvsTaskTest {
         File f = new File(buildRule.getProject().getProperty("output") + "/src/Makefile");
         assertFalse("starting empty", f.exists());
         buildRule.executeTarget("package-attribute");
-        AntAssert.assertContains("U src/Makefile", buildRule.getLog());
+        assertContains("U src/Makefile", buildRule.getLog());
         assertTrue("now it is there", f.exists());
     }
 
@@ -66,7 +66,7 @@ public class AbstractCvsTaskTest {
         File f = new File(buildRule.getProject().getProperty("output") + "/src/Makefile");
         assertFalse("starting empty", f.exists());
         buildRule.executeTarget("tag-attribute");
-        AntAssert.assertContains("OPENBSD_5_3", buildRule.getLog());
+        assertContains("OPENBSD_5_3", buildRule.getLog());
         assertTrue("now it is there", f.exists());
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
index 86049f8..9b93c77 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/AntTest.java
@@ -22,7 +22,6 @@ import java.io.File;
 
 import junit.framework.AssertionFailedError;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildEvent;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
@@ -35,6 +34,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
@@ -290,7 +290,7 @@ public class AntTest {
         buildRule.getProject().setUserProperty("test", "7");
         buildRule.executeTarget("test-property-override-inheritall-start");
 
-        AntAssert.assertContains("The value of test is 7", buildRule.getLog());
+        assertContains("The value of test is 7", buildRule.getLog());
     }
 
     @Test
@@ -298,20 +298,20 @@ public class AntTest {
         buildRule.getProject().setUserProperty("test", "7");
         buildRule.executeTarget("test-property-override-no-inheritall-start");
 
-        AntAssert.assertContains("The value of test is 7", buildRule.getLog());
+        assertContains("The value of test is 7", buildRule.getLog());
     }
 
     @Test
     public void testOverrideWinsInheritAll() {
         buildRule.executeTarget("test-property-override-inheritall-start");
 
-        AntAssert.assertContains("The value of test is 4", buildRule.getLog());
+        assertContains("The value of test is 4", buildRule.getLog());
     }
 
     @Test
     public void testOverrideWinsNoInheritAll() {
         buildRule.executeTarget("test-property-override-no-inheritall-start");
-        AntAssert.assertContains("The value of test is 4", buildRule.getLog());
+        assertContains("The value of test is 4", buildRule.getLog());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java
index 98f041f..6100d06 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/CallTargetTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
@@ -27,6 +26,7 @@ import org.junit.Test;
 
 import java.util.Vector;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -47,7 +47,7 @@ public class CallTargetTest {
     @Test
     public void testInheritRefFileSet() {
         buildRule.executeTarget("testinheritreffileset");
-        AntAssert.assertContains("calltarget.xml", buildRule.getLog());
+        assertContains("calltarget.xml", buildRule.getLog());
     }
 
     // see bugrep 21724 (references not passing through with antcall)
@@ -64,7 +64,7 @@ public class CallTargetTest {
         v.add("call-multi");
         v.add("call-multi");
         buildRule.getProject().executeTargets(v);
-        AntAssert.assertContains("multi is SETmulti is SET", buildRule.getLog());
+        assertContains("multi is SETmulti is SET", buildRule.getLog());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
index 7ba5556..48f1fd4 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/FixCrLfTest.java
@@ -26,13 +26,13 @@ import java.io.InputStream;
 
 import junit.framework.AssertionFailedError;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -154,7 +154,7 @@ public class FixCrLfTest {
             buildRule.executeTarget("testFixFileExclusive");
             fail(FixCRLF.ERROR_FILE_AND_SRCDIR);
         } catch (BuildException ex) {
-            AntAssert.assertContains(FixCRLF.ERROR_FILE_AND_SRCDIR, ex.getMessage());
+            assertContains(FixCRLF.ERROR_FILE_AND_SRCDIR, ex.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java
index fb78937..f079adb 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/GetTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.After;
@@ -26,6 +25,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
+import static org.apache.tools.ant.AntAssert.assertNotContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -105,7 +106,7 @@ public class GetTest {
     public void test7() {
         try {
             buildRule.executeTarget("test7");
-            AntAssert.assertNotContains("Adding header", buildRule.getLog());
+            assertNotContains("Adding header", buildRule.getLog());
 
             fail("userAgent may not be null or empty");
         } catch (BuildException ex) {
@@ -127,21 +128,21 @@ public class GetTest {
     public void testTwoHeadersAreAddedOK() {
         buildRule.executeTarget("testTwoHeadersAreAddedOK");
         String log = buildRule.getLog();
-        AntAssert.assertContains("Adding header 'header1'", log);
-        AntAssert.assertContains("Adding header 'header2'", log);
+        assertContains("Adding header 'header1'", log);
+        assertContains("Adding header 'header2'", log);
     }
 
     @Test
     public void testEmptyHeadersAreNeverAdded() {
         buildRule.executeTarget("testEmptyHeadersAreNeverAdded");
-        AntAssert.assertNotContains("Adding header", buildRule.getLog());
+        assertNotContains("Adding header", buildRule.getLog());
     }
 
     @Test
     public void testThatWhenMoreThanOneHeaderHaveSameNameOnlyLastOneIsAdded() {
         buildRule.executeTarget("testThatWhenMoreThanOneHeaderHaveSameNameOnlyLastOneIsAdded");
         String log = buildRule.getLog();
-        AntAssert.assertContains("Adding header 'header1'", log);
+        assertContains("Adding header 'header1'", log);
 
         int actualHeaderCount = log.split("Adding header ").length - 1;
 
@@ -151,7 +152,7 @@ public class GetTest {
     @Test
     public void testHeaderSpaceTrimmed() {
         buildRule.executeTarget("testHeaderSpaceTrimmed");
-        AntAssert.assertContains("Adding header 'header1'", buildRule.getLog());
+        assertContains("Adding header 'header1'", buildRule.getLog());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
index 8ce0cbe..490ce9f 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
@@ -19,7 +19,6 @@
 
 package org.apache.tools.ant.taskdefs;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.taskdefs.rmic.RmicAdapterFactory;
@@ -31,6 +30,7 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
@@ -236,7 +236,7 @@ public class RmicAdvancedTest {
             buildRule.executeTarget("testDefaultBadClass");
         } finally {
             // don't look for much text here as it is vendor and version dependent
-            AntAssert.assertContains("unimplemented.class", buildRule.getLog());
+            assertContains("unimplemented.class", buildRule.getLog());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
index 84d88a5..10049fc 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsFileSelectedTest.java
@@ -18,13 +18,13 @@
 
 package org.apache.tools.ant.taskdefs.condition;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.fail;
 
 /**
@@ -66,8 +66,8 @@ public class IsFileSelectedTest {
         try {
             buildRule.executeTarget("not.selector");
             fail("Exception should have been thrown: checking for use as a selector (not allowed)");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("fileset doesn't support the nested \"isfile",
+        } catch (BuildException ex) {
+            assertContains("fileset doesn't support the nested \"isfile",
                     ex.getMessage());
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
index 6ddf26f..87e3712 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/IsReachableTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant.taskdefs.condition;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
@@ -25,6 +24,7 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
@@ -108,8 +108,8 @@ public class IsReachableTest {
         try {
             buildRule.executeTarget("testBadURL");
             fail("Build exception expected: error in URL");
-        } catch(BuildException ex) {
-            AntAssert.assertContains(IsReachable.ERROR_BAD_URL, ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains(IsReachable.ERROR_BAD_URL, ex.getMessage());
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
index 6c73188..45df9a8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/condition/TypeFoundTest.java
@@ -17,13 +17,13 @@
  */
 package org.apache.tools.ant.taskdefs.condition;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 import static org.junit.Assert.assertNull;
@@ -52,8 +52,8 @@ public class TypeFoundTest {
         try {
             buildRule.executeTarget("testUndefined");
             fail("Build exception expected: left out the name attribute");
-        } catch(BuildException ex) {
-            AntAssert.assertContains("No type specified", ex.getMessage());
+        } catch (BuildException ex) {
+            assertContains("No type specified", ex.getMessage());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
index 12443f9..81215c8 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/SchemaValidateTest.java
@@ -17,13 +17,13 @@
  */
 package org.apache.tools.ant.taskdefs.optional;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.fail;
 
 /**
@@ -67,7 +67,7 @@ public class SchemaValidateTest {
             buildRule.executeTarget("testNoEmptySchemaNamespace");
             fail("Empty namespace URI");
         } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
+            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_URI, ex.getMessage());
         }
     }
 
@@ -77,7 +77,7 @@ public class SchemaValidateTest {
             buildRule.executeTarget("testNoEmptySchemaLocation");
             fail("Empty schema location");
         } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
+            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_LOCATION,
                     ex.getMessage());
         }
     }
@@ -88,7 +88,7 @@ public class SchemaValidateTest {
             buildRule.executeTarget("testNoFile");
             fail("No file at file attribute");
         } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
+            assertContains(SchemaValidate.SchemaLocation.ERROR_NO_FILE,
                     ex.getMessage());
         }
     }
@@ -99,7 +99,7 @@ public class SchemaValidateTest {
             buildRule.executeTarget("testNoDoubleSchemaLocation");
             fail("Two locations for schemas");
         } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
+            assertContains(SchemaValidate.SchemaLocation.ERROR_TWO_LOCATIONS,
                     ex.getMessage());
         }
     }
@@ -110,7 +110,7 @@ public class SchemaValidateTest {
             buildRule.executeTarget("testNoDuplicateSchema");
             fail("duplicate schemas with different values");
         } catch (BuildException ex) {
-            AntAssert.assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
+            assertContains(SchemaValidate.ERROR_DUPLICATE_SCHEMA,
                     ex.getMessage());
         }
     }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
index 7acd062..ac1c27c 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/image/ImageTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.tools.ant.taskdefs.optional.image;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.JavaEnvUtils;
@@ -29,6 +28,7 @@ import org.junit.Test;
 
 import java.io.File;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeFalse;
@@ -60,13 +60,13 @@ public class ImageTest {
     @Test
     public void testEchoToLog() {
         buildRule.executeTarget("testEchoToLog");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
     }
 
     @Test
     public void testSimpleScale() {
         buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
 
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
@@ -75,13 +75,13 @@ public class ImageTest {
     @Test
     public void testOverwriteTrue() {
         buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         assumeTrue("Could not change file modification date",
                 f.setLastModified(f.lastModified() - FILE_UTILS.getFileTimestampGranularity() * 2));
         long lastModified = f.lastModified();
         buildRule.executeTarget("testOverwriteTrue");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
         f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long overwrittenLastModified = f.lastModified();
         assertTrue("File was not overwritten.", lastModified < overwrittenLastModified);
@@ -90,11 +90,11 @@ public class ImageTest {
     @Test
     public void testOverwriteFalse() {
         buildRule.executeTarget("testSimpleScale");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
         File f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long lastModified = f.lastModified();
         buildRule.executeTarget("testOverwriteFalse");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
         f = new File(buildRule.getOutputDir(), LARGEIMAGE);
         long overwrittenLastModified = f.lastModified();
         assertEquals("File was overwritten.", lastModified, overwrittenLastModified);
@@ -103,7 +103,7 @@ public class ImageTest {
     @Test
     public void testSimpleScaleWithMapper() {
         buildRule.executeTarget("testSimpleScaleWithMapper");
-        AntAssert.assertContains("Processing File", buildRule.getLog());
+        assertContains("Processing File", buildRule.getLog());
         File f = new File(buildRule.getOutputDir(), "scaled-" + LARGEIMAGE);
         assertTrue("Did not create " + f.getAbsolutePath(), f.exists());
     }
@@ -113,7 +113,7 @@ public class ImageTest {
     public void testFailOnError() {
         try {
             buildRule.executeTarget("testFailOnError");
-            AntAssert.assertContains("Unable to process image stream", buildRule.getLog());
+            assertContains("Unable to process image stream", buildRule.getLog());
         } catch (RuntimeException re) {
             assertTrue("Run time exception should say 'Unable to process image stream'. :"
                        + re.toString(),

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
index df4dccd..5728e92 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/optional/jdepend/JDependTest.java
@@ -18,12 +18,13 @@
 
 package org.apache.tools.ant.taskdefs.optional.jdepend;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
+
 /**
  * Testcase for the JDepend optional task.
  *
@@ -45,7 +46,7 @@ public class JDependTest {
     @Test
     public void testSimple() {
         buildRule.executeTarget("simple");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade",
+        assertContains("Package: org.apache.tools.ant.util.facade",
                 buildRule.getOutput());
     }
 
@@ -55,7 +56,7 @@ public class JDependTest {
     @Test
     public void testXml() {
         buildRule.executeTarget("xml");
-        AntAssert.assertContains("<DependsUpon>", buildRule.getOutput());
+        assertContains("<DependsUpon>", buildRule.getOutput());
     }
 
     /**
@@ -65,7 +66,7 @@ public class JDependTest {
     @Test
     public void testFork() {
         buildRule.executeTarget("fork");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
+        assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
     }
 
     /**
@@ -74,7 +75,7 @@ public class JDependTest {
     @Test
     public void testForkXml() {
         buildRule.executeTarget("fork-xml");
-        AntAssert.assertContains("<DependsUpon>", buildRule.getLog());
+        assertContains("<DependsUpon>", buildRule.getLog());
     }
 
     /**
@@ -83,7 +84,7 @@ public class JDependTest {
     @Test
     public void testTimeout() {
         buildRule.executeTarget("fork-xml");
-        AntAssert.assertContains("JDepend FAILED - Timed out", buildRule.getLog());
+        assertContains("JDepend FAILED - Timed out", buildRule.getLog());
     }
 
 
@@ -93,7 +94,7 @@ public class JDependTest {
     @Test
     public void testTimeoutNot() {
         buildRule.executeTarget("fork-timeout-not");
-        AntAssert.assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
+        assertContains("Package: org.apache.tools.ant.util.facade", buildRule.getLog());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
index 6dfbcf6..bebf627 100644
--- a/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/AddTypeTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.tools.ant.types;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -28,6 +27,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.fail;
 
 public class AddTypeTest {
@@ -63,19 +63,19 @@ public class AddTypeTest {
     @Test
     public void testNestedA() {
         buildRule.executeTarget("nested.a");
-        AntAssert.assertContains("add A called", buildRule.getLog());
+        assertContains("add A called", buildRule.getLog());
     }
 
     @Test
     public void testNestedB() {
         buildRule.executeTarget("nested.b");
-         AntAssert.assertContains("add B called", buildRule.getLog());
+         assertContains("add B called", buildRule.getLog());
     }
 
     @Test
     public void testNestedC() {
         buildRule.executeTarget("nested.c");
-        AntAssert.assertContains("add C called", buildRule.getLog());
+        assertContains("add C called", buildRule.getLog());
     }
 
     @Test
@@ -84,26 +84,26 @@ public class AddTypeTest {
             buildRule.executeTarget("nested.ab");
             fail("Build exception expected: Should have got ambiguous");
         } catch (BuildException ex) {
-            AntAssert.assertContains("ambiguous", ex.getMessage());
+            assertContains("ambiguous", ex.getMessage());
         }
     }
 
     @Test
     public void testConditionType() {
         buildRule.executeTarget("condition.type");
-        AntAssert.assertContains("beforeafter", buildRule.getLog());
+        assertContains("beforeafter", buildRule.getLog());
     }
 
     @Test
     public void testConditionTask() {
         buildRule.executeTarget("condition.task");
-        AntAssert.assertContains("My Condition execution", buildRule.getLog());
+        assertContains("My Condition execution", buildRule.getLog());
     }
 
     @Test
     public void testConditionConditionType() {
         buildRule.executeTarget("condition.condition.type");
-        AntAssert.assertContains("My Condition eval", buildRule.getLog());
+        assertContains("My Condition eval", buildRule.getLog());
     }
 
     @Test
@@ -112,21 +112,21 @@ public class AddTypeTest {
             buildRule.executeTarget("condition.condition.task");
             fail("Build exception expected: Task masking condition");
         } catch (BuildException ex) {
-             AntAssert.assertContains("doesn't support the nested", ex.getMessage());
+             assertContains("doesn't support the nested", ex.getMessage());
         }
     }
 
     @Test
     public void testAddConfigured() {
         buildRule.executeTarget("myaddconfigured");
-        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
+        assertContains("value is Value Setexecute: value is Value Set",
                 buildRule.getLog());
     }
 
     @Test
     public void testAddConfiguredValue() {
         buildRule.executeTarget("myaddconfiguredvalue");
-        AntAssert.assertContains("value is Value Setexecute: value is Value Set",
+        assertContains("value is Value Setexecute: value is Value Set",
                 buildRule.getLog());
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
index 73ffff4..f0589f1 100644
--- a/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/PolyTest.java
@@ -18,7 +18,6 @@
 
 package org.apache.tools.ant.types;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
@@ -26,6 +25,8 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
+
 public class PolyTest {
 
     @Rule
@@ -39,25 +40,25 @@ public class PolyTest {
     @Test
     public void testFileSet() {
         buildRule.executeTarget("fileset");
-        AntAssert.assertContains("types.FileSet", buildRule.getLog());
+        assertContains("types.FileSet", buildRule.getLog());
     }
 
     @Test
     public void testFileSetAntType() {
         buildRule.executeTarget("fileset-ant-type");
-        AntAssert.assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
+        assertContains("types.PolyTest$MyFileSet", buildRule.getLog());
     }
 
     @Test
     public void testPath() {
         buildRule.executeTarget("path");
-        AntAssert.assertContains("types.Path", buildRule.getLog());
+        assertContains("types.Path", buildRule.getLog());
     }
 
     @Test
     public void testPathAntType() {
         buildRule.executeTarget("path-ant-type");
-        AntAssert.assertContains("types.PolyTest$MyPath", buildRule.getLog());
+        assertContains("types.PolyTest$MyPath", buildRule.getLog());
     }
 
     public static class MyFileSet extends FileSet {

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
index 1d2ccf7..0b10e33 100644
--- a/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/RedirectorElementTest.java
@@ -17,7 +17,6 @@
  */
 package org.apache.tools.ant.types;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
@@ -25,6 +24,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -74,7 +74,7 @@ public class RedirectorElementTest {
     public void testLogInputString() {
         buildRule.executeTarget("testLogInputString");
         if (buildRule.getLog().contains("testLogInputString can-cat")) {
-            AntAssert.assertContains("Using input string", buildRule.getFullLog());
+            assertContains("Using input string", buildRule.getFullLog());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/cdb0348e/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
index fb511b0..f8c8e6c 100644
--- a/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
+++ b/src/tests/junit/org/apache/tools/ant/types/selectors/ModifiedSelectorTest.java
@@ -24,7 +24,6 @@ import java.text.RuleBasedCollator;
 import java.util.Comparator;
 import java.util.Iterator;
 
-import org.apache.tools.ant.AntAssert;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildFileRule;
 import org.apache.tools.ant.Project;
@@ -47,6 +46,7 @@ import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
+import static org.apache.tools.ant.AntAssert.assertContains;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -569,7 +569,7 @@ public class ModifiedSelectorTest {
     public void testResourceSelectorSelresTrue() {
         BFT bft = new BFT();
         bft.doTarget("modifiedselectortest-ResourceSelresTrue");
-        AntAssert.assertContains("does not provide an InputStream", bft.getLog());
+        assertContains("does not provide an InputStream", bft.getLog());
         bft.deleteCachefile();
     }
 


[4/6] ant git commit: Checkstyle and simplify, next iteration

Posted by gi...@apache.org.
Checkstyle and simplify, next iteration

Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/dccbf1fc
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/dccbf1fc
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/dccbf1fc

Branch: refs/heads/master
Commit: dccbf1fcec0fc4e0812e8906494b15a1301ac32a
Parents: cdb0348
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Thu Apr 5 07:28:18 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Thu Apr 5 07:28:18 2018 +0200

----------------------------------------------------------------------
 .../org/apache/tools/ant/AntClassLoader.java    |  16 +-
 .../org/apache/tools/ant/PathTokenizer.java     |   6 +-
 src/main/org/apache/tools/ant/Project.java      |   8 +-
 .../org/apache/tools/ant/PropertyHelper.java    |  30 ++--
 .../apache/tools/ant/RuntimeConfigurable.java   |  25 ++--
 src/main/org/apache/tools/ant/XmlLogger.java    |   3 +-
 .../tools/ant/attribute/BaseIfAttribute.java    |   3 +-
 .../tools/ant/filters/ClassConstants.java       |  31 ++--
 .../tools/ant/filters/ExpandProperties.java     |   4 +-
 .../tools/ant/filters/LineContainsRegExp.java   |   6 +-
 .../tools/ant/filters/StripJavaComments.java    |   3 +-
 .../tools/ant/filters/util/JavaClassHelper.java |   6 +-
 .../apache/tools/ant/helper/ProjectHelper2.java | 150 ++++++++++---------
 .../tools/ant/helper/ProjectHelperImpl.java     |  75 ++++++----
 .../apache/tools/ant/taskdefs/AntStructure.java |   9 +-
 .../org/apache/tools/ant/taskdefs/Concat.java   |  11 +-
 .../org/apache/tools/ant/taskdefs/Expand.java   |  22 +--
 src/main/org/apache/tools/ant/taskdefs/Get.java |   5 +-
 .../org/apache/tools/ant/taskdefs/Javac.java    |   6 +-
 .../org/apache/tools/ant/taskdefs/Manifest.java |  29 +---
 .../org/apache/tools/ant/taskdefs/Recorder.java |   3 +-
 .../org/apache/tools/ant/taskdefs/Replace.java  |   2 +-
 .../org/apache/tools/ant/taskdefs/Rmic.java     |   5 +-
 .../org/apache/tools/ant/taskdefs/UpToDate.java |  12 +-
 .../compilers/DefaultCompilerAdapter.java       |   6 +-
 .../ant/taskdefs/condition/IsReference.java     |  19 +--
 .../apache/tools/ant/taskdefs/condition/Os.java |   4 +-
 .../tools/ant/taskdefs/optional/NetRexxC.java   |   2 +-
 .../ant/taskdefs/optional/SchemaValidate.java   |  26 ++--
 .../taskdefs/optional/depend/AntAnalyzer.java   |   4 +-
 .../ant/taskdefs/optional/ejb/IPlanetEjbc.java  |  33 ++--
 .../optional/jlink/ClassNameReader.java         |   3 +-
 .../ant/taskdefs/optional/junit/JUnitTask.java  |  10 +-
 .../native2ascii/BuiltinNative2Ascii.java       |  18 +--
 .../tools/ant/taskdefs/optional/net/FTP.java    |  11 +-
 .../optional/net/FTPTaskMirrorImpl.java         |   3 +-
 .../ant/taskdefs/optional/ssh/SSHExec.java      |   2 +-
 .../taskdefs/optional/ssh/ScpFromMessage.java   |   4 +-
 .../optional/ssh/ScpFromMessageBySftp.java      |   6 +-
 .../apache/tools/ant/types/AbstractFileSet.java |   8 +-
 .../apache/tools/ant/types/CommandlineJava.java |  12 +-
 .../org/apache/tools/ant/types/PropertySet.java |   3 +-
 .../ant/types/resources/PropertyResource.java   |   5 +-
 .../tools/ant/types/resources/URLResource.java  |   6 +-
 .../comparators/ResourceComparator.java         |   5 +-
 .../apache/tools/ant/util/DOMElementWriter.java |  19 +--
 .../org/apache/tools/ant/util/DateUtils.java    |   4 +-
 .../org/apache/tools/ant/util/FileUtils.java    |  12 +-
 .../ant/util/LayoutPreservingProperties.java    |   2 +-
 .../apache/tools/ant/util/LazyHashtable.java    |   6 +-
 .../apache/tools/ant/util/ResourceUtils.java    |   9 +-
 .../ant/util/regexp/Jdk14RegexpMatcher.java     |   3 +-
 src/main/org/apache/tools/bzip2/BlockSort.java  |   6 +-
 .../apache/tools/bzip2/CBZip2InputStream.java   |   8 +-
 src/main/org/apache/tools/tar/TarEntry.java     |  18 +--
 .../apache/tools/zip/ZipEightByteInteger.java   |   6 +-
 src/main/org/apache/tools/zip/ZipLong.java      |   5 +-
 src/main/org/apache/tools/zip/ZipShort.java     |   5 +-
 .../apache/tools/ant/taskdefs/DirnameTest.java  |   5 +-
 59 files changed, 325 insertions(+), 443 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/AntClassLoader.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/AntClassLoader.java b/src/main/org/apache/tools/ant/AntClassLoader.java
index 39058bb..8a46659 100644
--- a/src/main/org/apache/tools/ant/AntClassLoader.java
+++ b/src/main/org/apache/tools/ant/AntClassLoader.java
@@ -539,15 +539,11 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      */
     public String getClasspath() {
         final StringBuilder sb = new StringBuilder();
-        boolean firstPass = true;
-        final Enumeration<File> componentEnum = pathComponents.elements();
-        while (componentEnum.hasMoreElements()) {
-            if (!firstPass) {
-                sb.append(System.getProperty("path.separator"));
-            } else {
-                firstPass = false;
+        for (final File component : pathComponents) {
+            if (sb.length() > 0) {
+                sb.append(File.pathSeparator);
             }
-            sb.append(componentEnum.nextElement().getAbsolutePath());
+            sb.append(component.getAbsolutePath());
         }
         return sb.toString();
     }
@@ -1407,8 +1403,8 @@ public class AntClassLoader extends ClassLoader implements SubBuildListener, Clo
      * files are closed.
      */
     public synchronized void cleanup() {
-        for (final Enumeration<JarFile> e = jarFiles.elements(); e.hasMoreElements();) {
-            FileUtils.close(e.nextElement());
+        for (final JarFile jarFile : jarFiles.values()) {
+            FileUtils.close(jarFile);
         }
         jarFiles = new Hashtable<>();
         if (project != null) {

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/PathTokenizer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/PathTokenizer.java b/src/main/org/apache/tools/ant/PathTokenizer.java
index 2beb09c..2563018 100644
--- a/src/main/org/apache/tools/ant/PathTokenizer.java
+++ b/src/main/org/apache/tools/ant/PathTokenizer.java
@@ -83,11 +83,7 @@ public class PathTokenizer {
      * in the string after the current position; <code>false</code> otherwise.
      */
     public boolean hasMoreTokens() {
-        if (lookahead != null) {
-            return true;
-        }
-
-        return tokenizer.hasMoreTokens();
+        return lookahead != null || tokenizer.hasMoreTokens();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/Project.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/Project.java b/src/main/org/apache/tools/ant/Project.java
index 1983cdb..6540cd9 100644
--- a/src/main/org/apache/tools/ant/Project.java
+++ b/src/main/org/apache/tools/ant/Project.java
@@ -1828,10 +1828,10 @@ public class Project implements ResourceFactory {
                         + root);
             }
         }
-        final StringBuilder buf = new StringBuilder("Build sequence for target(s)");
-
-        for (int j = 0; j < roots.length; j++) {
-            buf.append((j == 0) ? " `" : ", `").append(roots[j]).append('\'');
+        final StringBuilder buf = new StringBuilder();
+        for (String root : roots) {
+            buf.append((buf.length() == 0) ? "Build sequence for target(s) `"
+                    : ", `").append(root).append('\'');
         }
         buf.append(" is ").append(ret);
         log(buf.toString(), MSG_VERBOSE);

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/PropertyHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/PropertyHelper.java b/src/main/org/apache/tools/ant/PropertyHelper.java
index 339c446..7c821fe 100644
--- a/src/main/org/apache/tools/ant/PropertyHelper.java
+++ b/src/main/org/apache/tools/ant/PropertyHelper.java
@@ -20,10 +20,10 @@ package org.apache.tools.ant;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.Vector;
 
@@ -974,14 +974,11 @@ public class PropertyHelper implements GetProperty {
     public void copyInheritedProperties(Project other) {
         //avoid concurrent modification:
         synchronized (inheritedProperties) {
-            Enumeration<String> e = inheritedProperties.keys();
-            while (e.hasMoreElements()) {
-                String arg = e.nextElement();
-                if (other.getUserProperty(arg) != null) {
-                    continue;
+            for (Map.Entry<String, Object> entry : inheritedProperties.entrySet()) {
+                String arg = entry.getKey();
+                if (other.getUserProperty(arg) == null) {
+                    other.setInheritedProperty(arg, entry.getValue().toString());
                 }
-                Object value = inheritedProperties.get(arg);
-                other.setInheritedProperty(arg, value.toString());
             }
         }
     }
@@ -1004,14 +1001,11 @@ public class PropertyHelper implements GetProperty {
     public void copyUserProperties(Project other) {
         //avoid concurrent modification:
         synchronized (userProperties) {
-            Enumeration<String> e = userProperties.keys();
-            while (e.hasMoreElements()) {
-                Object arg = e.nextElement();
-                if (inheritedProperties.containsKey(arg)) {
-                    continue;
+            for (Map.Entry<String, Object> entry : userProperties.entrySet()) {
+                String arg = entry.getKey();
+                if (!inheritedProperties.containsKey(arg)) {
+                    other.setUserProperty(arg, entry.getValue().toString());
                 }
-                Object value = userProperties.get(arg);
-                other.setUserProperty(arg.toString(), value.toString());
             }
         }
     }
@@ -1123,16 +1117,14 @@ public class PropertyHelper implements GetProperty {
      * @return Set&lt;Class&gt;
      * @since Ant 1.8.0
      */
+    @SuppressWarnings("unchecked")
     protected static Set<Class<? extends Delegate>> getDelegateInterfaces(Delegate d) {
         final HashSet<Class<? extends Delegate>> result = new HashSet<>();
         Class<?> c = d.getClass();
         while (c != null) {
             for (Class<?> ifc : c.getInterfaces()) {
                 if (Delegate.class.isAssignableFrom(ifc)) {
-                    @SuppressWarnings("unchecked")
-                    final Class<? extends Delegate> delegateInterface =
-                            (Class<? extends Delegate>) ifc;
-                    result.add(delegateInterface);
+                    result.add((Class<? extends Delegate>) ifc);
                 }
             }
             c = c.getSuperclass();

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/RuntimeConfigurable.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/RuntimeConfigurable.java b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
index bc34720..107464d 100644
--- a/src/main/org/apache/tools/ant/RuntimeConfigurable.java
+++ b/src/main/org/apache/tools/ant/RuntimeConfigurable.java
@@ -531,23 +531,22 @@ public class RuntimeConfigurable implements Serializable {
                     ih.setAttribute(p, target, name, attrValue);
                 } catch (UnsupportedAttributeException be) {
                     // id attribute must be set externally
-                    if ("id".equals(name)) {
-                        // Do nothing
-                    } else if (getElementTag() == null) {
-                        throw be;
-                    } else {
-                        throw new BuildException(
-                            getElementTag() + " doesn't support the \""
-                            + be.getAttribute() + "\" attribute", be);
+                    if (!"id".equals(name)) {
+                        if (getElementTag() == null) {
+                            throw be;
+                        } else {
+                            throw new BuildException(
+                                getElementTag() + " doesn't support the \""
+                                + be.getAttribute() + "\" attribute", be);
+                        }
                     }
                 } catch (BuildException be) {
-                    if ("id".equals(name)) {
-                        // Assume that this is an not supported attribute type
-                        // thrown for example by a dynamic attribute task
-                        // Do nothing
-                    } else {
+                    if (!"id".equals(name)) {
                         throw be;
                     }
+                    // Assume that this is an not supported attribute type
+                    // thrown for example by a dynamic attribute task --
+                    // do nothing
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/XmlLogger.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/XmlLogger.java b/src/main/org/apache/tools/ant/XmlLogger.java
index 94b3e71..5fa978e 100644
--- a/src/main/org/apache/tools/ant/XmlLogger.java
+++ b/src/main/org/apache/tools/ant/XmlLogger.java
@@ -207,12 +207,11 @@ public class XmlLogger implements BuildLogger {
      * @return the stack of timed elements for the current thread
      */
     private Stack<TimedElement> getStack() {
-        Stack<TimedElement> threadStack = threadStacks.computeIfAbsent(Thread.currentThread(), k -> new Stack<>());
         /* For debugging purposes uncomment:
         org.w3c.dom.Comment s = doc.createComment("stack=" + threadStack);
         buildElement.element.appendChild(s);
          */
-        return threadStack;
+        return threadStacks.computeIfAbsent(Thread.currentThread(), k -> new Stack<>());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java b/src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
index 6d4d6c3..14c22a5 100644
--- a/src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
+++ b/src/main/org/apache/tools/ant/attribute/BaseIfAttribute.java
@@ -73,11 +73,10 @@ public abstract class BaseIfAttribute
         Hashtable<String, Object> attributes = rc.getAttributeMap(); // This does a copy!
         for (Map.Entry<String, Object> entry : attributes.entrySet()) {
             String key = entry.getKey();
-            String value = (String) entry.getValue();
             if (key.startsWith("ant-attribute:param")) {
                 int pos = key.lastIndexOf(':');
                 ret.put(key.substring(pos + 1),
-                    el.getProject().replaceProperties(value));
+                    el.getProject().replaceProperties((String) entry.getValue()));
             }
         }
         return ret;

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/filters/ClassConstants.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/ClassConstants.java b/src/main/org/apache/tools/ant/filters/ClassConstants.java
index 2bb4bfb..b9d7b7f 100644
--- a/src/main/org/apache/tools/ant/filters/ClassConstants.java
+++ b/src/main/org/apache/tools/ant/filters/ClassConstants.java
@@ -86,41 +86,27 @@ public final class ClassConstants
      * be read (for example due to the class not being found).
      */
     public int read() throws IOException {
-
         int ch = -1;
 
         if (queuedData != null && queuedData.length() == 0) {
             queuedData = null;
         }
 
-        if (queuedData != null) {
-            ch = queuedData.charAt(0);
-            queuedData = queuedData.substring(1);
-            if (queuedData.length() == 0) {
-                queuedData = null;
-            }
-        } else {
+        if (queuedData == null) {
             final String clazz = readFully();
             if (clazz == null || clazz.length() == 0) {
                 ch = -1;
             } else {
                 final byte[] bytes = clazz.getBytes(ResourceUtils.ISO_8859_1);
                 try {
-                    final Class<?> javaClassHelper =
-                        Class.forName(JAVA_CLASS_HELPER);
+                    final Class<?> javaClassHelper = Class.forName(JAVA_CLASS_HELPER);
                     if (javaClassHelper != null) {
-                        final Class<?>[] params = {
-                            byte[].class
-                        };
                         final Method getConstants =
-                            javaClassHelper.getMethod("getConstants", params);
-                        final Object[] args = {
-                            bytes
-                        };
+                            javaClassHelper.getMethod("getConstants", byte[].class);
                         // getConstants is a static method, no need to
                         // pass in the object
                         final StringBuffer sb = (StringBuffer)
-                                getConstants.invoke(null, args);
+                                getConstants.invoke(null, (Object) bytes);
                         if (sb.length() > 0) {
                             queuedData = sb.toString();
                             return read();
@@ -141,6 +127,12 @@ public final class ClassConstants
                     throw new BuildException(ex);
                 }
             }
+        } else {
+            ch = queuedData.charAt(0);
+            queuedData = queuedData.substring(1);
+            if (queuedData.length() == 0) {
+                queuedData = null;
+            }
         }
         return ch;
     }
@@ -156,7 +148,6 @@ public final class ClassConstants
      *         the specified reader
      */
     public Reader chain(final Reader rdr) {
-        ClassConstants newFilter = new ClassConstants(rdr);
-        return newFilter;
+        return new ClassConstants(rdr);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/filters/ExpandProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/ExpandProperties.java b/src/main/org/apache/tools/ant/filters/ExpandProperties.java
index 7609ef6..401b511 100644
--- a/src/main/org/apache/tools/ant/filters/ExpandProperties.java
+++ b/src/main/org/apache/tools/ant/filters/ExpandProperties.java
@@ -19,7 +19,6 @@ package org.apache.tools.ant.filters;
 
 import java.io.IOException;
 import java.io.Reader;
-import java.util.Properties;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
@@ -98,8 +97,7 @@ public final class ExpandProperties
                 if (propertySet == null) {
                     getProperty = PropertyHelper.getPropertyHelper(project);
                 } else {
-                    final Properties props = propertySet.getProperties();
-                    getProperty = props::getProperty;
+                    getProperty = propertySet.getProperties()::getProperty;
                 }
                 Object expanded = new ParseProperties(project, PropertyHelper
                                                       .getPropertyHelper(project)

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
index 4b02adf..2cb689a 100644
--- a/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
+++ b/src/main/org/apache/tools/ant/filters/LineContainsRegExp.java
@@ -186,10 +186,8 @@ public final class LineContainsRegExp
         LineContainsRegExp newFilter = new LineContainsRegExp(rdr);
         newFilter.setRegexps(getRegexps());
         newFilter.setNegate(isNegated());
-        newFilter
-            .setCaseSensitive(!RegexpUtil.hasFlag(regexpOptions,
-                                                  Regexp.MATCH_CASE_INSENSITIVE)
-                              );
+        newFilter.setCaseSensitive(!RegexpUtil.hasFlag(regexpOptions,
+                Regexp.MATCH_CASE_INSENSITIVE));
         return newFilter;
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/filters/StripJavaComments.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/StripJavaComments.java b/src/main/org/apache/tools/ant/filters/StripJavaComments.java
index 65bccd7..488873e 100644
--- a/src/main/org/apache/tools/ant/filters/StripJavaComments.java
+++ b/src/main/org/apache/tools/ant/filters/StripJavaComments.java
@@ -139,7 +139,6 @@ public final class StripJavaComments
      */
 
     public Reader chain(final Reader rdr) {
-        StripJavaComments newFilter = new StripJavaComments(rdr);
-        return newFilter;
+        return new StripJavaComments(rdr);
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
index 4e97521..f60f3ad 100644
--- a/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
+++ b/src/main/org/apache/tools/ant/filters/util/JavaClassHelper.java
@@ -46,14 +46,12 @@ public final class JavaClassHelper {
         final StringBuffer sb = new StringBuffer();
         final ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
         final ClassParser parser = new ClassParser(bis, "");
-        final JavaClass javaClass = parser.parse();
-        final Field[] fields = javaClass.getFields();
-        for (final Field field : fields) {
+        for (final Field field : parser.parse().getFields()) {
             if (field != null) {
                 final ConstantValue cv = field.getConstantValue();
                 if (cv != null) {
                     String cvs = cv.toString();
-                    //Remove start and end quotes if field is a String
+                    // Remove start and end quotes if field is a String
                     if (cvs.startsWith("\"") && cvs.endsWith("\"")) {
                         cvs = cvs.substring(1, cvs.length() - 1);
                     }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
index 5d62c9d..14e42aa 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelper2.java
@@ -274,12 +274,10 @@ public class ProjectHelper2 extends ProjectHelper {
                         + uri + (zf != null ? " from a zip file" : ""),
                         Project.MSG_VERBOSE);
 
-            DefaultHandler hb = handler;
-
-            parser.setContentHandler(hb);
-            parser.setEntityResolver(hb);
-            parser.setErrorHandler(hb);
-            parser.setDTDHandler(hb);
+            parser.setContentHandler(handler);
+            parser.setEntityResolver(handler);
+            parser.setErrorHandler(handler);
+            parser.setDTDHandler(handler);
             parser.parse(inputSource);
         } catch (SAXParseException exc) {
             Location location = new Location(exc.getSystemId(), exc.getLineNumber(), exc
@@ -603,8 +601,7 @@ public class ProjectHelper2 extends ProjectHelper {
         @Override
         public void endElement(String uri, String name, String qName) throws SAXException {
             currentHandler.onEndElement(uri, name, context);
-            AntHandler prev = antHandlers.pop();
-            currentHandler = prev;
+            currentHandler = antHandlers.pop();
             if (currentHandler != null) {
                 currentHandler.onEndChild(uri, name, qName, context);
             }
@@ -729,45 +726,49 @@ public class ProjectHelper2 extends ProjectHelper {
                 if (attrUri != null && !attrUri.isEmpty() && !attrUri.equals(uri)) {
                     continue; // Ignore attributes from unknown uris
                 }
-                String key = attrs.getLocalName(i);
                 String value = attrs.getValue(i);
-
-                if ("default".equals(key)) {
-                    if (value != null && !value.isEmpty()) {
-                        if (!context.isIgnoringProjectTag()) {
-                            project.setDefault(value);
+                switch (attrs.getLocalName(i)) {
+                    case "default":
+                        if (value != null && !value.isEmpty()) {
+                            if (!context.isIgnoringProjectTag()) {
+                                project.setDefault(value);
+                            }
                         }
-                    }
-                } else if ("name".equals(key)) {
-                    if (value != null) {
-                        context.setCurrentProjectName(value);
-                        nameAttributeSet = true;
-                        if (!context.isIgnoringProjectTag()) {
-                            project.setName(value);
-                            project.addReference(value, project);
-                        } else if (isInIncludeMode()) {
-                            if (!"".equals(value) && getCurrentTargetPrefix()!= null && getCurrentTargetPrefix().endsWith(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX))  {
-                                String newTargetPrefix = getCurrentTargetPrefix().replace(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX, value);
-                                // help nested include tasks
-                                setCurrentTargetPrefix(newTargetPrefix);
+                        break;
+                    case "name":
+                        if (value != null) {
+                            context.setCurrentProjectName(value);
+                            nameAttributeSet = true;
+                            if (!context.isIgnoringProjectTag()) {
+                                project.setName(value);
+                                project.addReference(value, project);
+                            } else if (isInIncludeMode()) {
+                                if (!value.isEmpty() && getCurrentTargetPrefix() != null
+                                        && getCurrentTargetPrefix().endsWith(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX)) {
+                                    String newTargetPrefix = getCurrentTargetPrefix().replace(ProjectHelper.USE_PROJECT_NAME_AS_TARGET_PREFIX, value);
+                                    // help nested include tasks
+                                    setCurrentTargetPrefix(newTargetPrefix);
+                                }
                             }
                         }
-                    }
-                } else if ("id".equals(key)) {
-                    if (value != null) {
-                        // What's the difference between id and name ?
+                        break;
+                    case "id":
+                        if (value != null) {
+                            // What's the difference between id and name ?
+                            if (!context.isIgnoringProjectTag()) {
+                                project.addReference(value, project);
+                            }
+                        }
+                        break;
+                    case "basedir":
                         if (!context.isIgnoringProjectTag()) {
-                            project.addReference(value, project);
+                            baseDir = value;
                         }
-                    }
-                } else if ("basedir".equals(key)) {
-                    if (!context.isIgnoringProjectTag()) {
-                        baseDir = value;
-                    }
-                } else {
-                    // TODO ignore attributes in a different NS ( maybe store them ? )
-                    throw new SAXParseException("Unexpected attribute \"" + attrs.getQName(i)
-                                                + "\"", context.getLocator());
+                        break;
+                    default:
+                        // TODO ignore attributes in a different NS ( maybe store them ? )
+                        throw new SAXParseException("Unexpected attribute \"" + attrs.getQName(i)
+                                + "\"", context.getLocator());
                 }
             }
 
@@ -914,37 +915,44 @@ public class ProjectHelper2 extends ProjectHelper {
                 if (attrUri != null && !attrUri.isEmpty() && !attrUri.equals(uri)) {
                     continue; // Ignore attributes from unknown uris
                 }
-                String key = attrs.getLocalName(i);
                 String value = attrs.getValue(i);
-
-                if ("name".equals(key)) {
-                    name = value;
-                    if (name.isEmpty()) {
-                        throw new BuildException("name attribute must " + "not be empty");
-                    }
-                } else if ("depends".equals(key)) {
-                    depends = value;
-                } else if ("if".equals(key)) {
-                    target.setIf(value);
-                } else if ("unless".equals(key)) {
-                    target.setUnless(value);
-                } else if ("id".equals(key)) {
-                    if (value != null && !value.isEmpty()) {
-                        context.getProject().addReference(value, target);
-                    }
-                } else if ("description".equals(key)) {
-                    target.setDescription(value);
-                } else if ("extensionOf".equals(key)) {
-                    extensionPoint = value;
-                } else if ("onMissingExtensionPoint".equals(key)) {
-                    try {
-                        extensionPointMissing = OnMissingExtensionPoint.valueOf(value);
-                    } catch (IllegalArgumentException e) {
-                        throw new BuildException("Invalid onMissingExtensionPoint " + value);
-                    }
-                } else {
-                    throw new SAXParseException("Unexpected attribute \"" + key + "\"", context
-                                                .getLocator());
+                switch (attrs.getLocalName(i)) {
+                    case "name":
+                        name = value;
+                        if (name.isEmpty()) {
+                            throw new BuildException("name attribute must not be empty");
+                        }
+                        break;
+                    case "depends":
+                        depends = value;
+                        break;
+                    case "if":
+                        target.setIf(value);
+                        break;
+                    case "unless":
+                        target.setUnless(value);
+                        break;
+                    case "id":
+                        if (value != null && !value.isEmpty()) {
+                            context.getProject().addReference(value, target);
+                        }
+                        break;
+                    case "description":
+                        target.setDescription(value);
+                        break;
+                    case "extensionOf":
+                        extensionPoint = value;
+                        break;
+                    case "onMissingExtensionPoint":
+                        try {
+                            extensionPointMissing = OnMissingExtensionPoint.valueOf(value);
+                        } catch (IllegalArgumentException e) {
+                            throw new BuildException("Invalid onMissingExtensionPoint " + value);
+                        }
+                        break;
+                    default:
+                        throw new SAXParseException("Unexpected attribute \"" + attrs.getQName(i)
+                                + "\"", context.getLocator());
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
index 734f8c8..06d9854 100644
--- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
+++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java
@@ -389,19 +389,22 @@ public class ProjectHelperImpl extends ProjectHelper {
             for (int i = 0; i < attrs.getLength(); i++) {
                 String key = attrs.getName(i);
                 String value = attrs.getValue(i);
-
-                if ("default".equals(key)) {
-                    def = value;
-                } else if ("name".equals(key)) {
-                    name = value;
-                } else if ("id".equals(key)) {
-                    id = value;
-                } else if ("basedir".equals(key)) {
-                    baseDir = value;
-                } else {
-                    throw new SAXParseException(
-                            "Unexpected attribute \"" + attrs.getName(i)
-                            + "\"", helperImpl.locator);
+                switch (key) {
+                    case "default":
+                        def = value;
+                        break;
+                    case "name":
+                        name = value;
+                        break;
+                    case "id":
+                        id = value;
+                        break;
+                    case "basedir":
+                        baseDir = value;
+                        break;
+                    default:
+                        throw new SAXParseException("Unexpected attribute \"" + attrs.getName(i)
+                                        + "\"", helperImpl.locator);
                 }
             }
 
@@ -525,26 +528,32 @@ public class ProjectHelperImpl extends ProjectHelper {
             for (int i = 0; i < attrs.getLength(); i++) {
                 String key = attrs.getName(i);
                 String value = attrs.getValue(i);
-
-                if ("name".equals(key)) {
-                    name = value;
-                    if (name.isEmpty()) {
-                        throw new BuildException("name attribute must not" + " be empty",
-                                new Location(helperImpl.locator));
-                    }
-                } else if ("depends".equals(key)) {
-                    depends = value;
-                } else if ("if".equals(key)) {
-                    ifCond = value;
-                } else if ("unless".equals(key)) {
-                    unlessCond = value;
-                } else if ("id".equals(key)) {
-                    id = value;
-                } else if ("description".equals(key)) {
-                    description = value;
-                } else {
-                    throw new SAXParseException("Unexpected attribute \"" + key + "\"",
-                            helperImpl.locator);
+                switch (key) {
+                    case "name":
+                        name = value;
+                        if (name.isEmpty()) {
+                            throw new BuildException("name attribute must not be empty",
+                                    new Location(helperImpl.locator));
+                        }
+                        break;
+                    case "depends":
+                        depends = value;
+                        break;
+                    case "if":
+                        ifCond = value;
+                        break;
+                    case "unless":
+                        unlessCond = value;
+                        break;
+                    case "id":
+                        id = value;
+                        break;
+                    case "description":
+                        description = value;
+                        break;
+                    default:
+                        throw new SAXParseException("Unexpected attribute \"" + key + "\"",
+                                helperImpl.locator);
                 }
             }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
index 482a219..49ff449 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -348,19 +348,16 @@ public class AntStructure extends Task {
                 sb.append(LINE_SEP).append("          ")
                     .append(attrName).append(" ");
                 final Class<?> type = ih.getAttributeType(attrName);
-                if (type.equals(Boolean.class)
-                    || type.equals(Boolean.TYPE)) {
+                if (type.equals(Boolean.class) || type.equals(Boolean.TYPE)) {
                     sb.append(BOOLEAN).append(" ");
                 } else if (Reference.class.isAssignableFrom(type)) {
                     sb.append("IDREF ");
                 } else if (EnumeratedAttribute.class.isAssignableFrom(type)) {
                     try {
                         final EnumeratedAttribute ea =
-                            type.asSubclass(EnumeratedAttribute.class)
-                                .newInstance();
+                            type.asSubclass(EnumeratedAttribute.class).newInstance();
                         final String[] values = ea.getValues();
-                        if (values == null
-                            || values.length == 0
+                        if (values == null || values.length == 0
                             || !areNmtokens(values)) {
                             sb.append("CDATA ");
                         } else {

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Concat.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java
index 8d53ba0..86c0c2a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Concat.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java
@@ -595,7 +595,7 @@ public class Concat extends Task implements ResourceCollection {
      */
     @Deprecated
     public void setForce(boolean forceOverwrite) {
-        this.forceOverwrite = forceOverwrite;
+        setOverwrite(forceOverwrite);
     }
 
     /**
@@ -606,7 +606,7 @@ public class Concat extends Task implements ResourceCollection {
      * @since Ant 1.8.2
      */
     public void setOverwrite(boolean forceOverwrite) {
-        setForce(forceOverwrite);
+        this.forceOverwrite = forceOverwrite;
     }
 
     /**
@@ -923,11 +923,8 @@ public class Concat extends Task implements ResourceCollection {
     }
 
     private boolean isUpToDate(ResourceCollection c) {
-        if (dest == null || forceOverwrite) {
-            return false;
-        }
-        return c.stream().noneMatch(r -> SelectorUtils.isOutOfDate(r, dest,
-            FILE_UTILS.getFileTimestampGranularity()));
+        return dest != null && !forceOverwrite
+                && c.stream().noneMatch(r -> SelectorUtils.isOutOfDate(r, dest, FILE_UTILS.getFileTimestampGranularity()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Expand.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java
index 8862fa7..fb1141a 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Expand.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java
@@ -270,7 +270,6 @@ public class Expand extends Task {
             String name = entryName.replace('/', File.separatorChar)
                 .replace('\\', File.separatorChar);
 
-            boolean included = false;
             Set<String> includePatterns = new HashSet<>();
             Set<String> excludePatterns = new HashSet<>();
             for (PatternSet p : patternsets) {
@@ -302,20 +301,23 @@ public class Expand extends Task {
                 }
             }
 
-            for (Iterator<String> iter = includePatterns.iterator();
-                 !included && iter.hasNext();) {
-                String pattern = iter.next();
-                included = SelectorUtils.matchPath(pattern, name);
+            boolean included = false;
+            for (String pattern : includePatterns) {
+                if (SelectorUtils.matchPath(pattern, name)) {
+                    included = true;
+                    break;
+                }
             }
 
-            for (Iterator<String> iter = excludePatterns.iterator();
-                 included && iter.hasNext();) {
-                String pattern = iter.next();
-                included = !SelectorUtils.matchPath(pattern, name);
+            for (String pattern : excludePatterns) {
+                if (SelectorUtils.matchPath(pattern, name)) {
+                    included = false;
+                    break;
+                }
             }
 
             if (!included) {
-                //Do not process this file
+                // Do not process this file
                 log("skipping " + entryName
                     + " as it is excluded or not included.",
                     Project.MSG_VERBOSE);

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Get.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java
index 34c1dd7..e920bde 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Get.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Get.java
@@ -28,6 +28,8 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.nio.file.Files;
 import java.util.Date;
+import java.util.LinkedHashMap;
+import java.util.Map;
 import java.util.zip.GZIPInputStream;
 
 import org.apache.tools.ant.BuildException;
@@ -46,9 +48,6 @@ import org.apache.tools.ant.util.FileNameMapper;
 import org.apache.tools.ant.util.FileUtils;
 import org.apache.tools.ant.util.StringUtils;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 /**
  * Gets a particular file from a URL source.
  * Options include verbose reporting, timestamp based fetches and controlling

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Javac.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java
index 8a965c5..a4d8c7e 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javac.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java
@@ -834,7 +834,7 @@ public class Javac extends MatchingTask {
      * @return whether or not the ant classpath is to be included in the classpath
      */
     public boolean getIncludeantruntime() {
-        return includeAntRuntime != null ? includeAntRuntime : true;
+        return includeAntRuntime == null || includeAntRuntime;
     }
 
     /**
@@ -1509,10 +1509,10 @@ public class Javac extends MatchingTask {
      * @return a mapping from module name to module source roots
      * @since 1.9.7
      */
-    private static Map<String,Collection<File>> resolveModuleSourcePathElement(
+    private static Map<String, Collection<File>> resolveModuleSourcePathElement(
             final File projectDir,
             final String element) {
-        final Map<String,Collection<File>> result = new TreeMap<>();
+        final Map<String, Collection<File>> result = new TreeMap<>();
         for (CharSequence resolvedElement : expandGroups(element)) {
             findModules(projectDir, resolvedElement.toString(), result);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Manifest.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
index 4ed43e2..28634ef 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java
@@ -193,12 +193,8 @@ public class Manifest {
             Attribute rhsAttribute = (Attribute) rhs;
             String lhsKey = getKey();
             String rhsKey = rhsAttribute.getKey();
-            if ((lhsKey == null && rhsKey != null)
-                 || (lhsKey != null && !lhsKey.equals(rhsKey))) {
-                return false;
-            }
-
-            return values.equals(rhsAttribute.values);
+            return (lhsKey != null || rhsKey == null)
+                    && (lhsKey == null || lhsKey.equals(rhsKey)) && values.equals(rhsAttribute.values);
         }
 
         /**
@@ -243,10 +239,7 @@ public class Manifest {
          * @return the attribute's key.
          */
         public String getKey() {
-            if (name == null) {
-                return null;
-            }
-            return name.toLowerCase(Locale.ENGLISH);
+            return name == null ? null : name.toLowerCase(Locale.ENGLISH);
         }
 
         /**
@@ -302,8 +295,7 @@ public class Manifest {
          * @param line the continuation line.
          */
         public void addContinuation(String line) {
-            String currentValue = values.elementAt(currentIndex);
-            setValue(currentValue + line.substring(1));
+            setValue(values.elementAt(currentIndex) + line.substring(1));
         }
 
         /**
@@ -607,10 +599,7 @@ public class Manifest {
          */
         public String getAttributeValue(String attributeName) {
             Attribute attribute = getAttribute(attributeName.toLowerCase(Locale.ENGLISH));
-            if (attribute == null) {
-                return null;
-            }
-            return attribute.getValue();
+            return attribute == null ? null : attribute.getValue();
         }
 
         /**
@@ -723,8 +712,7 @@ public class Manifest {
             if (attribute == null) {
                 return;
             }
-            String attributeKey = attribute.getKey();
-            attributes.put(attributeKey, attribute);
+            attributes.put(attribute.getKey(), attribute);
         }
 
         /**
@@ -1113,11 +1101,8 @@ public class Manifest {
             return false;
         }
 
-        if (!mainSection.equals(rhsManifest.mainSection)) {
-            return false;
-        }
+        return mainSection.equals(rhsManifest.mainSection) && sections.equals(rhsManifest.sections);
 
-        return sections.equals(rhsManifest.sections);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Recorder.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Recorder.java b/src/main/org/apache/tools/ant/taskdefs/Recorder.java
index d124a45..cb9b4d8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Recorder.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Recorder.java
@@ -310,8 +310,7 @@ public class Recorder extends Task implements SubBuildListener {
         Hashtable<String, RecorderEntry> entries
                 = (Hashtable<String, RecorderEntry>) recorderEntries.clone();
         for (Map.Entry<String, RecorderEntry> entry : entries.entrySet()) {
-            RecorderEntry re = entry.getValue();
-            if (re.getProject() == getProject()) {
+            if (entry.getValue().getProject() == getProject()) {
                 recorderEntries.remove(entry.getKey());
             }
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Replace.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java
index 9317531..adbd35d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Replace.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java
@@ -286,7 +286,7 @@ public class Replace extends MatchingTask {
          * The filter expects from the component providing the input that data
          * is only added by that component to the end of this StringBuffer.
          * This StringBuffer will be modified by this filter, and expects that
-         * another component will only added to this StringBuffer.
+         * another component will only append to this StringBuffer.
          * @param input The input for this filter.
          */
         void setInputBuffer(StringBuffer input) {

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/Rmic.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Rmic.java b/src/main/org/apache/tools/ant/taskdefs/Rmic.java
index 119e4b9..ed2ab21 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Rmic.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Rmic.java
@@ -775,10 +775,7 @@ public class Rmic extends MatchingTask {
         try {
             Class<?> testClass = loader.loadClass(classname);
             // One cannot RMIC an interface for "classic" RMI (JRMP)
-            if (testClass.isInterface() && !iiop && !idl) {
-                return false;
-            }
-            return isValidRmiRemote(testClass);
+            return (!testClass.isInterface() || iiop || idl) && isValidRmiRemote(testClass);
         } catch (ClassNotFoundException e) {
             log(ERROR_UNABLE_TO_VERIFY_CLASS + classname + ERROR_NOT_FOUND,
                 Project.MSG_WARN);

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
index 19dcd23..2c7fc1f 100644
--- a/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
+++ b/src/main/org/apache/tools/ant/taskdefs/UpToDate.java
@@ -24,7 +24,6 @@ import java.util.List;
 import java.util.Vector;
 
 import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.taskdefs.condition.Condition;
@@ -205,11 +204,12 @@ public class UpToDate extends Task implements Condition {
         // scan all filesets, even if we know the target is out of
         // date after the first test.
 
-        Iterator<FileSet> iter = sourceFileSets.iterator();
-        while (upToDate && iter.hasNext()) {
-            FileSet fs = iter.next();
-            DirectoryScanner ds = fs.getDirectoryScanner(getProject());
-            upToDate = scanDir(fs.getDir(getProject()), ds.getIncludedFiles());
+        for (FileSet fs : sourceFileSets) {
+            if (!scanDir(fs.getDir(getProject()),
+                    fs.getDirectoryScanner(getProject()).getIncludedFiles())) {
+                upToDate = false;
+                break;
+            }
         }
 
         if (upToDate) {

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
index 48f9541..9ed7017 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
@@ -696,8 +696,7 @@ public abstract class DefaultCompilerAdapter
      */
     @Deprecated
     protected boolean assumeJava19() {
-        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
-            || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
+        return assumeJava9();
     }
 
     /**
@@ -706,7 +705,8 @@ public abstract class DefaultCompilerAdapter
      * @since Ant 1.9.8
      */
     protected boolean assumeJava9() {
-        return assumeJava19();
+        return assumeJavaXY("javac1.9", JavaEnvUtils.JAVA_9)
+                || assumeJavaXY("javac9", JavaEnvUtils.JAVA_9);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java b/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
index 30e2573..4803cce 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/IsReference.java
@@ -60,31 +60,26 @@ public class IsReference extends ProjectComponent implements Condition {
     public boolean eval() throws BuildException {
         if (ref == null) {
             throw new BuildException(
-                "No reference specified for isreference condition");
+                    "No reference specified for isreference condition");
         }
 
         String key = ref.getRefId();
         if (!getProject().hasReference(key)) {
             return false;
         }
+
         if (type == null) {
             return true;
         }
-        Object o = getProject().getReference(key);
-        Class<?> typeClass =
-            getProject().getDataTypeDefinitions().get(type);
-
+        Class<?> typeClass = getProject().getDataTypeDefinitions().get(type);
         if (typeClass == null) {
-            typeClass =
-                getProject().getTaskDefinitions().get(type);
+            typeClass = getProject().getTaskDefinitions().get(type);
         }
 
-        if (typeClass == null) {
-            // don't know the type, should throw exception instead?
-            return false;
-        }
+        // if the type is unknown, throw exception instead?
+        return typeClass != null
+                && typeClass.isAssignableFrom(getProject().getReference(key).getClass());
 
-        return typeClass.isAssignableFrom(o.getClass());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
index 716375a..9ca87a9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
+++ b/src/main/org/apache/tools/ant/taskdefs/condition/Os.java
@@ -18,6 +18,7 @@
 
 package org.apache.tools.ant.taskdefs.condition;
 
+import java.io.File;
 import java.util.Locale;
 
 import org.apache.tools.ant.BuildException;
@@ -34,8 +35,7 @@ public class Os implements Condition {
         System.getProperty("os.arch").toLowerCase(Locale.ENGLISH);
     private static final String OS_VERSION =
         System.getProperty("os.version").toLowerCase(Locale.ENGLISH);
-    private static final String PATH_SEP =
-        System.getProperty("path.separator");
+    private static final String PATH_SEP = File.pathSeparator;
 
     /**
      * OS family that can be tested for. {@value}

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
index e0c4d83..a1261f8 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/NetRexxC.java
@@ -924,7 +924,7 @@ public class NetRexxC extends MatchingTask {
      */
     private void addExistingToClasspath(StringBuilder target, String source) {
         StringTokenizer tok = new StringTokenizer(source,
-            System.getProperty("path.separator"), false);
+            File.pathSeparator, false);
 
         while (tok.hasMoreTokens()) {
             File f = getProject().resolveFile(tok.nextToken());

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
index 62a4239..f61a93b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/SchemaValidate.java
@@ -467,14 +467,9 @@ public class SchemaValidate extends XMLValidateTask {
 
             final SchemaLocation schemaLocation = (SchemaLocation) o;
 
-            if (file != null ? !file.equals(schemaLocation.file) : schemaLocation.file != null) {
-                return false;
-            }
-            if (namespace != null ? !namespace.equals(schemaLocation.namespace)
-                    : schemaLocation.namespace != null) {
-                return false;
-            }
-            return url != null ? url.equals(schemaLocation.url) : schemaLocation.url == null;
+            return (file == null ? schemaLocation.file == null : file.equals(schemaLocation.file))
+                    && (namespace == null ? schemaLocation.namespace == null : namespace.equals(schemaLocation.namespace))
+                    && (url == null ? schemaLocation.url == null : url.equals(schemaLocation.url));
         }
 
         /**
@@ -485,9 +480,9 @@ public class SchemaValidate extends XMLValidateTask {
         public int hashCode() {
             int result;
             // CheckStyle:MagicNumber OFF
-            result = (namespace != null ? namespace.hashCode() : 0);
-            result = 29 * result + (file != null ? file.hashCode() : 0);
-            result = 29 * result + (url != null ? url.hashCode() : 0);
+            result = (namespace == null ? 0 : namespace.hashCode());
+            result = 29 * result + (file == null ? 0 : file.hashCode());
+            result = 29 * result + (url == null ? 0 : url.hashCode());
             // CheckStyle:MagicNumber OFF
             return result;
         }
@@ -499,10 +494,9 @@ public class SchemaValidate extends XMLValidateTask {
          */
         @Override
         public String toString() {
-            String buffer = (namespace != null ? namespace : "(anonymous)")
-                    + ' ' + (url != null ? (url + " ") : "")
-                    + (file != null ? file.getAbsolutePath() : "");
-            return buffer;
+            return (namespace == null ? "(anonymous)" : namespace)
+                    + (url == null ? "" : " " + url)
+                    + (file == null ? "" : " " + file.getAbsolutePath());
         }
-    } //SchemaLocation
+    }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
index 160bbc7..95ec973 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java
@@ -20,11 +20,11 @@ package org.apache.tools.ant.taskdefs.optional.depend;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
-import java.nio.file.Files;
-import java.nio.file.Paths;
 import java.util.Vector;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
index 3085220..436ee7d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/IPlanetEjbc.java
@@ -812,11 +812,7 @@ public class IPlanetEjbc {
             String base = "\\ejb-jar\\enterprise-beans\\" + ejbType;
 
             if ((base + "\\ejb-name").equals(currentLoc)) {
-                currentEjb = ejbs.get(value);
-                if (currentEjb == null) {
-                    currentEjb = new EjbInfo(value);
-                    ejbs.put(value, currentEjb);
-                }
+                currentEjb = ejbs.computeIfAbsent(value, EjbInfo::new);
             } else if ((base + "\\home").equals(currentLoc)) {
                 currentEjb.setHome(value);
             } else if ((base + "\\remote").equals(currentLoc)) {
@@ -846,18 +842,13 @@ public class IPlanetEjbc {
             String base = "\\ias-ejb-jar\\enterprise-beans\\" + ejbType;
 
             if ((base + "\\ejb-name").equals(currentLoc)) {
-                currentEjb = ejbs.get(value);
-                if (currentEjb == null) {
-                    currentEjb = new EjbInfo(value);
-                    ejbs.put(value, currentEjb);
-                }
+                currentEjb = ejbs.computeIfAbsent(value, EjbInfo::new);
             } else if ((base + "\\iiop").equals(currentLoc)) {
                 currentEjb.setIiop(value);
             } else if ((base + "\\failover-required").equals(currentLoc)) {
                 currentEjb.setHasession(value);
             } else if ((base
-                + "\\persistence-manager\\properties-file-location")
-                    .equals(currentLoc)) {
+                + "\\persistence-manager\\properties-file-location").equals(currentLoc)) {
                 currentEjb.addCmpDescriptor(value);
             }
         }
@@ -869,15 +860,15 @@ public class IPlanetEjbc {
      *
      */
     private class EjbInfo {
-        private String     name;              // EJB's display name
-        private Classname  home;              // EJB's home interface name
-        private Classname  remote;            // EJB's remote interface name
-        private Classname  implementation;      // EJB's implementation class
-        private Classname  primaryKey;        // EJB's primary key class
-        private String  beantype = "entity";  // or "stateful" or "stateless"
-        private boolean cmp       = false;      // Does this EJB support CMP?
-        private boolean iiop      = false;      // Does this EJB support IIOP?
-        private boolean hasession = false;      // Does this EJB require failover?
+        private String    name;              // EJB's display name
+        private Classname home;              // EJB's home interface name
+        private Classname remote;            // EJB's remote interface name
+        private Classname implementation;    // EJB's implementation class
+        private Classname primaryKey;        // EJB's primary key class
+        private String  beantype = "entity"; // or "stateful" or "stateless"
+        private boolean cmp       = false;   // Does this EJB support CMP?
+        private boolean iiop      = false;   // Does this EJB support IIOP?
+        private boolean hasession = false;   // Does this EJB require failover?
         private List<String> cmpDescriptors = new ArrayList<>();  // CMP descriptor list
 
         /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
index 6025834..8abe28d 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/jlink/ClassNameReader.java
@@ -129,8 +129,7 @@ public class ClassNameReader {
         /* int accessFlags = */ data.readUnsignedShort();
         int classIndex = data.readUnsignedShort();
         Integer stringIndex = (Integer) values[classIndex];
-        String className = (String) values[stringIndex];
-        return className;
+        return (String) values[stringIndex];
     }
 
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
index b57663a..03f34ce 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
@@ -1429,10 +1429,8 @@ public class JUnitTask extends Task {
      * @return created file
      */
     private File createTempPropertiesFile(final String prefix) {
-        final File propsFile =
-            FILE_UTILS.createTempFile(prefix, ".properties",
-                tmpDir != null ? tmpDir : getProject().getBaseDir(), true, true);
-        return propsFile;
+        return FILE_UTILS.createTempFile(prefix, ".properties",
+            tmpDir != null ? tmpDir : getProject().getBaseDir(), true, true);
     }
 
 
@@ -1701,8 +1699,8 @@ public class JUnitTask extends Task {
      * @since 1.9.8
      */
     private void checkModules() {
-        if (hasPath(getCommandline().getModulepath()) ||
-            hasPath(getCommandline().getUpgrademodulepath())) {
+        if (hasPath(getCommandline().getModulepath())
+                || hasPath(getCommandline().getUpgrademodulepath())) {
             if (!batchTests.stream().allMatch(BaseTest::getFork)
                     || !tests.stream().allMatch(BaseTest::getFork)) {
                 throw new BuildException(

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java b/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java
index 5aae72d..650f3cb 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/BuiltinNative2Ascii.java
@@ -60,11 +60,11 @@ public class BuiltinNative2Ascii implements Native2AsciiAdapter {
 
     private BufferedReader getReader(File srcFile, String encoding,
                                      boolean reverse) throws IOException {
-        if (!reverse && encoding != null) {
-            return new BufferedReader(new InputStreamReader(
-                Files.newInputStream(srcFile.toPath()), encoding));
+        if (reverse || encoding == null) {
+            return new BufferedReader(new FileReader(srcFile));
         }
-        return new BufferedReader(new FileReader(srcFile));
+        return new BufferedReader(new InputStreamReader(
+            Files.newInputStream(srcFile.toPath()), encoding));
     }
 
     private Writer getWriter(File destFile, String encoding,
@@ -72,12 +72,12 @@ public class BuiltinNative2Ascii implements Native2AsciiAdapter {
         if (!reverse) {
             encoding = "ASCII";
         }
-        if (encoding != null) {
-            return new BufferedWriter(
-                new OutputStreamWriter(Files.newOutputStream(destFile.toPath()),
-                                       encoding));
+        if (encoding == null) {
+            return new BufferedWriter(new FileWriter(destFile));
         }
-        return new BufferedWriter(new FileWriter(destFile));
+        return new BufferedWriter(
+            new OutputStreamWriter(Files.newOutputStream(destFile.toPath()),
+                                   encoding));
     }
 
     private void translate(BufferedReader input, Writer output,

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index b540ede..b18878b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -1202,13 +1202,7 @@ public class FTP extends Task implements FTPTaskConfig {
      * @since ant 1.6
      */
     private boolean isFunctioningAsFile(FTPClient ftp, String dir, FTPFile file) {
-        if (file.isDirectory()) {
-            return false;
-        }
-        if (file.isFile()) {
-            return true;
-        }
-        return !isFunctioningAsDirectory(ftp, dir, file);
+        return !file.isDirectory() && (file.isFile() || !isFunctioningAsDirectory(ftp, dir, file));
     }
 
     /**
@@ -1901,8 +1895,7 @@ public class FTP extends Task implements FTPTaskConfig {
      * @return the filename as it will appear on the server.
      */
     protected String resolveFile(String file) {
-        return file.replace(System.getProperty("file.separator").charAt(0),
-                            remoteFileSep.charAt(0));
+        return file.replace(File.separator.charAt(0), remoteFileSep.charAt(0));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
index 2ea3787..721b2e3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java
@@ -1280,8 +1280,7 @@ public class FTPTaskMirrorImpl implements FTPTaskMirror {
      * @return the filename as it will appear on the server.
      */
     protected String resolveFile(String file) {
-        return file.replace(System.getProperty("file.separator").charAt(0),
-                            task.getSeparator().charAt(0));
+        return file.replace(File.separator.charAt(0), task.getSeparator().charAt(0));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
index d6012f6..fd26bf4 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/SSHExec.java
@@ -218,7 +218,7 @@ public class SSHExec extends SSHBase {
      *      will be stored.
      * @since Apache Ant 1.9.4
      */
-    public void setErrorproperty (final String property) {
+    public void setErrorproperty(final String property) {
         errorProperty = property;
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
index 9a385e6..312bf66 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java
@@ -319,9 +319,7 @@ public class ScpFromMessage extends AbstractSshMessage {
             throw new JSchException("failed to stat remote file", e);
         }
         FileUtils.getFileUtils().setFileLastModified(localFile,
-                                                     ((long) fileAttributes
-                                                      .getMTime())
-                                                     * 1000);
+                ((long) fileAttributes.getMTime()) * 1000);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
index 3aac12d..b066d92 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessageBySftp.java
@@ -132,7 +132,7 @@ public class ScpFromMessageBySftp extends ScpFromMessage {
 
     private void getDir(final ChannelSftp channel,
                         final String remoteFile,
-                        final File localFile) throws IOException, SftpException {
+                        final File localFile) throws SftpException {
         String pwd = remoteFile;
         if (remoteFile.lastIndexOf('/') != -1) {
             if (remoteFile.length() > 1) {
@@ -196,9 +196,7 @@ public class ScpFromMessageBySftp extends ScpFromMessage {
         }
         if (getPreserveLastModified()) {
             FileUtils.getFileUtils().setFileLastModified(localFile,
-                                                         ((long) le.getAttrs()
-                                                          .getMTime())
-                                                         * 1000);
+                    ((long) le.getAttrs().getMTime()) * 1000);
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/AbstractFileSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/AbstractFileSet.java b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
index 56269b5..4d34acc 100644
--- a/src/main/org/apache/tools/ant/types/AbstractFileSet.java
+++ b/src/main/org/apache/tools/ant/types/AbstractFileSet.java
@@ -592,7 +592,7 @@ public abstract class AbstractFileSet extends DataType
             return getRef(getProject()).hasSelectors();
         }
         dieOnCircularReference();
-        return !(selectors.isEmpty());
+        return !selectors.isEmpty();
     }
 
     /**
@@ -605,10 +605,8 @@ public abstract class AbstractFileSet extends DataType
             return getRef(getProject()).hasPatterns();
         }
         dieOnCircularReference();
-        if (defaultPatterns.hasPatterns(getProject())) {
-            return true;
-        }
-        return additionalPatterns.stream().anyMatch(ps -> ps.hasPatterns(getProject()));
+        return defaultPatterns.hasPatterns(getProject())
+                || additionalPatterns.stream().anyMatch(ps -> ps.hasPatterns(getProject()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/CommandlineJava.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java b/src/main/org/apache/tools/ant/types/CommandlineJava.java
index 2ec4c08..3feaea6 100644
--- a/src/main/org/apache/tools/ant/types/CommandlineJava.java
+++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java
@@ -113,11 +113,8 @@ public class CommandlineJava implements Cloneable {
                 }
             }
             Properties propertySetProperties = mergePropertySets();
-            for (Enumeration<?> e = propertySetProperties.keys();
-                 e.hasMoreElements();) {
-                String key = (String) e.nextElement();
-                String value = propertySetProperties.getProperty(key);
-                listIt.add("-D" + key + "=" + value);
+            for (String key : propertySetProperties.stringPropertyNames()) {
+                listIt.add("-D" + key + "=" + propertySetProperties.getProperty(key));
             }
         }
 
@@ -140,10 +137,9 @@ public class CommandlineJava implements Cloneable {
             try {
                 sys = System.getProperties();
                 Properties p = new Properties();
-                for (Enumeration<?> e = sys.propertyNames(); e.hasMoreElements();) {
-                    String name = (String) e.nextElement();
+                for (String name : sys.stringPropertyNames()) {
                     String value = sys.getProperty(name);
-                    if (name != null && value != null) {
+                    if (value != null) {
                         p.put(name, value);
                     }
                 }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/PropertySet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/PropertySet.java b/src/main/org/apache/tools/ant/types/PropertySet.java
index 7d1fd7e..5459932 100644
--- a/src/main/org/apache/tools/ant/types/PropertySet.java
+++ b/src/main/org/apache/tools/ant/types/PropertySet.java
@@ -568,8 +568,7 @@ public class PropertySet extends DataType implements ResourceCollection {
                 pushAndInvokeCircularReferenceCheck(mapper, stk, p);
             }
             for (PropertySet propertySet : setRefs) {
-                pushAndInvokeCircularReferenceCheck(propertySet, stk,
-                                                    p);
+                pushAndInvokeCircularReferenceCheck(propertySet, stk, p);
             }
             setChecked(true);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
index d72881d..c47e266 100644
--- a/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/PropertyResource.java
@@ -120,10 +120,7 @@ public class PropertyResource extends Resource {
      */
     @Override
     public boolean equals(Object o) {
-        if (super.equals(o)) {
-            return true;
-        }
-        return isReferenceOrProxy() && getReferencedOrProxied().equals(o);
+        return super.equals(o) || isReferenceOrProxy() && getReferencedOrProxied().equals(o);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/resources/URLResource.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/URLResource.java b/src/main/org/apache/tools/ant/types/resources/URLResource.java
index 7ece7e7..fadb098 100644
--- a/src/main/org/apache/tools/ant/types/resources/URLResource.java
+++ b/src/main/org/apache/tools/ant/types/resources/URLResource.java
@@ -310,10 +310,10 @@ public class URLResource extends Resource implements URLProvider {
         if (another == null || another.getClass() != getClass()) {
             return false;
         }
-        URLResource otheru = (URLResource) another;
+        URLResource other = (URLResource) another;
         return getURL() == null
-            ? otheru.getURL() == null
-            : getURL().equals(otheru.getURL());
+            ? other.getURL() == null
+            : getURL().equals(other.getURL());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java b/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
index ee9c556..b565fef 100644
--- a/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
+++ b/src/main/org/apache/tools/ant/types/resources/comparators/ResourceComparator.java
@@ -53,10 +53,7 @@ public abstract class ResourceComparator extends DataType implements Comparator<
         if (isReference()) {
             return getCheckedRef().equals(o);
         }
-        if (o == null) {
-            return false;
-        }
-        return o == this || o.getClass().equals(getClass());
+        return o != null && (o == this || o.getClass().equals(getClass()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/DOMElementWriter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
index 8113b3f..18de730 100644
--- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java
+++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java
@@ -434,10 +434,8 @@ public class DOMElementWriter {
     }
 
     private String encode(final String value, final boolean encodeWhitespace) {
-        final int len = value.length();
-        final StringBuilder sb = new StringBuilder(len);
-        for (int i = 0; i < len; i++) {
-            final char c = value.charAt(i);
+        final StringBuilder sb = new StringBuilder(value.length());
+        for (final char c : value.toCharArray()) {
             switch (c) {
             case '<':
                 sb.append("&lt;");
@@ -522,13 +520,12 @@ public class DOMElementWriter {
         while (prevEnd < len) {
             final int end = (cdataEndPos < 0 ? len : cdataEndPos);
             // Write out stretches of legal characters in the range [prevEnd, end).
-            for (int prevLegalCharPos = prevEnd; prevLegalCharPos < end;/*empty*/) {
-                int illegalCharPos;
-                for (illegalCharPos = prevLegalCharPos; true; ++illegalCharPos) {
-                    if (illegalCharPos >= end
-                        || !isLegalCharacter(value.charAt(illegalCharPos))) {
-                        break;
-                    }
+            int prevLegalCharPos = prevEnd;
+            while (prevLegalCharPos < end) {
+                int illegalCharPos = prevLegalCharPos;
+                while (illegalCharPos < end
+                        && isLegalCharacter(value.charAt(illegalCharPos))) {
+                    ++illegalCharPos;
                 }
                 out.write(value, prevLegalCharPos, illegalCharPos - prevLegalCharPos);
                 prevLegalCharPos = illegalCharPos + 1;

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/DateUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/DateUtils.java b/src/main/org/apache/tools/ant/util/DateUtils.java
index 6801fc5..4974c20 100644
--- a/src/main/org/apache/tools/ant/util/DateUtils.java
+++ b/src/main/org/apache/tools/ant/util/DateUtils.java
@@ -318,12 +318,12 @@ public final class DateUtils {
         }
     }
 
-    final private static ThreadLocal<DateFormat> iso8601WithTimeZone =
+    private static final ThreadLocal<DateFormat> iso8601WithTimeZone =
             ThreadLocal.withInitial(() -> {
               // An arbitrary easy-to-read format to normalize to.
               return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS Z");
             });
-    final private static Pattern iso8601normalizer = Pattern.compile(
+    private static final Pattern iso8601normalizer = Pattern.compile(
         "^(\\d{4,}-\\d{2}-\\d{2})[Tt ]" +           // yyyy-MM-dd
         "(\\d{2}:\\d{2}(:\\d{2}(\\.\\d{3})?)?) ?" + // HH:mm:ss.SSS
         "(?:Z|([+-]\\d{2})(?::?(\\d{2}))?)?$");     // Z

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java
index 0ca5e73..e7e7fa0 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -1615,7 +1615,6 @@ public class FileUtils {
         if (0 < toPathStack.length && 0 < fromPathStack.length) {
             if (!fromPathStack[0].equals(toPathStack[0])) {
                 // not the same device (would be "" on Linux/Unix)
-
                 return getPath(Arrays.asList(toPathStack));
             }
         } else {
@@ -1623,14 +1622,11 @@ public class FileUtils {
             return getPath(Arrays.asList(toPathStack));
         }
 
-        int minLength = Math.min(fromPathStack.length, toPathStack.length);
-        int same = 1; // Used outside the for loop
-
         // get index of parts which are equal
-        for (;
-             same < minLength && fromPathStack[same].equals(toPathStack[same]);
-             same++) {
-            // Do nothing
+        int minLength = Math.min(fromPathStack.length, toPathStack.length);
+        int same = 1;
+        while (same < minLength && fromPathStack[same].equals(toPathStack[same])) {
+            same++;
         }
 
         List<String> relativePathStack = new ArrayList<>();

http://git-wip-us.apache.org/repos/asf/ant/blob/dccbf1fc/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
index 6dcb3aa..f1031e1 100644
--- a/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
+++ b/src/main/org/apache/tools/ant/util/LayoutPreservingProperties.java
@@ -338,7 +338,7 @@ public class LayoutPreservingProperties extends Properties {
                 s = "\n" + s;
             } else {
                 // could be a comment, if first non-whitespace is a # or !
-                comment = s.matches("^( |\t|\f)*(#|!).*");
+                comment = s.matches("^([ \t\f])*([#!]).*");
             }
 
             // continuation if not a comment and the line ends is an