[jOOQ/jOOQ#18941] Fix also manually written instances

This commit is contained in:
Lukas Eder 2025-09-02 16:20:39 +02:00
parent 04c0c3aa53
commit 74915bc1ef
7 changed files with 23 additions and 16 deletions

View File

@ -37,6 +37,8 @@
*/
package org.jooq.impl;
import java.util.Objects;
import org.jooq.Clause;
import org.jooq.Context;
import org.jooq.DataType;
@ -195,7 +197,7 @@ implements
public boolean equals(Object that) {
if (that instanceof Coerce<?> o) {
return
StringUtils.equals($field(), o.$field())
Objects.equals($field(), o.$field())
;
}
else

View File

@ -65,6 +65,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
@ -802,7 +803,7 @@ final class LoaderImpl<R extends Record> implements
// [#2741] TODO: This logic will be externalised in new SPI
// [#8829] JSON binary data has already been decoded at this point
for (int i = 0; i < row.length; i++)
if (StringUtils.equals(nullString, row[i]))
if (Objects.equals(nullString, row[i]))
row[i] = null;
else if (i < fields.length && fields[i] != null)
if (fields[i].getType() == byte[].class && row[i] instanceof String)

View File

@ -65,6 +65,7 @@ import java.sql.Timestamp;
import java.time.Instant;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import org.jooq.Commit;
@ -554,7 +555,7 @@ final class MigrationImpl extends AbstractScope implements Migration {
// [#9506] Make sure history record is re-created in case it was rolled back.
HistoryRecord record = history.currentHistoryRecord(false);
if (record == null || !StringUtils.equals(e.record.getId(), record.getId())) {
if (record == null || !Objects.equals(e.record.getId(), record.getId())) {
e.record.touched(true);
e.record.insert();
}

View File

@ -49,6 +49,7 @@ import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Stream;
import org.jooq.Catalog;
@ -428,11 +429,11 @@ implements
return
// [#7172] [#10274] Cannot use getQualifiedName() yet here
StringUtils.equals(
Objects.equals(
defaultIfNull(getCatalog(), DEFAULT_CATALOG),
defaultIfNull(other.getCatalog(), DEFAULT_CATALOG)
) &&
StringUtils.equals(getName(), other.getName());
Objects.equals(getName(), other.getName());
}
return super.equals(that);

View File

@ -58,6 +58,7 @@ import static org.jooq.impl.Tools.ExtendedDataKey.DATA_RENDER_TABLE;
import static org.jooq.impl.UpdateQueryImpl.NO_SUPPORT_UPDATE_JOIN;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
@ -310,8 +311,8 @@ implements
if (that instanceof TableField) {
TableField<?, ?> other = (TableField<?, ?>) that;
return
StringUtils.equals(getTable(), other.getTable()) &&
StringUtils.equals(getName(), other.getName());
Objects.equals(getTable(), other.getTable()) &&
Objects.equals(getName(), other.getName());
}
return super.equals(that);

View File

@ -64,6 +64,7 @@ import static org.jooq.tools.StringUtils.defaultIfNull;
import java.lang.reflect.Constructor;
import java.util.Arrays;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
@ -71,7 +72,6 @@ import org.jooq.Clause;
import org.jooq.Comment;
import org.jooq.Condition;
import org.jooq.Context;
import org.jooq.DDLQuery;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.ForeignKey;
@ -90,7 +90,6 @@ import org.jooq.TableOptionalOnStep;
import org.jooq.TableOptions;
import org.jooq.impl.QOM.JoinHint;
import org.jooq.impl.QOM.UEmpty;
import org.jooq.tools.StringUtils;
import org.jooq.tools.reflect.Reflect;
import org.jetbrains.annotations.Nullable;
@ -664,11 +663,11 @@ implements
return
// [#7172] [#10274] Cannot use getQualifiedName() yet here
StringUtils.equals(
Objects.equals(
defaultIfNull(getSchema(), DEFAULT_SCHEMA.get()),
defaultIfNull(t.getSchema(), DEFAULT_SCHEMA.get())
) &&
StringUtils.equals(getName(), t.getName()) &&
Objects.equals(getName(), t.getName()) &&
Arrays.equals(parameters, t.parameters);
}

View File

@ -45,6 +45,8 @@ import static org.jooq.impl.SchemaImpl.DEFAULT_SCHEMA;
import static org.jooq.impl.Tools.BooleanDataKey.DATA_STORE_ASSIGNMENT;
import static org.jooq.tools.StringUtils.defaultIfNull;
import java.util.Objects;
import org.jooq.Binding;
import org.jooq.Catalog;
import org.jooq.Clause;
@ -247,17 +249,17 @@ implements
if (getQualifier() instanceof Table && that instanceof TableField<?, ?> other) {
return
StringUtils.equals(getQualifier(), other.getTable()) &&
StringUtils.equals(getName(), other.getName());
Objects.equals(getQualifier(), other.getTable()) &&
Objects.equals(getName(), other.getName());
}
// [#2144] UDTPathFieldImpl equality can be decided without executing the
// rather expensive implementation of AbstractQueryPart.equals()
else if (that instanceof UDTPathField<?, ?, ?> other) {
return
StringUtils.equals(getQualifier(), other.getQualifier()) &&
StringUtils.equals(getUDT(), other.getUDT()) &&
StringUtils.equals(getName(), other.getName());
Objects.equals(getQualifier(), other.getQualifier()) &&
Objects.equals(getUDT(), other.getUDT()) &&
Objects.equals(getName(), other.getName());
}
return super.equals(that);