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/08/20 05:36:16 UTC

ant git commit: Remove redundancies

Repository: ant
Updated Branches:
  refs/heads/master 16d0f4d81 -> 77cd591b6


Remove redundancies

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

Branch: refs/heads/master
Commit: 77cd591b636d6b3fbb1e33421a7048d696d431ac
Parents: 16d0f4d
Author: Gintas Grigelionis <gi...@apache.org>
Authored: Mon Aug 20 07:27:40 2018 +0200
Committer: Gintas Grigelionis <gi...@apache.org>
Committed: Mon Aug 20 07:27:40 2018 +0200

----------------------------------------------------------------------
 .../tools/ant/ProjectHelperRepository.java      |  6 ++--
 .../apache/tools/ant/filters/FixCrLfFilter.java | 14 ++++----
 .../apache/tools/ant/taskdefs/AntStructure.java | 37 +++++---------------
 .../org/apache/tools/ant/taskdefs/Execute.java  |  4 +--
 .../constantpool/InvokeDynamicCPInfo.java       |  2 +-
 .../depend/constantpool/MethodHandleCPInfo.java |  2 +-
 .../depend/constantpool/MethodTypeCPInfo.java   |  2 +-
 .../junit/BriefJUnitResultFormatter.java        |  3 +-
 .../optional/junitlauncher/LauncherSupport.java |  2 +-
 .../org/apache/tools/ant/types/PatternSet.java  |  2 +-
 .../ant/types/resources/selectors/Majority.java |  2 --
 .../tools/ant/util/FlatFileNameMapper.java      |  4 ++-
 .../ant/util/optional/JavaxScriptRunner.java    |  2 +-
 .../zip/UnsupportedZipFeatureException.java     |  3 +-
 .../tools/ant/taskdefs/DefaultExcludesTest.java |  2 +-
 .../org/apache/tools/ant/taskdefs/JavaTest.java | 10 +++---
 .../tools/ant/util/ReaderInputStreamTest.java   |  2 +-
 17 files changed, 39 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/ProjectHelperRepository.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/ProjectHelperRepository.java b/src/main/org/apache/tools/ant/ProjectHelperRepository.java
index 532374b..d404186 100644
--- a/src/main/org/apache/tools/ant/ProjectHelperRepository.java
+++ b/src/main/org/apache/tools/ant/ProjectHelperRepository.java
@@ -181,10 +181,8 @@ public class ProjectHelperRepository {
         try {
             // This code is needed by EBCDIC and other strange systems.
             // It's a fix for bugs reported in xerces
-            InputStreamReader isr;
-            isr = new InputStreamReader(is, StandardCharsets.UTF_8);
-            BufferedReader rd = new BufferedReader(isr);
-
+            BufferedReader rd = new BufferedReader(new InputStreamReader(is,
+                    StandardCharsets.UTF_8));
             String helperClassName = rd.readLine();
             rd.close();
 

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java b/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
index f5e23c4..5cb4633 100644
--- a/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
+++ b/src/main/org/apache/tools/ant/filters/FixCrLfFilter.java
@@ -442,11 +442,11 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
             return in instanceof SimpleFilterReader && ((SimpleFilterReader) in).editsBlocked();
         }
 
-        public int read() throws java.io.IOException {
+        public int read() throws IOException {
             return preemptIndex > 0 ? preempt[--preemptIndex] : in.read();
         }
 
-        public void close() throws java.io.IOException {
+        public void close() throws IOException {
             in.close();
         }
 
@@ -458,23 +458,23 @@ public final class FixCrLfFilter extends BaseParamFilterReader implements Chaina
             return in.markSupported();
         }
 
-        public boolean ready() throws java.io.IOException {
+        public boolean ready() throws IOException {
             return in.ready();
         }
 
-        public void mark(int i) throws java.io.IOException {
+        public void mark(int i) throws IOException {
             in.mark(i);
         }
 
-        public long skip(long i) throws java.io.IOException {
+        public long skip(long i) throws IOException {
             return in.skip(i);
         }
 
-        public int read(char[] buf) throws java.io.IOException {
+        public int read(char[] buf) throws IOException {
             return read(buf, 0, buf.length);
         }
 
-        public int read(char[] buf, int start, int length) throws java.io.IOException {
+        public int read(char[] buf, int start, int length) throws IOException {
             int count = 0;
             int c = 0;
 

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/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 11529a6..10473d3 100644
--- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
+++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java
@@ -87,22 +87,8 @@ public class AntStructure extends Task {
             throw new BuildException("output attribute is required", getLocation());
         }
 
-        PrintWriter out = null;
-        try {
-            OutputStream fos = null;
-            try {
-                fos = Files.newOutputStream(output.toPath());
-                out = new PrintWriter(new OutputStreamWriter(fos, StandardCharsets.UTF_8));
-            } catch (final UnsupportedEncodingException ue) {
-                FileUtils.close(fos);
-                /*
-                 * Plain impossible with UTF8, see
-                 * http://java.sun.com/j2se/1.5.0/docs/guide/intl/encoding.doc.html
-                 *
-                 * fallback to platform specific anyway.
-                 */
-                out = new PrintWriter(new FileWriter(output));
-            }
+        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(
+                Files.newOutputStream(output.toPath()), StandardCharsets.UTF_8))) {
 
             printer.printHead(out, getProject(),
                     new Hashtable<>(getProject().getTaskDefinitions()),
@@ -110,31 +96,24 @@ public class AntStructure extends Task {
 
             printer.printTargetDecl(out);
 
-            for (final String typeName : getProject().getCopyOfDataTypeDefinitions()
-                .keySet()) {
-                printer.printElementDecl(
-                                     out, getProject(), typeName,
-                                     getProject().getDataTypeDefinitions().get(typeName));
+            for (final String typeName : getProject().getCopyOfDataTypeDefinitions().keySet()) {
+                printer.printElementDecl(out, getProject(), typeName,
+                        getProject().getDataTypeDefinitions().get(typeName));
             }
 
             for (final String tName : getProject().getCopyOfTaskDefinitions().keySet()) {
                 printer.printElementDecl(out, getProject(), tName,
-                                         getProject().getTaskDefinitions().get(tName));
+                        getProject().getTaskDefinitions().get(tName));
             }
 
             printer.printTail(out);
 
             if (out.checkError()) {
-                throw new IOException(
-                    "Encountered an error writing Ant structure");
+                throw new IOException("Encountered an error writing Ant structure");
             }
         } catch (final IOException ioe) {
             throw new BuildException("Error writing "
-                                     + output.getAbsolutePath(), ioe, getLocation());
-        } finally {
-            if (out != null) {
-                out.close();
-            }
+                    + output.getAbsolutePath(), ioe, getLocation());
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/Execute.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java
index 913ba36..2f29256 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Execute.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java
@@ -428,7 +428,7 @@ public class Execute {
      * Runs a process defined by the command line and returns its exit status.
      *
      * @return the exit status of the subprocess or <code>INVALID</code>.
-     * @exception java.io.IOException The exception is thrown, if launching
+     * @exception IOException The exception is thrown, if launching
      *            of the subprocess failed.
      */
     public int execute() throws IOException {
@@ -484,7 +484,7 @@ public class Execute {
      * Starts a process defined by the command line.
      * Ant will not wait for this process, nor log its output.
      *
-     * @throws java.io.IOException The exception is thrown, if launching
+     * @throws IOException The exception is thrown, if launching
      *            of the subprocess failed.
      * @since Ant 1.6
      */

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java
index 176b99a..d415826 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/InvokeDynamicCPInfo.java
@@ -43,7 +43,7 @@ public class InvokeDynamicCPInfo extends ConstantCPInfo {
      *
      * @param cpStream the DataInputStream which contains the constant pool
      *      entry to be read.
-     * @exception java.io.IOException if there is a problem reading the entry from
+     * @exception IOException if there is a problem reading the entry from
      *      the stream.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java
index 1da7365..32ba9ad 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodHandleCPInfo.java
@@ -58,7 +58,7 @@ public class MethodHandleCPInfo extends ConstantPoolEntry {
      *
      * @param cpStream the DataInputStream which contains the constant pool
      *      entry to be read.
-     * @exception java.io.IOException if there is a problem reading the entry from
+     * @exception IOException if there is a problem reading the entry from
      *      the stream.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java
index 7b6f9a6..660bb36 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/MethodTypeCPInfo.java
@@ -41,7 +41,7 @@ public class MethodTypeCPInfo extends ConstantCPInfo {
      *
      * @param cpStream the DataInputStream which contains the constant pool
      *      entry to be read.
-     * @exception java.io.IOException if there is a problem reading the entry from
+     * @exception IOException if there is a problem reading the entry from
      *      the stream.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
index ecf33e7..d1ac28b 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/BriefJUnitResultFormatter.java
@@ -21,6 +21,7 @@ package org.apache.tools.ant.taskdefs.optional.junit;
 import java.io.BufferedWriter;
 import java.io.IOException;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.StringWriter;
 import java.text.NumberFormat;
 
@@ -91,7 +92,7 @@ public class BriefJUnitResultFormatter implements JUnitResultFormatter, IgnoredT
     @Override
     public void setOutput(OutputStream out) {
         this.out = out;
-        output = new BufferedWriter(new java.io.OutputStreamWriter(out));
+        output = new BufferedWriter(new OutputStreamWriter(out));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java
index 6a8027b..f020f66 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/junitlauncher/LauncherSupport.java
@@ -238,7 +238,7 @@ class LauncherSupport {
             throw new BuildException("Listener class " + className + " is not of type " + TestExecutionListener.class.getName());
         }
         try {
-            return TestExecutionListener.class.cast(klass.newInstance());
+            return (TestExecutionListener) klass.newInstance();
         } catch (Exception e) {
             throw new BuildException("Failed to create an instance of listener " + className, e);
         }

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/types/PatternSet.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/PatternSet.java b/src/main/org/apache/tools/ant/types/PatternSet.java
index 167a246..bf20fcf 100644
--- a/src/main/org/apache/tools/ant/types/PatternSet.java
+++ b/src/main/org/apache/tools/ant/types/PatternSet.java
@@ -218,7 +218,7 @@ public class PatternSet extends DataType implements Cloneable {
         public String toString() {
             String baseString = super.toString();
             return encoding == null ? baseString
-                : new StringBuilder(baseString).append(";encoding->").append(encoding).toString();
+                : baseString + ";encoding->" + encoding;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/types/resources/selectors/Majority.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/types/resources/selectors/Majority.java b/src/main/org/apache/tools/ant/types/resources/selectors/Majority.java
index 7adcbf7..ded9205 100644
--- a/src/main/org/apache/tools/ant/types/resources/selectors/Majority.java
+++ b/src/main/org/apache/tools/ant/types/resources/selectors/Majority.java
@@ -17,8 +17,6 @@
  */
 package org.apache.tools.ant.types.resources.selectors;
 
-import java.util.Iterator;
-
 import org.apache.tools.ant.types.Resource;
 
 /**

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
index 07ba4c6..203da5f 100644
--- a/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
+++ b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java
@@ -18,6 +18,8 @@
 
 package org.apache.tools.ant.util;
 
+import java.io.File;
+
 /**
  * Implementation of FileNameMapper that always returns the source
  * file name without any leading directory information.
@@ -53,6 +55,6 @@ public class FlatFileNameMapper implements FileNameMapper {
     @Override
     public String[] mapFileName(String sourceFileName) {
         return sourceFileName == null ? null
-            : new String[] {new java.io.File(sourceFileName).getName()};
+            : new String[] {new File(sourceFileName).getName()};
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java b/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
index 28246d3..2e7c044 100644
--- a/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
+++ b/src/main/org/apache/tools/ant/util/optional/JavaxScriptRunner.java
@@ -110,7 +110,7 @@ public class JavaxScriptRunner extends ScriptRunnerBase {
                             "Unable to create javax script engine for %s",
                             getLanguage());
                     }
-                    if (Compilable.class.isInstance(engine)) {
+                    if (engine instanceof Compilable) {
                         getProject().log("compile script " + execName,
                             Project.MSG_VERBOSE);
 

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
index 34e2117..112e7e4 100644
--- a/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
+++ b/src/main/org/apache/tools/zip/UnsupportedZipFeatureException.java
@@ -18,6 +18,7 @@
 
 package org.apache.tools.zip;
 
+import java.io.Serializable;
 import java.util.zip.ZipException;
 
 /**
@@ -66,7 +67,7 @@ public class UnsupportedZipFeatureException extends ZipException {
      * ZIP Features that may or may not be supported.
      */
     @SuppressWarnings("serial")
-    public static class Feature implements java.io.Serializable {
+    public static class Feature implements Serializable {
         /**
          * The entry is encrypted.
          */

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/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 44c90b1..e028469 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/DefaultExcludesTest.java
@@ -161,7 +161,7 @@ public class DefaultExcludesTest {
         assertEquals("current default excludes: string array length match", expected.length, actual.length);
         for (String element : expected) {
             assertTrue("current default excludes: didn't find element " + element + " in array match",
-                    Arrays.stream(actual).anyMatch(member -> member.equals(element)));
+                    Arrays.asList(actual).contains(element));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
index 2630a81..1406600 100644
--- a/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
+++ b/src/tests/junit/org/apache/tools/ant/taskdefs/JavaTest.java
@@ -418,7 +418,7 @@ public class JavaTest {
      * @throws Exception
      */
     @Test
-    public void testSimpleSourceFile() throws Exception {
+    public void testSimpleSourceFile() {
         requireJava11();
         buildRule.executeTarget("simpleSourceFile");
     }
@@ -429,7 +429,7 @@ public class JavaTest {
      * @throws Exception
      */
     @Test
-    public void testSourceFileRequiresFork() throws Exception {
+    public void testSourceFileRequiresFork() {
         requireJava11();
         thrown.expect(BuildException.class);
         thrown.expectMessage("Cannot execute sourcefile in non-forked mode. Please set fork='true'");
@@ -443,7 +443,7 @@ public class JavaTest {
      * @throws Exception
      */
     @Test
-    public void testSourceFileCantUseClassname() throws Exception {
+    public void testSourceFileCantUseClassname() {
         requireJava11();
         thrown.expect(BuildException.class);
         thrown.expectMessage("Cannot use 'sourcefile' in combination with");
@@ -457,7 +457,7 @@ public class JavaTest {
      * @throws Exception
      */
     @Test
-    public void testSourceFileCantUseJar() throws Exception {
+    public void testSourceFileCantUseJar() {
         requireJava11();
         thrown.expect(BuildException.class);
         thrown.expectMessage("Cannot use 'sourcefile' in combination with");
@@ -471,7 +471,7 @@ public class JavaTest {
      * @throws Exception
      */
     @Test
-    public void testSourceFileCantUseModule() throws Exception {
+    public void testSourceFileCantUseModule() {
         requireJava11();
         thrown.expect(BuildException.class);
         thrown.expectMessage("Cannot use 'sourcefile' in combination with");

http://git-wip-us.apache.org/repos/asf/ant/blob/77cd591b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
index a82189e..332af76 100644
--- a/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
+++ b/src/tests/junit/org/apache/tools/ant/util/ReaderInputStreamTest.java
@@ -81,7 +81,7 @@ public class ReaderInputStreamTest {
     }
 
     @Test
-    public void testPreample() throws Exception {
+    public void testPreample() {
         byte[] bytes = "".getBytes(StandardCharsets.UTF_16);
         System.out.println("Preample len is " + bytes.length);
     }


Re: ant git commit: Remove redundancies

Posted by Gintautas Grigelionis <g....@gmail.com>.
On Thu, 23 Aug 2018 at 07:06, Stefan Bodewig <bo...@apache.org> wrote:

> On 2018-08-22, Matt Sicker wrote:
>
> > Pretty much every implementation of javac will automatically convert the
> > string concatenation code into StringBuilders. Decompile the byte code
> and
> > see for yourself.
>
> I know that :-)
>
> The thing I qibble about is the commit message says "remove
> redundancies" and I don't see any redundancy in the original code.
>

Sorry, my bad. That should have been "early suboptimisation".
I believe, Java 9+ optimises string concatenation differently (or,
actually, it may use invokedynamic to delay it :-).

Gintas

Re: ant git commit: Remove redundancies

Posted by Stefan Bodewig <bo...@apache.org>.
On 2018-08-22, Matt Sicker wrote:

> Pretty much every implementation of javac will automatically convert the
> string concatenation code into StringBuilders. Decompile the byte code and
> see for yourself.

I know that :-)

The thing I qibble about is the commit message says "remove
redundancies" and I don't see any redundancy in the original code.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: ant git commit: Remove redundancies

Posted by Matt Sicker <bo...@gmail.com>.
Pretty much every implementation of javac will automatically convert the
string concatenation code into StringBuilders. Decompile the byte code and
see for yourself.

On Tue, 21 Aug 2018 at 13:05, Stefan Bodewig <bo...@apache.org> wrote:

>
> > diff --git a/src/main/org/apache/tools/ant/types/PatternSet.java
> b/src/main/org/apache/tools/ant/types/PatternSet.java
>
> > -                : new
> StringBuilder(baseString).append(";encoding->").append(encoding).toString();
> > +                : baseString + ";encoding->" + encoding;
>
> I don't understand what kind of redundancy have you been removing here.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>

-- 
Matt Sicker <bo...@gmail.com>

Re: ant git commit: Remove redundancies

Posted by Stefan Bodewig <bo...@apache.org>.
> diff --git a/src/main/org/apache/tools/ant/types/PatternSet.java b/src/main/org/apache/tools/ant/types/PatternSet.java

> -                : new StringBuilder(baseString).append(";encoding->").append(encoding).toString();
> +                : baseString + ";encoding->" + encoding;

I don't understand what kind of redundancy have you been removing here.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org