RFR: 8305072: Win32ShellFolder2.compareTo is inconsistent [v2]

Alexey Ivanov aivanov at openjdk.org
Tue Mar 5 17:40:01 UTC 2024


> The implementation of `Win32ShellFolder2.compareTo` is inconsistent: there are cases where  
> `a < b & b < c but a == c`  
> which *violates its general contract*.
> 
> In particular, it happens for the personal folder (*Documents*) if it is listed *twice*: as a special and as a regular folder.
> 
> The evaluation performed by the submitter of the bug provided enough details to create a test, reproduce the problem and finally resolve it.
> 
> Without the fix, the regression test always fails:
> 
> a < b & b < c but a >= c
> where
>   a = C:\Users<user>\Documents(true)
>   b = C:\Users<user>(false)
>   c = C:\Users<user>\Documents(false)
> 
> as well as for the reverse case: `a > b & b > c`.
> 
> How it is possible to have the same folder in a list of files twice remains unknown. I believe it is another bug in JDK, however, no one has been able to reproduce it so far.

Alexey Ivanov has updated the pull request incrementally with one additional commit since the last revision:

  Handle fakePersonal on Windows 10
  
  The desktop folder on Windows 10 does not include
  the Personal (Documents) folder.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18126/files
  - new: https://git.openjdk.org/jdk/pull/18126/files/7c442382..7bccc847

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18126&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18126&range=00-01

  Stats: 4 lines in 1 file changed: 4 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/18126.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18126/head:pull/18126

PR: https://git.openjdk.org/jdk/pull/18126


More information about the client-libs-dev mailing list