[jOOQ/jOOQ#14131] Improve Val.getName() for array values

This commit is contained in:
Lukas Eder 2022-10-25 10:29:51 +02:00
parent ecd949beb4
commit 5c936a2396

View File

@ -118,11 +118,14 @@ abstract class AbstractParam<T> extends AbstractParamX<T> implements SimpleQuery
private final static String name(Object value) {
// [#13392] The generated name of a byte[] value shouldn't depend on the
// identity of the value, but on the value itself
// [#13392] [##14131] The generated name of an array value shouldn't
// depend on the identity of the value, but on the value itself
if (value instanceof byte[] b) {
return "b_" + Internal.hash0(Arrays.hashCode(Arrays.copyOf(b, 16)));
}
else if (value instanceof Object[] o) {
return "a_" + Internal.hash0(Arrays.hashCode(Arrays.copyOf(o, 16)));
}
else
return String.valueOf(value);
}