[jOOQ/jOOQ#17786] Avoid static type registry lookups in DSL::if_ and

DSL::iif calls, if possible
This commit is contained in:
Lukas Eder 2024-12-23 10:13:05 +01:00
parent 84df2232c8
commit b3b8a7fd8a

View File

@ -18402,7 +18402,12 @@ public class DSL {
// Java 8 is stricter than Java 7 with respect to generics and overload
// resolution (http://stackoverflow.com/q/5361513/521799)
static <T> Field<T> iif0(Name name, Condition condition, Field<T> ifTrue, Field<T> ifFalse) {
return new Iif<>(name, condition, Tools.nullSafe(ifTrue), Tools.nullSafe(ifFalse));
return new Iif<>(
name,
condition,
Tools.nullSafe(ifTrue, ifFalse.getDataType()),
Tools.nullSafe(ifFalse, ifTrue.getDataType())
);
}