[jOOQ/jOOQ#14906] Internal API leaks into client code via generated table's join(TableLike<?>, JoinType) method

This commit is contained in:
Lukas Eder 2023-04-04 16:41:19 +02:00
parent 347a62933e
commit b356173936
3 changed files with 19 additions and 1 deletions

View File

@ -1335,8 +1335,10 @@ implements
// XXX: JOIN API
// ------------------------------------------------------------------------
// [#14906] Declare public API return type, allowing for JoinTable to override
// this only internally, to prevent leaking JoinTable into client code
@Override
public final JoinTable<?> join(TableLike<?> table, JoinType type) {
public /* non-final */ TableOptionalOnStep<Record> join(TableLike<?> table, JoinType type) {
switch (type) {
case CROSS_APPLY:
return new CrossApply(this, table);

View File

@ -950,6 +950,14 @@ implements
return or(notExists(select));
}
// [#14906] Re-declare internal-type-returning method here, to prevent J
// from leaking into client code.
@SuppressWarnings("unchecked")
@Override
public final J join(TableLike<?> table, JoinType type) {
return (J) super.join(table, type);
}
// -------------------------------------------------------------------------
// XXX: Query Object Model
// -------------------------------------------------------------------------

View File

@ -70,6 +70,7 @@ import org.jooq.Context;
import org.jooq.DataType;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.JoinType;
import org.jooq.Name;
// ...
import org.jooq.QueryPart;
@ -80,6 +81,8 @@ import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Table;
import org.jooq.TableLike;
import org.jooq.TableOptionalOnStep;
import org.jooq.TableOptions;
// ...
import org.jooq.impl.QOM.UNotYetImplemented;
@ -457,6 +460,11 @@ implements
return true;
}
@Override
public final TableOptionalOnStep<Record> join(TableLike<?> table, JoinType type) {
return super.join(table, type);
}
// -------------------------------------------------------------------------
// XXX: FieldsTrait "undeprecations" for generated code
// -------------------------------------------------------------------------