diff --git a/WHATSNEW b/WHATSNEW index 93cce3858..b55295139 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -31,6 +31,10 @@ Other changes: * reduced GC pressure by replacing all usage of FileInputStream and FileOutputStream. + * Task can now also use attribute setters that expect a + java.nio.file.Path argument. + Bugzilla Report 61042 + Changes from Ant 1.10.0 TO Ant 1.10.1 ===================================== diff --git a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java index ca4085d20..424fb8e16 100644 --- a/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java +++ b/src/tests/junit/org/apache/tools/ant/IntrospectionHelperTest.java @@ -21,6 +21,8 @@ package org.apache.tools.ant; import java.io.File; import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Enumeration; import java.util.HashMap; import java.util.Hashtable; @@ -466,6 +468,7 @@ public class IntrospectionHelperTest { attrMap.put("seventeen", Byte.TYPE); attrMap.put("eightteen", Short.TYPE); attrMap.put("nineteen", Double.TYPE); + attrMap.put("twenty", Path.class); /* * JUnit 3.7 adds a getName method to TestCase - so we now @@ -546,6 +549,8 @@ public class IntrospectionHelperTest { new Short((short)18), new Short((short)10)); assertAttrMethod("nineteen", "setNineteen", Double.TYPE, new Double(19), new Double((short)10)); + assertAttrMethod("twenty", "setTwenty", Path.class, + new File(projectBasedir + 20).toPath(), Paths.get("toto")); try { assertAttrMethod("onehundred", null, null, null, null); @@ -634,6 +639,18 @@ public class IntrospectionHelperTest { assertTrue("Expected 19, received " + d, diff > -1e-6 && diff < 1e-6); } + public void setTwenty(Path p) { + String path = p.toAbsolutePath().toString(); + if (Os.isFamily("unix") || Os.isFamily("openvms")) { + assertEquals(projectBasedir+"20", path); + } else if (Os.isFamily("netware")) { + assertEquals(projectBasedir+"20", path.toLowerCase(Locale.US)); + } else { + assertEquals(":"+projectBasedir+"20", + path.toLowerCase(Locale.US).substring(1)); + } + } + @Test public void testGetExtensionPoints() { List extensions = ih.getExtensionPoints();