Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311517 - builder ordering algorithm gives wrong results
Summary: builder ordering algorithm gives wrong results
Status: CLOSED FIXED
Alias: None
Product: MoDisco
Classification: Modeling
Component: Infrastructure (show other bugs)
Version: 0.8.0   Edit
Hardware: All All
: P1 normal (vote)
Target Milestone: 0.8.0   Edit
Assignee: Nicolas Bros CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-04 07:43 EDT by Nicolas Bros CLA
Modified: 2010-10-01 13:35 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Bros CLA 2010-05-04 07:43:34 EDT
While debugging, I found out that the customization builder appeared before all the other builders in the list of builders, which is supposed to be ordered by dependency. It should be last in this list, since it depends on the ecore, query and facet builders.

The ModiscoProjectBuilder.BuilderDescriptor#compareTo method gives those results (where C=customization builder, E=ecore builder, etc.):

C = E, E < F, F > Q, E < Q, F = J

The resulting list is C,E,Q,F,J, which is consistent with the results returned by compare.

The problem lies in the fact that compare returns 0 (meaning equal) for 2 builders that are independent, but not equal, hereby breaking the contract of "Comparable".

In fact, depending on the sorting algorithm (quick sort, insertion sort, etc.), the result can be different.
Comment 1 Nicolas Bros CLA 2010-05-04 08:27:28 EDT
Fixed in revision 2188, by using a different algorithm for sorting:
first add builders that depend on nothing to a list, then those that depend only on those already in the list, etc.
Comment 2 Hugo Bruneliere CLA 2010-10-01 13:35:06 EDT
Bug fixed.