When Converters.getConverter doesn't find an exact match for a
conversion request, it loops over all registered converts, and asks
then if they can handle it.  However, this looping is not in any
particular order, as it is based on Map.values(), which is mostly random.

This means if there was a Converter registered for Map, and another
registered for LinkedHashMap, that if code tried to convert
org.ofbiz.base.util.collection.LRUMap, it's unknown which Converter
would be returned.  I would say LinkedHashMap is more correct.

Then, if there was a Map and MyNewInterface Converter register, and a
conversion request comes in that implements both those interfaces,
then which one should be returned?

Java compilers(janino is one I am semi-familiar with it's internals),
are designed to handle this.  But the algorithm isn't the simplest.

I suggest that if multiple Converters are found for a request, that an
exception gets thrown, and a warning logged.

Reply via email to