[jOOQ/jOOQ#11083] DataType should cache null_() and notNull() variants

This commit is contained in:
Lukas Eder 2024-02-29 08:53:18 +01:00
parent 181d838797
commit 1740abe739

View File

@ -85,21 +85,24 @@ abstract class AbstractDataTypeX<T> extends AbstractDataType<T> {
@Override
public /* non-final */ DataType<T> nullability(Nullability n) {
return construct(
precision0(),
scale0(),
length0(),
n,
hidden(),
readonly(),
generatedAlwaysAsGenerator(),
generationOption(),
generationLocation(),
collation(),
characterSet(),
!n.nullable() && identity(),
defaultValue()
);
if (n == nullability())
return this;
else
return construct(
precision0(),
scale0(),
length0(),
n,
hidden(),
readonly(),
generatedAlwaysAsGenerator(),
generationOption(),
generationLocation(),
collation(),
characterSet(),
!n.nullable() && identity(),
defaultValue()
);
}
@Override