From 8bf57c477f8e98216f6bface064f888e95ef59da Mon Sep 17 00:00:00 2001 From: Lukas Eder Date: Mon, 10 Jun 2024 13:51:53 +0200 Subject: [PATCH] [jOOQ/jOOQ#16810] Deprecate DataType.convert() --- jOOQ/src/main/java/org/jooq/DataType.java | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/jOOQ/src/main/java/org/jooq/DataType.java b/jOOQ/src/main/java/org/jooq/DataType.java index 1476fcec56..9f148e243d 100644 --- a/jOOQ/src/main/java/org/jooq/DataType.java +++ b/jOOQ/src/main/java/org/jooq/DataType.java @@ -411,7 +411,21 @@ public interface DataType extends Named { * @param object The object to be converted * @return The converted object * @throws DataTypeException If conversion fails. + * @deprecated - 3.20.0 - [#16810] - Static data type conversion has been a + * controversial historic feature of jOOQ. While occasionally + * useful for internal data types (such as {@link String} to + * {@link Integer} conversion, etc.) it doesn't work well with + * user defined types. 1) This method does not go through + * {@link Configuration#converterProvider()}, 2) nor does it + * provide an appropriate {@link ConverterContext} to a + * {@link ContextConverter}, leading to subtle bugs. 3) It also + * doesn't make any guarantees related to what user defined + * types can be passed to it. This is why this method is + * deprecated and will be removed in a future jOOQ version. Use + * {@link #getConverter()} on this type, instead, and use that + * for data type conversions. */ + @Deprecated(forRemoval = true) T convert(Object object); /** @@ -424,7 +438,21 @@ public interface DataType extends Named { * @param objects The objects to be converted * @return The converted objects * @throws DataTypeException If conversion fails. + * @deprecated - 3.20.0 - [#16810] - Static data type conversion has been a + * controversial historic feature of jOOQ. While occasionally + * useful for internal data types (such as {@link String} to + * {@link Integer} conversion, etc.) it doesn't work well with + * user defined types. 1) This method does not go through + * {@link Configuration#converterProvider()}, 2) nor does it + * provide an appropriate {@link ConverterContext} to a + * {@link ContextConverter}, leading to subtle bugs. 3) It also + * doesn't make any guarantees related to what user defined + * types can be passed to it. This is why this method is + * deprecated and will be removed in a future jOOQ version. Use + * {@link #getConverter()} on this type, instead, and use that + * for data type conversions. */ + @Deprecated(forRemoval = true) T @NotNull [] convert(Object... objects); /** @@ -437,7 +465,21 @@ public interface DataType extends Named { * @param objects The objects to be converted * @return The converted objects * @throws DataTypeException If conversion fails. + * @deprecated - 3.20.0 - [#16810] - Static data type conversion has been a + * controversial historic feature of jOOQ. While occasionally + * useful for internal data types (such as {@link String} to + * {@link Integer} conversion, etc.) it doesn't work well with + * user defined types. 1) This method does not go through + * {@link Configuration#converterProvider()}, 2) nor does it + * provide an appropriate {@link ConverterContext} to a + * {@link ContextConverter}, leading to subtle bugs. 3) It also + * doesn't make any guarantees related to what user defined + * types can be passed to it. This is why this method is + * deprecated and will be removed in a future jOOQ version. Use + * {@link #getConverter()} on this type, instead, and use that + * for data type conversions. */ + @Deprecated(forRemoval = true) @NotNull List convert(Collection objects);