Search code examples
eclipseeclipse-plugineclipse-pdt

"Comparison method violates its general contract!" when trying to install Eclipse plugin


I have following system:

$ cat /etc/redhat-release 
Scientific Linux release 6.1 (Carbon)
$ uname -a
Linux wcmisdlin02.uftmasterad.org 2.6.32-279.9.1.el6.x86_64 #1 SMP Tue Sep 25 14:55:44 CDT 2012 x86_64 x86_64 x86_64 GNU/Linux
$ 

and I have following packages

$ rpm -qa | grep ^eclipse
eclipse-emf-2.6.0-1.el6.x86_64
eclipse-svnkit-1.3.0-3.el6.x86_64
eclipse-swt-3.6.1-6.13.el6.x86_64
eclipse-rcp-3.6.1-6.13.el6.x86_64
eclipse-rse-3.2-1.el6.x86_64
eclipse-jdt-3.6.1-6.13.el6.x86_64
eclipse-pde-3.6.1-6.13.el6.x86_64
eclipse-platform-3.6.1-6.13.el6.x86_64
eclipse-subclipse-1.6.5-6.el6.x86_64
$

Whenever I'm trying to install PDT through Eclipse I'm getting following error:

An error occurred while collecting items to be installed
session context was:(profile=PlatformProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Comparison method violates its general contract!
Comparison method violates its general contract!

* UPDATE *

$ rpm -qa | grep ^java
java-1.6.0-openjdk-javadoc-1.6.0.0-1.49.1.11.4.el6_3.x86_64
java-1.6.0-openjdk-1.6.0.0-1.49.1.11.4.el6_3.x86_64
java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
java-1.6.0-openjdk-devel-1.6.0.0-1.49.1.11.4.el6_3.x86_64
java_cup-0.10k-5.el6.x86_64
java-1.7.0-openjdk-1.7.0.5-2.2.1.el6_3.3.x86_64
$ 

I also found this:

$ sudo grep java-1.7.0 /var/log/yum.log
Sep 21 12:46:33 Installed: 1:java-1.7.0-openjdk-1.7.0.5-2.2.1.el6_3.3.x86_64
$ 

Solution

  • This might be the known Eclipse bug I encountered a few month ago. The problem is related to a new implementation of Arrays.sort() in JDK 7.

    If it is this bug, you need to install a newer version of Eclipse since the bug prevents you from updating (from within Eclipse).

    Alternatively, you may try starting Eclipse with the system property java.util.Arrays.useLegacyMergeSort=true and then update the Eclipse platform.