xtext-core/org.eclipse.xtext.util
Moritz Eysholdt 923422737e fixed #238 in PolymorphicDispatcher#compare by not sorting methods
This fix prevents exceptions such as "IllegalArgumentException:
Comparison method violates its general contract" by not sorting the list
of methods at all. Since the method selection algorithm scans the
complete list of methods, the order of the list does not impact the
algorithm's outcome. 

The fix does not change the precedence of methods since the
implementation of compare(method1, method2) is kept the same.

However, this bug taught us that compare(m1, m2) is not suitable to
establish a total order among a list of methods and that 
compare(m1, m2)==0 && compare(m2, m3)==0 
does NOT imply compare(m1, m3)==0.

Example:
m1(A a), m2(B b), m3(C c), class A{}, class B{}, class C extends A{}

This observation required another change: When scanning the list of
methods for candidates, it does not suffice to compare the current
candidate with the last best candidate. Instead, it is needed to compare
the current candidate with all best candidates, because
compare(currentCandidate, lastBestCandidate)==0 does NOT imply compare()
to return 0 for the other best candidates. 

When calling compare(m1, m2) among the best candidates it is always
expected to return 0, meaning the candidates are unrelated (e.g.
independent inheritance hierarchies of their parameter types) or equal.

see https://github.com/eclipse/xtext-core/issues/238

Signed-off-by: Moritz Eysholdt <moritz.eysholdt@typefox.io>
2017-02-04 01:01:27 +01:00
..
.settings Gradle composite 2016-11-28 14:41:08 +01:00
META-INF Lifted version number to 2.12.0-SNAPSHOT 2017-01-18 11:47:03 +01:00
src/org/eclipse/xtext/util fixed #238 in PolymorphicDispatcher#compare by not sorting methods 2017-02-04 01:01:27 +01:00
xtend-gen/org/eclipse/xtext/util 479196: use version range [2.1.1,3) 2017-01-11 15:40:49 +01:00
.classpath Refreshed projects with Buildship 2.0 2017-01-12 10:32:06 +01:00
.project Refreshed projects with Buildship 2.0 2017-01-12 10:32:06 +01:00
about.html Moved projects to root of repository 2016-06-14 08:30:25 +02:00
build.gradle Fixed #160: Gradle build generates Maven-Version attribute 2016-10-23 19:39:43 +02:00
plugin.properties readded plugin.properties. fixes #154 2016-10-20 08:55:27 +02:00