This is an automated email from the ASF dual-hosted git repository.
jaikiran 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 fd0d38bde 69586: javac argument file generation creates invalid
classpath entry when no classpath is defined
fd0d38bde is described below
commit fd0d38bdeb3cb92c1fd7f7f61263c7282a9263ef
Author: Jaikiran Pai <[email protected]>
AuthorDate: Sun Mar 9 11:33:43 2025 +0530
69586: javac argument file generation creates invalid classpath entry when
no classpath is defined
Contributed by: SeB
---
WHATSNEW | 5 +++++
.../tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java | 10 +++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/WHATSNEW b/WHATSNEW
index e7af9c429..9b17917bb 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -7,6 +7,11 @@ Fixed bugs:
* <scp> now properly handles IPv6 addresses as hostnames.
Bugzilla Report 59160
+ * javac task has been fixed to generate the "-classpath" option
+ only when there are any classpath elements present.
+ Bugzilla Report 69586
+
+
Changes from Ant 1.10.14 TO Ant 1.10.15
=======================================
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 cf3ec45f3..5a2b4441f 100644
---
a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
+++
b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java
@@ -304,8 +304,6 @@ public abstract class DefaultCompilerAdapter
cmd.createArgument().setFile(destDir);
}
- cmd.createArgument().setValue("-classpath");
-
// Just add "sourcepath" to classpath (for JDK1.1)
// as well as "bootclasspath" and "extdirs"
if (!assumeJava1_2Plus()) {
@@ -317,9 +315,15 @@ public abstract class DefaultCompilerAdapter
}
cp.append(classpath);
cp.append(sourcepath);
+
+ cmd.createArgument().setValue("-classpath");
cmd.createArgument().setPath(cp);
} else {
- cmd.createArgument().setPath(classpath);
+ if (!classpath.isEmpty()) {
+ cmd.createArgument().setValue("-classpath");
+ cmd.createArgument().setPath(classpath);
+ }
+
// If the buildfile specifies sourcepath="", then don't
// output any sourcepath.
if (sourcepath.size() > 0) {