[jOOQ/jOOQ#7076] ForcedType enum with no matching value being converted
to last enum value
This commit is contained in:
parent
9eb3ff74fd
commit
1755f1b299
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user