Integrated: 8305072: Win32ShellFolder2.compareTo is inconsistent
Alexey Ivanov
aivanov at openjdk.org
Tue Apr 9 13:22:07 UTC 2024
On Tue, 5 Mar 2024 17:01:45 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
> 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.
This pull request has now been integrated.
Changeset: 2fcb8168
Author: Alexey Ivanov <aivanov at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/2fcb816858406f33cefef3164b2c85f9f996c7da
Stats: 160 lines in 2 files changed: 158 ins; 0 del; 2 mod
8305072: Win32ShellFolder2.compareTo is inconsistent
Reviewed-by: prr, serb
-------------
PR: https://git.openjdk.org/jdk/pull/18126
More information about the client-libs-dev
mailing list