Java error: Comparison method violates its general contract

前端 未结 10 2142
别跟我提以往
别跟我提以往 2020-11-22 04:17

I saw many questions about this, and tried to solve the problem, but after one hour of googling and a lots of trial & error, I still can\'t fix it. I hope some of you ca

10条回答
  •  感情败类
    2020-11-22 05:22

    It might also be an OpenJDK bug... (not in this case but it is the same error)

    If somebody like me stumbles upon this answer regarding the

    java.lang.IllegalArgumentException: Comparison method violates its general contract!
    

    then it might also be a bug in the Java-Version. I have a compareTo running since several years now in some applications. But suddenly it stopped working and throws the error after all compares were done (i compare 6 Attributes before returning "0").

    Now I just found this Bugreport of OpenJDK:

    • JDK-8210311
    • Affects Version/s: 8, 11
    • Fix Version/s: 12
    • https://bugs.openjdk.java.net/browse/JDK-8210311

提交回复
热议问题