xtext-core/org.eclipse.xtext.tests
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
emf-gen/org/eclipse/xtext Added common configuration file mwe2-workflows.gradle for generating Xtext languages from Gradle 2017-01-11 16:56:41 +01:00
generator [492072] Regenerated Xtend code 2017-01-02 14:33:55 +01:00
lib Moved projects to root of repository 2016-06-14 08:30:25 +02:00
META-INF Merge pull request #255 from eclipse/msp_issue223 2017-01-19 11:09:40 +01:00
src fixed #238 in PolymorphicDispatcher#compare by not sorting methods 2017-02-04 01:01:27 +01:00
src-gen/org/eclipse/xtext Added common configuration file mwe2-workflows.gradle for generating Xtext languages from Gradle 2017-01-11 16:56:41 +01:00
suites/org/eclipse/xtext fixed tests 2016-06-17 18:31:25 +02:00
testdata/wizard-expectations fixed #265: Create pom.xml that installs Xtend Debug Info 2017-01-28 15:14:07 +01:00
xtend-gen/org/eclipse/xtext Merge pull request #237 from eclipse/se_reuse_resourcet 2017-02-01 12:08:19 +01:00
.classpath Refreshed projects with Buildship 2.0 2017-01-12 10:32:06 +01:00
.gitignore Migrated workflows to new generator 2016-07-08 15:55:22 +02: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 Added common configuration file mwe2-workflows.gradle for generating Xtext languages from Gradle 2017-01-11 16:56:41 +01:00
GenerateAllTestLanguages.mwe2.launch Migrated workflows to new generator 2016-07-08 15:55:22 +02:00
plugin.properties [502879] Streamlined plugin metadata 2016-09-30 17:17:31 +02:00
plugin.xml Added common configuration file mwe2-workflows.gradle for generating Xtext languages from Gradle 2017-01-11 16:56:41 +01:00
plugin.xml_gen Moved projects to root of repository 2016-06-14 08:30:25 +02:00
xtext.tests (xtend).launch Updated manifests and launch configs, added filter for parent subfolders 2016-07-08 11:36:31 +02:00
xtext.tests.launch Updated manifests and launch configs, added filter for parent subfolders 2016-07-08 11:36:31 +02:00