This is an automated email from the ASF dual-hosted git repository.

jkf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 7b825e7  More easily avoidable 1.x confusion removed
7b825e7 is described below

commit 7b825e7c9600aa98156572bf8e83871f7e6bd911
Author: jkf <j...@famkruithof.net>
AuthorDate: Sat Jun 15 16:58:31 2019 +0200

    More easily avoidable 1.x confusion removed
---
 src/main/org/apache/tools/ant/launch/Locator.java  | 51 ----------------------
 .../org/apache/tools/ant/taskdefs/Javadoc.java     | 50 ++++++++++++---------
 .../ant/taskdefs/compilers/JavacExternal.java      | 13 +++---
 3 files changed, 37 insertions(+), 77 deletions(-)

diff --git a/src/main/org/apache/tools/ant/launch/Locator.java 
b/src/main/org/apache/tools/ant/launch/Locator.java
index 9ebdc62..f755827 100644
--- a/src/main/org/apache/tools/ant/launch/Locator.java
+++ b/src/main/org/apache/tools/ant/launch/Locator.java
@@ -164,57 +164,6 @@ public final class Locator {
      * @since Ant 1.6
      */
     public static String fromURI(String uri) {
-        return fromURIJava13(uri);
-        // #buzilla8031: first try Java 1.4.
-        // TODO should use java.net.URI now that we can rely on 1.4...
-        // but check for UNC-related regressions, e.g. #42275
-        // (and remember that \\server\share\file -> file:////server/share/file
-        // rather than -> file://server/share/file as it should;
-        // fixed only in JDK 7's java.nio.file.Path.toUri)
-        // return fromUriJava14(uri);
-    }
-
-    /**
-     * Java1.4+ code to extract the path from the URI.
-     * @param uri
-     * @return null if a conversion was not possible
-     */
-    /* currently unused:
-    private static String fromUriJava14(String uri) {
-        // Also check for properly formed URIs. Ant formerly recommended using
-        // nonsense URIs such as "file:./foo.xml" in XML includes. You 
shouldn't
-        // do that (just "foo.xml" is correct) but for compatibility we 
special-case
-        // things when the path is not absolute, and fall back to the old 
parsing behavior.
-        if (uri.startsWith("file:/")) {
-            try {
-                File f = new File(URI.create(encodeURI(uri)));
-                //bug #42227 forgot to decode before returning
-                return decodeUri(f.getAbsolutePath());
-            } catch (IllegalArgumentException e) {
-                // Bad URI, pass this on.
-                // no, this is downgraded to a warning after various
-                // JRE bugs surfaced. Hand off
-                // to our built in code on a failure
-                //throw new IllegalArgumentException(
-                //   "Bad URI " + uri + ":" + e.getMessage(), e);
-                e.printStackTrace();
-            } catch (Exception e) {
-                // Unexpected exception? Should not happen.
-                e.printStackTrace();
-            }
-        }
-        return null;
-    }
-     */
-
-    /**
-     * @param uri uri to expand
-     * @return the decoded URI
-     * @since Ant1.7.1
-     */
-    private static String fromURIJava13(String uri) {
-        // Fallback method for Java 1.3 or earlier.
-
         URL url = null;
         try {
             url = new URL(uri);
diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java 
b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
index ee53c50..6a433fa 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
@@ -1846,7 +1846,11 @@ public class Javadoc extends Task {
         doDocFilesSubDirs(toExecute); // docfilessubdir attribute
         doModuleArguments(toExecute);
 
-        doJava14(toExecute);
+        doTags(toExecute);
+               doSource(toExecute);
+               doLinkSource(toExecute);
+               doNoqualifier(toExecute);
+               
         if (breakiterator) {
             toExecute.createArgument().setValue("-breakiterator");
         }
@@ -2207,9 +2211,30 @@ public class Javadoc extends Task {
         }
     }
 
-    // Do java1.4 arguments
-    private void doJava14(final Commandline toExecute) {
-        for (final Object element : tags) {
+    private void doNoqualifier(final Commandline toExecute) {
+               if (noqualifier != null && doclet == null) {
+            toExecute.createArgument().setValue("-noqualifier");
+            toExecute.createArgument().setValue(noqualifier);
+        }
+       }
+
+       private void doLinkSource(final Commandline toExecute) {
+               if (linksource && doclet == null) {
+            toExecute.createArgument().setValue("-linksource");
+        }
+       }
+
+       private void doSource(final Commandline toExecute) {
+               final String sourceArg = source != null ? source
+            : getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE);
+        if (sourceArg != null) {
+            toExecute.createArgument().setValue("-source");
+            toExecute.createArgument().setValue(sourceArg);
+        }
+       }
+
+       private void doTags(final Commandline toExecute) {
+               for (final Object element : tags) {
             if (element instanceof TagArgument) {
                 final TagArgument ta = (TagArgument) element;
                 final File tagDir = ta.getDir(getProject());
@@ -2254,22 +2279,7 @@ public class Javadoc extends Task {
                 }
             }
         }
-
-        final String sourceArg = source != null ? source
-            : getProject().getProperty(MagicNames.BUILD_JAVAC_SOURCE);
-        if (sourceArg != null) {
-            toExecute.createArgument().setValue("-source");
-            toExecute.createArgument().setValue(sourceArg);
-        }
-
-        if (linksource && doclet == null) {
-            toExecute.createArgument().setValue("-linksource");
-        }
-        if (noqualifier != null && doclet == null) {
-            toExecute.createArgument().setValue("-noqualifier");
-            toExecute.createArgument().setValue(noqualifier);
-        }
-    }
+       }
 
     private void doDocFilesSubDirs(final Commandline toExecute) {
         if (docFilesSubDirs) {
diff --git 
a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java 
b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
index 35d1c64..5627fa9 100644
--- a/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
+++ b/src/main/org/apache/tools/ant/taskdefs/compilers/JavacExternal.java
@@ -64,12 +64,13 @@ public class JavacExternal extends DefaultCompilerAdapter {
 
         String[] commandLine = cmd.getCommandline();
         int firstFileName;
-        if (assumeJava11()) {
-            firstFileName = -1;
-        } else {
-            firstFileName = moveJOptionsToBeginning(commandLine);
-        }
-
+        
+               if (assumeJava1_2Plus()) {
+                       firstFileName = moveJOptionsToBeginning(commandLine);
+               } else {
+                       firstFileName = -1;
+               }
+        
         return executeExternalCompile(commandLine, firstFileName,
                 true)
                 == 0;

Reply via email to