[jOOQ/jOOQ#16090] Handle DSL.val(T) and DSL.inline(T)

This commit is contained in:
Lukas Eder 2024-03-11 13:06:10 +01:00
parent 9e496d1e1d
commit cfc5221ad3
3 changed files with 8 additions and 2 deletions

View File

@ -33932,7 +33932,8 @@ public class DSL {
static <T> Param<T> val0(T value, boolean inferredDataType) {
Class type = value == null ? Object.class : value.getClass();
return val0(value, getDataType0(type), inferredDataType);
DataType dataType = getDataType0(type);
return val0(value, dataType, inferredDataType || !(dataType instanceof BuiltInDataType));
}
/**

View File

@ -849,7 +849,7 @@ public class DefaultDataType<T> extends AbstractDataTypeX<T> {
static final <T> DataType<T> check(DataType<T> result) {
// [#5713] [#15286] TODO: Move this to a dynamic type registry and make warning configurable
if (result instanceof LegacyConvertedDataType) {
if (LegacyConvertedDataType.isInstance(result)) {
DiscouragedStaticTypeRegistryUsage e = new DiscouragedStaticTypeRegistryUsage();
getDataType.warn("Static type registry", """

View File

@ -150,4 +150,9 @@ final class LegacyConvertedDataType<T, U> extends DefaultDataType<U> {
public <X> DataType<X> asConvertedDataType(Converter<? super U, X> converter) {
return super.asConvertedDataType(new ChainedConverterBinding(getBinding(), converter));
}
static final boolean isInstance(DataType<?> t) {
return t instanceof LegacyConvertedDataType
|| t instanceof DataTypeProxy && isInstance(((DataTypeProxy<?>) t).type());
}
}