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
The following commit(s) were added to refs/heads/master by this push:
new d29f62fcc really compare the names as the javadocs claim
d29f62fcc is described below
commit d29f62fcc2d263878c1b53fc10d9bd4b9dbc8377
Author: Stefan Bodewig <[email protected]>
AuthorDate: Mon Apr 3 12:36:33 2023 +0200
really compare the names as the javadocs claim
https://bz.apache.org/bugzilla/show_bug.cgi?id=66496
---
WHATSNEW | 7 +++++++
src/main/org/apache/tools/ant/types/Resource.java | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/WHATSNEW b/WHATSNEW
index 267b0d549..7c80e8926 100644
--- a/WHATSNEW
+++ b/WHATSNEW
@@ -1,6 +1,13 @@
Changes from Ant 1.10.13 TO Ant 1.10.14
=======================================
+Changes that could break older environments:
+-------------------------------------------
+
+ * Resource#compareTo now invokes getName rather than toString as the
+ later may be costly (for example in the case of a StringResource).
+ Bugzilla Report 66496
+
Fixed bugs:
-----------
diff --git a/src/main/org/apache/tools/ant/types/Resource.java
b/src/main/org/apache/tools/ant/types/Resource.java
index 12563d426..954757f25 100644
--- a/src/main/org/apache/tools/ant/types/Resource.java
+++ b/src/main/org/apache/tools/ant/types/Resource.java
@@ -277,7 +277,7 @@ public class Resource extends DataType implements
Comparable<Resource>, Resource
if (isReference()) {
return getRef().compareTo(other);
}
- return toString().compareTo(other.toString());
+ return getName().compareTo(other.getName());
}
/**