Typo in javadoc of Path's .normalize()?

Alan Bateman Alan.Bateman at oracle.com
Sat Nov 29 15:18:00 UTC 2014


On 29/11/2014 15:09, Alan Bateman wrote:
> On 29/11/2014 14:02, Francis Galiegue wrote:
>> Hello,
>>
>> In the documentation of the returned value of .normalize(), it is said
>> that "[...]an empty path is returned if this path does have a root
>> component and all name elements are redundant".
>>
>> s,does,does not,?
>>
>> It would be logical; for instance, on Unix systems,
>> Paths.get("/.").normalize() returns "/", not "".
>>
> You are right, there is a typo here, this should red "does not have a 
> root component". We'll get this fixed.
I've created JDK-8066196 to track, the diff is trivial and will push to 
JDK 9 once I get a Reviewer.

-Alan.

diff --git a/src/java.base/share/classes/java/nio/file/Path.java 
b/src/java.base/share/classes/java/nio/file/Path.java
--- a/src/java.base/share/classes/java/nio/file/Path.java
+++ b/src/java.base/share/classes/java/nio/file/Path.java
@@ -325,7 +325,7 @@
       *
       * @return  the resulting path or this path if it does not contain
       *          redundant name elements; an empty path is returned if 
this path
-     *          does have a root component and all name elements are 
redundant
+     *          does not have a root component and all name elements 
are redundant
       *
       * @see #getParent
       * @see #toRealPath


More information about the nio-dev mailing list