Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356700

Summary: Eclipse IDE for C/C++ Developers unable to install Java updates
Product: [Eclipse Project] Equinox Reporter: Steven Bluen <sbluen>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: pascal, sven.koehler, tjwatson
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Steven Bluen CLA 2011-09-04 23:23:48 EDT
I installed the item on http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers-includes-incubating-components/indigor and then tried to install Eclipse Java Development Tools	3.7.0.v20110520-0800-7z8gFchFMTdFYKuLqBLqRja9B15B. I used the internal server http://download.eclipse.org/releases/indigo. I got this error:

An internal error occurred during: "Install download0".
Comparison method violates its general contract!


-- Configuration Details --
Product: Eclipse 1.4.0.20110609-1120 (org.eclipse.epp.package.cpp.product)
Installed Features:
 org.eclipse.platform 3.7.0.v20110530-9gF7UHNFFt4cwE-pkZDJ7oz-mj4OSEIlu9SEv0f
Comment 1 Steven Bluen CLA 2011-09-05 02:42:15 EDT
In addition, when I try to install C/C++ Development Tools	8.0.0.201106081058 on the current version of the download at http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/indigor, I get this error:

An error occurred while collecting items to be installed
session context was:(profile=epp.package.java, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
Comparison method violates its general contract!
Comparison method violates its general contract!
Comment 2 Sven Köhler CLA 2011-09-25 14:33:12 EDT
This is probably not a CDT error. It happens for me when I try to update from Eclipse 3.7.0 to 3.7.1. Here's the stack trace from the error log:

java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:835)
	at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:453)
	at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:376)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:182)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
	at java.util.Arrays.sort(Arrays.java:472)
	at org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector.hasValidMirror(MirrorSelector.java:319)
	at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.downloadArtifact(SimpleArtifactRepository.java:577)
	at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getArtifact(SimpleArtifactRepository.java:680)
	at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.getArtifact(MirrorRequest.java:260)
	at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transferSingle(MirrorRequest.java:235)
	at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transfer(MirrorRequest.java:191)
	at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.perform(MirrorRequest.java:122)
	at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getArtifact(SimpleArtifactRepository.java:664)
	at org.eclipse.equinox.internal.p2.artifact.repository.simple.DownloadJob.run(DownloadJob.java:63)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 3 Sven Köhler CLA 2011-09-25 14:42:04 EDT
The error went away, when I ran Eclipse with JDK 1.6.0_27 instead of JDK 1.7.
Now the question is: is there a bug in JDK 1.7's sort algorithm, or did it detect a bug in a comparator implementation inside Eclipse?
Comment 4 Andrew Gvozdev CLA 2011-09-26 08:27:20 EDT
(In reply to comment #2)
> This is probably not a CDT error. It happens for me when I try to update from
> Eclipse 3.7.0 to 3.7.1. Here's the stack trace from the error log:
> java.lang.IllegalArgumentException: Comparison method violates its general
> contract!
...
> org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector.hasValidMirror(MirrorSelector.java:319)
That's coming from p2 component
Comment 5 Pascal Rapicault CLA 2011-09-26 09:15:50 EDT
Java 7 revealed a pb in the p2 code. This has been fixed in 3.7.1. There is a dupe but I can't find it.