}
return Optional.empty();
}
@NotNull
private Optional<TypeConversion> findConversionsRegisteredFor(@NotNull Type source, @NotNull Type target) {
<BUG>List<TypeConversion> candidates = mappings.getOrDefault(source, emptyList());
</BUG>
for (int i = candidates.size() - 1; i >= 0; i--) {
<BUG>TypeConversion conversion = candidates.get(i);

if (isAssignable(target, conversion.getTarget()))
return Optional.of(conversion);
</BUG>
}

}
@NotNull
Optional<TypeConversion> findConversion(@NotNull Type source, @NotNull Type target) {
for (Type cl = wrap(source); cl != null; cl = genericSuperClass(cl)) {
Optional<TypeConversion> conversion = findConversionsRegisteredFor(cl, target);
if (conversion.isPresent())
return conversion;
}
for (Type cl : genericInterfaces(source)) {
Optional<TypeConversion> conversion = findConversionsRegisteredFor(cl, target);
if (conversion.isPresent())
return conversion;
}
