Skip to content

Error - java.lang.IllegalArgumentException: Comparison method violates its general contract! #2123

@PriyankaKeer

Description

@PriyankaKeer

Hi Team,

Getting below error in Junit testcase for comparator.

Caused by: java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeHi(TimSort.java:899)
at java.util.TimSort.mergeAt(TimSort.java:516)
at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
at java.util.TimSort.sort(TimSort.java:254)
at java.util.Arrays.sort(Arrays.java:1438)
at java.util.List.sort(List.java:478)
at java.util.Collections.sort(Collections.java:175)

While using below VM argument, it is working fine - For JDK 1.8.
-Djava.util.Arrays.useLegacyMergeSort=true

But the same is failing in Open JDK 1.8.

Thanks in Advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions