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

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

commit 62b7fa1e09e761206c6d006260c82b470fba2e04
Author: Stefan Bodewig <[email protected]>
AuthorDate: Sat Feb 7 15:41:39 2026 +0100

    consistently refer to junctions as "Windows junctions"
---
 WHATSNEW                                           |  4 +--
 manual/Tasks/delete.html                           |  7 ++--
 manual/Tasks/mklink.html                           |  3 +-
 .../org/apache/tools/ant/DirectoryScanner.java     | 10 +++---
 src/main/org/apache/tools/ant/taskdefs/Delete.java | 16 ++++-----
 .../ant/taskdefs/optional/windows/Mklink.java      |  2 +-
 .../tools/ant/types/selectors/TokenizedPath.java   |  8 ++---
 src/main/org/apache/tools/ant/util/FileUtils.java  |  4 +--
 ...unctionUtils.java => WindowsJunctionUtils.java} | 42 +++++++++++-----------
 .../antunit/taskdefs/delete-and-junctions-test.xml | 14 +++-----
 10 files changed, 52 insertions(+), 58 deletions(-)

diff --git a/WHATSNEW b/WHATSNEW
index fac59d316..a7c7b1c43 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -61,10 +61,10 @@ Other changes:
    Bugzilla Report 69416
 
  * added a Windows specific <mklink> task that can be used to create
-   hard links, symbolic links and NTFS directory junctions.
+   hard links, symbolic links and junctions.
 
  * added <delete link="..."> that can be used delete symbolic links or
-   NTFS directory junctions. For symbolic links this duplicates what
+   Windows junctions. For symbolic links this duplicates what
    <symlink action="delete" ...> does - it has been introduced to
    handle symlinks and junctions via a single API.
 
diff --git a/manual/Tasks/delete.html b/manual/Tasks/delete.html
index 1af45ce9a..0cb8ec2d2 100644
--- a/manual/Tasks/delete.html
+++ b/manual/Tasks/delete.html
@@ -26,7 +26,7 @@
 
 <h2 id="delete">Delete</h2>
 <h3>Description</h3>
-<p>Deletes a single file, a symbolic link or NTFS junction, a specified 
directory and all its files and subdirectories, or a set of
+<p>Deletes a single file, a symbolic link or Windows junction, a specified 
directory and all its files and subdirectories, or a set of
 files specified by one or more <a 
href="../Types/resources.html#collection">resource
 collection</a>s.  The literal implication of <code>&lt;fileset&gt;</code> is 
that directories are
 not included; however the removal of empty directories can be triggered when 
using nested filesets
@@ -71,7 +71,7 @@ <h3>Parameters</h3>
   </tr>
   <tr>
     <td>link</td>
-    <td>The symbolic link or Windows directory junction to delete,
+    <td>The symbolic link or Windows junction to delete,
       specified as either the simple filename (if the link exists in
       the current base directory), a relative-path filename, or a
       full-path filename.<br/>
@@ -148,8 +148,7 @@ <h3>Parameters</h3>
     <td>Whether symbolic links (not the files/directories they link to) should 
be removed if they
       haven't been followed because <var>followSymlinks</var> was <q>false</q> 
or the maximum number
       of symbolic links was too big.  <em>Since Ant 1.8.0</em><br/>
-    Since since Ant 1.10.16 this also applies to not followed windows
-      directory junctions.</td>
+    Since since Ant 1.10.16 this also applies to not followed windows 
junctions.</td>
     <td>No; default <q>false</q></td>
   </tr>
   <tr>
diff --git a/manual/Tasks/mklink.html b/manual/Tasks/mklink.html
index f63bdaac7..4670b0310 100644
--- a/manual/Tasks/mklink.html
+++ b/manual/Tasks/mklink.html
@@ -27,8 +27,7 @@
 <h2 id="symlink">Mklink</h2>
 <p><em>Since Apache Ant 1.10.16</em>.</p>
 <h3>Description</h3>
-<p>Creates hardlinks, directory junctions and symbolic links on the
-  windows platform.</p>
+<p>Creates hardlinks, junctions and symbolic links on the windows platform.</p>
 <p>The task is just a wrapper
   around <a 
href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mklink";>mklink</a>
   and performs a few sanity checks but will not catch all restrictions
diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java 
b/src/main/org/apache/tools/ant/DirectoryScanner.java
index 9d2103941..ea459da69 100644
--- a/src/main/org/apache/tools/ant/DirectoryScanner.java
+++ b/src/main/org/apache/tools/ant/DirectoryScanner.java
@@ -47,7 +47,7 @@ import org.apache.tools.ant.types.selectors.SelectorUtils;
 import org.apache.tools.ant.types.selectors.TokenizedPath;
 import org.apache.tools.ant.types.selectors.TokenizedPattern;
 import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.NtfsJunctionUtils;
+import org.apache.tools.ant.util.WindowsJunctionUtils;
 import org.apache.tools.ant.util.VectorSet;
 
 /**
@@ -229,7 +229,7 @@ public class DirectoryScanner
 
     /** Helper. */
     private static final FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    private static final NtfsJunctionUtils JUNCTION_UTILS = 
NtfsJunctionUtils.getNtfsJunctionUtils();
+    private static final WindowsJunctionUtils JUNCTION_UTILS = 
WindowsJunctionUtils.getWindowsJunctionUtils();
 
     /**
      * Patterns which should be excluded by default.
@@ -872,7 +872,7 @@ public class DirectoryScanner
 
                 if (basedir != null && !followSymlinks
                     && (Files.isSymbolicLink(basedir.toPath())
-                        || JUNCTION_UTILS.isDirectoryJunctionSafe(basedir))) {
+                        || JUNCTION_UTILS.isJunctionSafe(basedir))) {
                     notFollowedSymlinks.add(basedir.getAbsolutePath());
                     basedir = null;
                 }
@@ -1220,7 +1220,7 @@ public class DirectoryScanner
                 final Path filePath = dir == null
                                         ? Paths.get(newFile)
                                         : dir.toPath().resolve(newFile);
-                if (Files.isSymbolicLink(filePath) || 
JUNCTION_UTILS.isDirectoryJunctionSafe(filePath)) {
+                if (Files.isSymbolicLink(filePath) || 
JUNCTION_UTILS.isJunctionSafe(filePath)) {
                     final String name = vpath + newFile;
                     final File file = new File(dir, newFile);
                     if (file.isDirectory()) {
@@ -1822,7 +1822,7 @@ public class DirectoryScanner
                                     : parent.toPath().resolve(dirName);
             if (directoryNamesFollowed.size() >= maxLevelsOfSymlinks
                 && Collections.frequency(directoryNamesFollowed, dirName) >= 
maxLevelsOfSymlinks
-                && (Files.isSymbolicLink(dirPath) || 
JUNCTION_UTILS.isDirectoryJunction(dirPath))) {
+                && (Files.isSymbolicLink(dirPath) || 
JUNCTION_UTILS.isJunction(dirPath))) {
 
                 final List<String> files = new ArrayList<>();
                 File f = FILE_UTILS.resolveFile(parent, dirName);
diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java 
b/src/main/org/apache/tools/ant/taskdefs/Delete.java
index 7b8882ac1..fe7c01c71 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Delete.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java
@@ -63,7 +63,7 @@ import org.apache.tools.ant.types.selectors.SelectSelector;
 import org.apache.tools.ant.types.selectors.SizeSelector;
 import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector;
 import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.NtfsJunctionUtils;
+import org.apache.tools.ant.util.WindowsJunctionUtils;
 
 /**
  * Deletes a file or directory, or set of files defined by a fileset.
@@ -83,7 +83,7 @@ public class Delete extends MatchingTask {
     private static final ResourceComparator REVERSE_FILESYSTEM = new 
Reverse(new FileSystem());
     private static final ResourceSelector EXISTS = new Exists();
     private static FileUtils FILE_UTILS = FileUtils.getFileUtils();
-    private static final NtfsJunctionUtils JUNCTION_UTILS = 
NtfsJunctionUtils.getNtfsJunctionUtils();
+    private static final WindowsJunctionUtils JUNCTION_UTILS = 
WindowsJunctionUtils.getWindowsJunctionUtils();
 
     private static class ReverseDirs implements ResourceCollection {
 
@@ -142,7 +142,7 @@ public class Delete extends MatchingTask {
     }
 
     /**
-     * Set the name of a single symbolic link or junction to be removed.
+     * Set the name of a single symbolic link or windows junction to be 
removed.
      *
      * @param file the link to be deleted
      * @since Ant 1.10.16
@@ -390,7 +390,7 @@ public class Delete extends MatchingTask {
     }
 
     /**
-     * Sets whether the symbolic links or Windows directory junctions
+     * Sets whether the symbolic links or Windows junctions
      * that have not been followed shall be removed (the links, not
      * the locations they point at).
      *
@@ -643,7 +643,7 @@ public class Delete extends MatchingTask {
         if (link != null) {
             if (link.exists()) {
                 if (Files.isSymbolicLink(link.toPath())
-                    || JUNCTION_UTILS.isDirectoryJunctionSafe(link)) {
+                    || JUNCTION_UTILS.isJunctionSafe(link)) {
                     log("Deleting: " + link.getAbsolutePath());
 
                     if (!delete(link)) {
@@ -745,7 +745,7 @@ public class Delete extends MatchingTask {
                         for (String link : links) {
                             final Path filePath = Paths.get(link);
                             if (!Files.isSymbolicLink(filePath)
-                                && 
!JUNCTION_UTILS.isDirectoryJunctionSafe(filePath)) {
+                                && !JUNCTION_UTILS.isJunctionSafe(filePath)) {
                                 // it's not a symbolic link or junction, so 
move on
                                 continue;
                             }
@@ -908,8 +908,8 @@ public class Delete extends MatchingTask {
     }
 
     private boolean isDanglingSymlink(final File f) {
-        if (!Files.isSymbolicLink(f.toPath()) && 
!JUNCTION_UTILS.isDirectoryJunctionSafe(f)) {
-            // it's not a symlink, so clearly it's not a dangling one
+        if (!Files.isSymbolicLink(f.toPath()) && 
!JUNCTION_UTILS.isJunctionSafe(f)) {
+            // it's not a symlink or junction, so clearly it's not a dangling 
one
             return false;
         }
         // it's a symbolic link, now  check the existence of the (target) file 
(by "following links")
diff --git 
a/src/main/org/apache/tools/ant/taskdefs/optional/windows/Mklink.java 
b/src/main/org/apache/tools/ant/taskdefs/optional/windows/Mklink.java
index 2a3a225ef..d08ae9710 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/windows/Mklink.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/windows/Mklink.java
@@ -167,7 +167,7 @@ public class Mklink extends Task {
         } else if (JUNCTION.equals(linkValue)) {
             sb.append("/j ");
             if (targetFile != null && !targetFile.isDirectory()) {
-                throw new BuildException("target of a directory junction must 
be a directory");
+                throw new BuildException("target of a junction must be a 
directory");
             }
         } else if (targetFile != null && !targetFile.isFile()) {
             throw new BuildException("target of a file symlink must be a 
file");
diff --git a/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java 
b/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
index b53920998..6ba1a2af9 100644
--- a/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
+++ b/src/main/org/apache/tools/ant/types/selectors/TokenizedPath.java
@@ -25,7 +25,7 @@ import java.nio.file.Paths;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.util.FileUtils;
-import org.apache.tools.ant.util.NtfsJunctionUtils;
+import org.apache.tools.ant.util.WindowsJunctionUtils;
 
 /**
  * Container for a path that has been split into its components.
@@ -33,7 +33,7 @@ import org.apache.tools.ant.util.NtfsJunctionUtils;
  */
 public class TokenizedPath {
 
-    private static final NtfsJunctionUtils JUNCTION_UTILS = 
NtfsJunctionUtils.getNtfsJunctionUtils();
+    private static final WindowsJunctionUtils JUNCTION_UTILS = 
WindowsJunctionUtils.getWindowsJunctionUtils();
 
     /**
      * Instance that holds no tokens at all.
@@ -136,7 +136,7 @@ public class TokenizedPath {
     }
 
     /**
-     * Do we have to traverse a symlink or directory junction when trying to 
reach path from
+     * Do we have to traverse a symlink or windows junction when trying to 
reach path from
      * basedir?
      * @param base base File (dir).
      * @return boolean
@@ -150,7 +150,7 @@ public class TokenizedPath {
                 pathToTraverse = Paths.get(base.toPath().toString(), token);
             }
             if (Files.isSymbolicLink(pathToTraverse)
-                || JUNCTION_UTILS.isDirectoryJunctionSafe(pathToTraverse)) {
+                || JUNCTION_UTILS.isJunctionSafe(pathToTraverse)) {
                 return true;
             }
             base = new File(base, token);
diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java 
b/src/main/org/apache/tools/ant/util/FileUtils.java
index 7739432b1..250b6a323 100644
--- a/src/main/org/apache/tools/ant/util/FileUtils.java
+++ b/src/main/org/apache/tools/ant/util/FileUtils.java
@@ -1999,14 +1999,14 @@ public class FileUtils {
 
     /**
      * Tries to get the canonical path of a file resolving symbolic
-     * links or Windows directory junctions.
+     * links or Windows junctions.
      *
      * <p>On any platform other than Windows this simply invokes
      * {@link File#getCanonicalPath()} - the same is true for Windows
      * if the current Java VM is at least Java 24.</p>
      *
      * <p>Prior to Java 24 <q>getCanonicalPath</q> doesn't resolve
-     * symbolic links or junctions points on Windows, so the code will
+     * symbolic links or junctions on Windows, so the code will
      * use {@link Path#toRealPath} instead - if the file or the file
      * linked to exists. If the file or the file linked to doesn't
      * exist the code falls back to {@link File#getCanonicalPath()}
diff --git a/src/main/org/apache/tools/ant/util/NtfsJunctionUtils.java 
b/src/main/org/apache/tools/ant/util/WindowsJunctionUtils.java
similarity index 66%
rename from src/main/org/apache/tools/ant/util/NtfsJunctionUtils.java
rename to src/main/org/apache/tools/ant/util/WindowsJunctionUtils.java
index ea46ef648..4acde99f9 100644
--- a/src/main/org/apache/tools/ant/util/NtfsJunctionUtils.java
+++ b/src/main/org/apache/tools/ant/util/WindowsJunctionUtils.java
@@ -33,61 +33,61 @@ import org.apache.tools.ant.taskdefs.condition.Os;
  *
  * @since Ant 1.10.16
  */
-public class NtfsJunctionUtils {
+public class WindowsJunctionUtils {
 
     private static final boolean ON_WINDOWS = Os.isFamily("windows");
 
     /**
      * Shared instance.
      */
-    private static final NtfsJunctionUtils PRIMARY_INSTANCE = new 
NtfsJunctionUtils();
+    private static final WindowsJunctionUtils PRIMARY_INSTANCE = new 
WindowsJunctionUtils();
 
     /**
-     * Method to retrieve The NtfsJunctionUtils, which is shared by
+     * Method to retrieve The WindowsJunctionUtils, which is shared by
      * all users of this method.
-     * @return an instance of NtfsJunctionUtils.
+     * @return an instance of WindowsJunctionUtils.
      */
-    public static NtfsJunctionUtils getNtfsJunctionUtils() {
+    public static WindowsJunctionUtils getWindowsJunctionUtils() {
         return PRIMARY_INSTANCE;
     }
 
     /**
      * Empty constructor.
      */
-    protected NtfsJunctionUtils() {
+    protected WindowsJunctionUtils() {
     }
 
     /**
-     * Checks whether a given file is a directory junction.
+     * Checks whether a given file is a windows junction.
      *
-     * @return true if the file is a directory junction.
+     * @return true if the file is a windows junction.
      * @throws IOException on error.
      */
-    public boolean isDirectoryJunction(final File file) throws IOException {
-        return isDirectoryJunction(file.toPath());
+    public boolean isJunction(final File file) throws IOException {
+        return isJunction(file.toPath());
     }
 
     /**
-     * Checks whether a given file is a directory junction.
+     * Checks whether a given file is a windows junction.
      *
-     * @return false if the given file is not a directory junction or
+     * @return false if the given file is not a windows junction or
      * an exception occured while trying to check the file - most
      * likely because the file didn't exists.
      */
-    public boolean isDirectoryJunctionSafe(final File file) {
-        return isDirectoryJunctionSafe(file.toPath());
+    public boolean isJunctionSafe(final File file) {
+        return isJunctionSafe(file.toPath());
     }
 
     /**
-     * Checks whether a given path is a directory junction.
+     * Checks whether a given path is a windows junction.
      *
-     * @return false if the given path is not a directory junction or
+     * @return false if the given path is not a junction or
      * an exception occured while trying to check the path - most
      * likely because the path didn't exists.
      */
-    public boolean isDirectoryJunctionSafe(final Path path) {
+    public boolean isJunctionSafe(final Path path) {
         try {
-            return isDirectoryJunction(path);
+            return isJunction(path);
         } catch (FileNotFoundException ex) {
             // ignore
         } catch (NoSuchFileException ex) {
@@ -99,12 +99,12 @@ public class NtfsJunctionUtils {
     }
 
     /**
-     * Checks whether a given path is a directory junction.
+     * Checks whether a given path is a windows junction.
      *
-     * @return true if the path is a directory junction.
+     * @return true if the path is a windows junction.
      * @throws IOException on error.
      */
-    public boolean isDirectoryJunction(final Path path) throws IOException {
+    public boolean isJunction(final Path path) throws IOException {
         if (!ON_WINDOWS) {
             return false;
         }
diff --git a/src/tests/antunit/taskdefs/delete-and-junctions-test.xml 
b/src/tests/antunit/taskdefs/delete-and-junctions-test.xml
index c0fc54a9a..bde893262 100644
--- a/src/tests/antunit/taskdefs/delete-and-junctions-test.xml
+++ b/src/tests/antunit/taskdefs/delete-and-junctions-test.xml
@@ -21,31 +21,27 @@
 
   <import file="../antunit-base.xml" />
 
-  <condition property="windows">
-    <os family="windows" />
-  </condition>
-
   <target name="tearDown" depends="removelink, antunit-base.tearDown"/>
 
   <target name="removelink" if="link">
     <delete link="${link}"/>
   </target>
 
-  <target name="setUp" if="windows">
+  <target name="setUp" if="windows_os">
     <mkdir dir="${input}/A/B"/>
     <mkdir dir="${input}/C"/>
     <property name="link" location="${input}/A/B/C"/>
     <mklink linktype="junction" link="${link}" targetfile="${input}/C"/>
   </target>
 
-  <target name="testNotFollowedLink" if="windows" depends="setUp">
+  <target name="testNotFollowedLink" if="windows_os" depends="setUp">
     <delete>
       <fileset dir="${input}" followSymlinks="false"/>
     </delete>
     <au:assertFileExists file="${input}/A/B/C"/>
   </target>
 
-  <target name="testRemoveNotFollowedLink" if="windows" depends="setUp">
+  <target name="testRemoveNotFollowedLink" if="windows_os" depends="setUp">
     <delete removeNotFollowedSymlinks="true">
       <fileset dir="${input}/A" followSymlinks="false"/>
     </delete>
@@ -54,7 +50,7 @@
   </target>
 
   <target name="testRemoveNotFollowedLinkDeletesNotIncludedDirs"
-          depends="setUp" if="windows"
+          depends="setUp" if="windows_os"
           
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=53959";>
     <delete removeNotFollowedSymlinks="true">
       <fileset dir="${input}/A" followSymlinks="false" includes="**/D"/>
@@ -63,7 +59,7 @@
     <au:assertFileExists file="${input}/C"/>
   </target>
 
-  <target name="testRemoveNotFollowedLinkHonorsExcludes" if="windows"
+  <target name="testRemoveNotFollowedLinkHonorsExcludes" if="windows_os"
           depends="setUp">
     <delete removeNotFollowedSymlinks="true">
       <fileset dir="${input}/A" followSymlinks="false" excludes="**/C/**"/>

Reply via email to