really compare the names as the javadocs claim

https://bz.apache.org/bugzilla/show_bug.cgi?id=66496
diff --git a/WHATSNEW b/WHATSNEW
index 267b0d5..7c80e89 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 12563d4..954757f 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 @@
         if (isReference()) {
             return getRef().compareTo(other);
         }
-        return toString().compareTo(other.toString());
+        return getName().compareTo(other.getName());
     }
 
     /**