orika-mapper/orika — pull request #11 by papegaaij (2013-06-13 18:28:57+00:00)
Title: Rewrite of SortedCollection to use a Topological sorting

In this pull request, I've rewritten SortedCollection using a more stable and reliable Topological sorting. Most of the testcases pass, however a few are still failing. At the moment I'm still investigating the failures:

CloneableConverterTestCase
overrideDefaultCloneableToImmutable
junit.framework.AssertionFailedError: expected same: was not:

MultiOccurrenceToMultiOccurrenceTestCase
multipleParallel
java.lang.NullPointerException
at ma.glasnost.orika.generated.Orika_GenericDto_MapOfScores_Mapper368241502962$820.mapAtoB(Orika_GenericDto_MapOfScores_Mapper368241502962$820.java:67)

TestAlternateCompilerStrategy[eclipseJdt]
MapGenerationTestCase
testNewSyntax_multipleParallel[eclipseJdt]
java.lang.NullPointerException
at ma.glasnost.orika.generated.Orika_GenericDto_MapWithoutSetter_Mapper370549480649$1002.mapAtoB(Orika_GenericDto_MapWithoutSetter_Mapper370549480649$1002.java:67)
at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:65)

These failures do not occur on every run, which makes me suspect they are related to pseudo-random ordering in a hashset. I've debugged the first failure, and it seems the wrong converter is returned. DefaultConverterFactory has multiple converters available for the combination sourceType and destinationType that are equally applicable. The one that is returned depends on which one is found first. This does not seem right and not very reliable. Perhaps you can look into this?