On Thu, 25 Sep 2025 19:36:35 GMT, Alexander Matveev <[email protected]> 
wrote:

>> A quote from 
>> https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/nio/file/Path.html#equals(java.lang.Object):
>> 
>>> Where required, the 
>>> [isSameFile](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/nio/file/Files.html#isSameFile(java.nio.file.Path,java.nio.file.Path))
>>>  method may be used to check if two paths locate the same file.
>> 
>> In this specific case, two Path objects locate the same file; there is no 
>> point in comparing them. However, there is a need to compare their path 
>> strings, i.e, locators.
>
> So, `realPath` and  `file` locate the same file, but `file` can be symbolic 
> link like `/usr/lib/symlinkToFile` and `realPath` will be `/usr/lib/File`. 
> Assuming `/usr/lib/symlinkToFile`  points to `/usr/lib/File`.
> 
> https://github.com/openjdk/jdk/blob/master/src/java.base/unix/classes/sun/nio/fs/UnixPath.java#L797
> 
> Based on implementation `equals()` should do the same as string comparison.

Ah, OK, then I misunderstood the `Path.equals()` documentation. I'll get it 
fixed

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27377#discussion_r2380365082

Reply via email to