[jOOQ/jOOQ#7076] ForcedType enum with no matching value being converted

to last enum value
This commit is contained in:
Lukas Eder 2022-11-24 12:05:29 +01:00
parent 9eb3ff74fd
commit 1755f1b299

View File

@ -75,13 +75,20 @@ public /* non-final */ class EnumConverter<T, U extends Enum<U>> extends Abstrac
this.to = to;
this.lookup = new LinkedHashMap<>();
for (U u : toType.getEnumConstants())
this.lookup.put(to(u), u);
for (U u : toType.getEnumConstants()) {
T key = to(u);
if (key != null)
this.lookup.put(key, u);
}
}
@Override
public final U from(T t) {
return lookup.get(t);
if (t == null)
return null;
else
return lookup.get(t);
}
/**