[jOOQ/jOOQ#16013] ClassCastException during invocation of double-wrapped

ConvertedDataType
This commit is contained in:
Lukas Eder 2024-10-16 12:02:14 +02:00
parent 834b42ffe3
commit 89fb4edb25
2 changed files with 9 additions and 1 deletions

View File

@ -842,6 +842,13 @@ implements
return convert(object, converterContext());
}
static final <T> T convert0(DataType<T> type, Object object, ConverterContext cc) {
if (type instanceof AbstractDataType<T> t)
return t.convert(object, cc);
else
return type.convert(object);
}
/* non-final */ T convert(Object object, ConverterContext cc) {
// [#1441] Avoid unneeded type conversions to improve performance

View File

@ -316,8 +316,9 @@ final class ConvertedDataType<T, U> extends AbstractDataTypeX<U> {
return (U) object;
// [#3200] Try to convert arbitrary objects to T
// [#16013] [#17428] Avoid repeated conversion in case of chained converters
else
return ((ContextConverter<T, U>) getConverter()).from(delegate.convert(object, cc), cc);
return ((ContextConverter<T, U>) getConverter()).from((T) convert0(delegate(delegate), object, cc), cc);
}
@Override