From 85a6013944da283a99fd6a648a828a89d8f44507 Mon Sep 17 00:00:00 2001 From: Chantal Loncle <82039410+bog-walk@users.noreply.github.com> Date: Tue, 15 Oct 2024 22:22:09 -0400 Subject: [PATCH] feat!: Change all entity type paramaters from Comparable to Any - EntityID still implements Comparable interface itself --- exposed-core/api/exposed-core.api | 50 ++++++------ .../jetbrains/exposed/dao/id/CompositeID.kt | 15 ++-- .../org/jetbrains/exposed/dao/id/EntityID.kt | 8 +- .../org/jetbrains/exposed/dao/id/IdTable.kt | 18 ++--- .../kotlin/org/jetbrains/exposed/sql/Alias.kt | 2 +- .../org/jetbrains/exposed/sql/ColumnType.kt | 2 +- .../kotlin/org/jetbrains/exposed/sql/Op.kt | 2 +- .../org/jetbrains/exposed/sql/Queries.kt | 4 +- .../org/jetbrains/exposed/sql/ResultRow.kt | 2 +- .../exposed/sql/SQLExpressionBuilder.kt | 38 ++++----- .../kotlin/org/jetbrains/exposed/sql/Table.kt | 18 ++--- .../exposed/sql/statements/UpdateBuilder.kt | 4 +- exposed-dao/api/exposed-dao.api | 12 +-- .../org/jetbrains/exposed/dao/DaoEntityID.kt | 2 +- .../exposed/dao/DaoEntityIDFactory.kt | 2 +- .../org/jetbrains/exposed/dao/Entity.kt | 20 ++--- .../org/jetbrains/exposed/dao/EntityCache.kt | 12 +-- .../org/jetbrains/exposed/dao/EntityClass.kt | 78 +++++++++---------- .../org/jetbrains/exposed/dao/EntityHook.kt | 6 +- .../jetbrains/exposed/dao/InnerTableLink.kt | 2 +- .../org/jetbrains/exposed/dao/References.kt | 32 ++++---- .../shared/dml/ColumnWithTransformTest.kt | 4 +- .../entities/CompositeIdTableEntityTest.kt | 2 +- 23 files changed, 171 insertions(+), 164 deletions(-) diff --git a/exposed-core/api/exposed-core.api b/exposed-core/api/exposed-core.api index b21738db24..a4544371b0 100644 --- a/exposed-core/api/exposed-core.api +++ b/exposed-core/api/exposed-core.api @@ -4,11 +4,11 @@ public final class org/jetbrains/exposed/dao/id/CompositeID : java/lang/Comparab public fun compareTo (Lorg/jetbrains/exposed/dao/id/CompositeID;)I public final fun contains (Lorg/jetbrains/exposed/sql/Column;)Z public fun equals (Ljava/lang/Object;)Z - public final fun get (Lorg/jetbrains/exposed/sql/Column;)Ljava/lang/Comparable; + public final fun get (Lorg/jetbrains/exposed/sql/Column;)Ljava/lang/Object; public fun hashCode ()I public final fun setWithEntityID (Lorg/jetbrains/exposed/sql/Column;Lorg/jetbrains/exposed/dao/id/EntityID;)V - public final fun setWithEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)V - public final fun setWithNullableEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)V + public final fun setWithEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)V + public final fun setWithNullableEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)V public fun toString ()Ljava/lang/String; } @@ -24,13 +24,13 @@ public class org/jetbrains/exposed/dao/id/CompositeIdTable : org/jetbrains/expos } public class org/jetbrains/exposed/dao/id/EntityID : java/lang/Comparable { - public fun (Ljava/lang/Comparable;Lorg/jetbrains/exposed/dao/id/IdTable;)V - protected fun (Lorg/jetbrains/exposed/dao/id/IdTable;Ljava/lang/Comparable;)V + public fun (Ljava/lang/Object;Lorg/jetbrains/exposed/dao/id/IdTable;)V + protected fun (Lorg/jetbrains/exposed/dao/id/IdTable;Ljava/lang/Object;)V public synthetic fun compareTo (Ljava/lang/Object;)I public fun compareTo (Lorg/jetbrains/exposed/dao/id/EntityID;)I public fun equals (Ljava/lang/Object;)Z public final fun getTable ()Lorg/jetbrains/exposed/dao/id/IdTable; - public final fun getValue ()Ljava/lang/Comparable; + public final fun getValue ()Ljava/lang/Object; public final fun get_value ()Ljava/lang/Object; public fun hashCode ()I protected fun invokeOnNoValue ()V @@ -39,12 +39,12 @@ public class org/jetbrains/exposed/dao/id/EntityID : java/lang/Comparable { } public abstract interface class org/jetbrains/exposed/dao/id/EntityIDFactory { - public abstract fun createEntityID (Ljava/lang/Comparable;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; + public abstract fun createEntityID (Ljava/lang/Object;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; } public final class org/jetbrains/exposed/dao/id/EntityIDFunctionProvider { public static final field INSTANCE Lorg/jetbrains/exposed/dao/id/EntityIDFunctionProvider; - public final fun createEntityID (Ljava/lang/Comparable;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; + public final fun createEntityID (Ljava/lang/Object;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; } public abstract class org/jetbrains/exposed/dao/id/IdTable : org/jetbrains/exposed/sql/Table { @@ -1084,7 +1084,7 @@ public abstract interface class org/jetbrains/exposed/sql/IDateColumnType { public abstract interface class org/jetbrains/exposed/sql/ISqlExpressionBuilder { public abstract fun asLiteral (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/LiteralOp; - public abstract fun between (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Between; + public abstract fun between (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public abstract fun between (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public abstract fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/AndBitOp; public abstract fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/AndBitOp; @@ -1103,9 +1103,9 @@ public abstract interface class org/jetbrains/exposed/sql/ISqlExpressionBuilder public abstract fun eq (Lorg/jetbrains/exposed/sql/CompositeColumn;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public abstract fun eq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public abstract fun eq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public abstract fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public abstract fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public abstract fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public abstract fun eqEntityIDValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public abstract fun eqSubQuery (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/EqSubQueryOp; public abstract fun firstValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/FirstValue; public abstract fun greater (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/GreaterOp; @@ -1134,12 +1134,12 @@ public abstract interface class org/jetbrains/exposed/sql/ISqlExpressionBuilder public abstract fun isDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public abstract fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public abstract fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; - public abstract fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; + public abstract fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public abstract fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public abstract fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public abstract fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public abstract fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; - public abstract fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; + public abstract fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public abstract fun isNotNull (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public abstract fun isNull (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public abstract fun isNullOrEmpty (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; @@ -1173,9 +1173,9 @@ public abstract interface class org/jetbrains/exposed/sql/ISqlExpressionBuilder public abstract fun modWithEntityId3 (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/ExpressionWithColumnType; public abstract fun neq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public abstract fun neq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public abstract fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public abstract fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public abstract fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public abstract fun neqEntityIDValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public abstract fun notEqSubQuery (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/NotEqSubQueryOp; public abstract fun notInList (Ljava/util/List;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; public abstract fun notInList (Lkotlin/Pair;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; @@ -1216,7 +1216,7 @@ public abstract interface class org/jetbrains/exposed/sql/ISqlExpressionBuilder public final class org/jetbrains/exposed/sql/ISqlExpressionBuilder$DefaultImpls { public static fun asLiteral (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/LiteralOp; - public static fun between (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Between; + public static fun between (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public static fun between (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public static fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/AndBitOp; public static fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/AndBitOp; @@ -1237,9 +1237,9 @@ public final class org/jetbrains/exposed/sql/ISqlExpressionBuilder$DefaultImpls public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/CompositeColumn;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public static fun eq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public static fun eqEntityIDValue (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public static fun eqSubQuery (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/EqSubQueryOp; public static fun firstValue (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/FirstValue; public static fun greater (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/GreaterOp; @@ -1268,12 +1268,12 @@ public final class org/jetbrains/exposed/sql/ISqlExpressionBuilder$DefaultImpls public static fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public static fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public static fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; - public static fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; + public static fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public static fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public static fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public static fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public static fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; - public static fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; + public static fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public static fun isNotNull (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public static fun isNull (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public static fun isNullOrEmpty (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; @@ -1309,9 +1309,9 @@ public final class org/jetbrains/exposed/sql/ISqlExpressionBuilder$DefaultImpls public static fun modWithEntityId3 (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/ExpressionWithColumnType; public static fun neq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public static fun neq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public static fun neq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public static fun neq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public static fun neq (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public static fun neqEntityIDValue (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public static fun notEqSubQuery (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/NotEqSubQueryOp; public static fun notInList (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Ljava/util/List;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; public static fun notInList (Lorg/jetbrains/exposed/sql/ISqlExpressionBuilder;Lkotlin/Pair;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; @@ -2269,7 +2269,7 @@ public final class org/jetbrains/exposed/sql/SortOrder : java/lang/Enum { public final class org/jetbrains/exposed/sql/SqlExpressionBuilder : org/jetbrains/exposed/sql/ISqlExpressionBuilder { public static final field INSTANCE Lorg/jetbrains/exposed/sql/SqlExpressionBuilder; public fun asLiteral (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/LiteralOp; - public fun between (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Between; + public fun between (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public fun between (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Between; public fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/AndBitOp; public fun bitwiseAnd (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/AndBitOp; @@ -2288,9 +2288,9 @@ public final class org/jetbrains/exposed/sql/SqlExpressionBuilder : org/jetbrain public fun eq (Lorg/jetbrains/exposed/sql/CompositeColumn;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public fun eq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public fun eq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public fun eq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public fun eqEntityIDValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public fun eqSubQuery (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/EqSubQueryOp; public fun firstValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/FirstValue; public fun greater (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/GreaterOp; @@ -2319,12 +2319,12 @@ public final class org/jetbrains/exposed/sql/SqlExpressionBuilder : org/jetbrain public fun isDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public fun isDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; - public fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; + public fun isDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsDistinctFromOp; public fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public fun isNotDistinctFrom (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; - public fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; + public fun isNotDistinctFromEntityID (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/IsNotDistinctFromOp; public fun isNotNull (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public fun isNull (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public fun isNullOrEmpty (Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; @@ -2358,9 +2358,9 @@ public final class org/jetbrains/exposed/sql/SqlExpressionBuilder : org/jetbrain public fun modWithEntityId3 (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/ExpressionWithColumnType; public fun neq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; public fun neq (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;)Lorg/jetbrains/exposed/sql/Op; - public fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Comparable;)Lorg/jetbrains/exposed/sql/Op; public fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public fun neq (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Lorg/jetbrains/exposed/sql/Expression;)Lorg/jetbrains/exposed/sql/Op; + public fun neqEntityIDValue (Lorg/jetbrains/exposed/sql/ExpressionWithColumnType;Ljava/lang/Object;)Lorg/jetbrains/exposed/sql/Op; public fun notEqSubQuery (Lorg/jetbrains/exposed/sql/Expression;Lorg/jetbrains/exposed/sql/AbstractQuery;)Lorg/jetbrains/exposed/sql/NotEqSubQueryOp; public fun notInList (Ljava/util/List;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; public fun notInList (Lkotlin/Pair;Ljava/lang/Iterable;)Lorg/jetbrains/exposed/sql/ops/InListOrNotInListBaseOp; @@ -3413,8 +3413,8 @@ public abstract class org/jetbrains/exposed/sql/statements/UpdateBuilder : org/j public fun set (Lorg/jetbrains/exposed/sql/CompositeColumn;Ljava/lang/Object;)V protected final fun setHasBatchedValues (Z)V public final fun setWithEntityIdExpression (Lorg/jetbrains/exposed/sql/Column;Lorg/jetbrains/exposed/sql/Expression;)V - public final fun setWithEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)V - public final fun setWithNullableEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Comparable;)V + public final fun setWithEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)V + public final fun setWithNullableEntityIdValue (Lorg/jetbrains/exposed/sql/Column;Ljava/lang/Object;)V public fun update (Lorg/jetbrains/exposed/sql/Column;Lkotlin/jvm/functions/Function1;)V public fun update (Lorg/jetbrains/exposed/sql/Column;Lorg/jetbrains/exposed/sql/Expression;)V } diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/CompositeID.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/CompositeID.kt index 7aa2f56b1a..f7e81112d4 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/CompositeID.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/CompositeID.kt @@ -4,11 +4,11 @@ import org.jetbrains.exposed.sql.Column /** Class representing a mapping of each composite primary key column to its stored identity value. */ class CompositeID private constructor() : Comparable { - internal val values: MutableMap, Comparable<*>?> = HashMap() + internal val values: MutableMap, Any?> = HashMap() @Suppress("UNCHECKED_CAST") @JvmName("setWithEntityIdValue") - operator fun , ID : EntityID> set(column: Column, value: T) { + operator fun > set(column: Column, value: T) { require(values.isEmpty() || values.keys.first().table == column.table) { "CompositeID key columns must all come from the same IdTable ${values.keys.first().table.tableName}" } @@ -17,7 +17,7 @@ class CompositeID private constructor() : Comparable { @Suppress("UNCHECKED_CAST") @JvmName("setWithNullableEntityIdValue") - operator fun , ID : EntityID> set(column: Column, value: T?) { + operator fun > set(column: Column, value: T?) { require(column.columnType.nullable || value != null) { "Trying to set null to not nullable column $column" } @@ -25,7 +25,7 @@ class CompositeID private constructor() : Comparable { } @JvmName("setWithEntityID") - operator fun , ID : EntityID> set(column: Column, value: ID) { + operator fun > set(column: Column, value: ID) { require(values.isEmpty() || values.keys.first().table == column.table) { "CompositeID key columns must all come from the same IdTable ${values.keys.first().table.tableName}" } @@ -33,7 +33,7 @@ class CompositeID private constructor() : Comparable { } @Suppress("UNCHECKED_CAST") - operator fun > get(column: Column): T = values[column] as T + operator fun get(column: Column): T = values[column] as T operator fun contains(column: Column<*>): Boolean = values.contains(column) @@ -56,7 +56,10 @@ class CompositeID private constructor() : Comparable { values.entries.forEach { (column, idValue) -> if (!other.values.containsKey(column)) return -1 - compareValues(idValue, other.values[column]).let { + require(idValue is Comparable<*>) { "This stored identity value must implement Comparable" } + val otherValue = other.values[column] + require(otherValue is Comparable<*>) { "This stored identity value must implement Comparable" } + compareValues(idValue, otherValue).let { if (it != 0) return it } } diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/EntityID.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/EntityID.kt index 3cbceee5e6..49761a2e86 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/EntityID.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/EntityID.kt @@ -11,7 +11,7 @@ package org.jetbrains.exposed.dao.id * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTestsData.YTable * @sample org.jetbrains.exposed.sql.tests.shared.dml.InsertTests.testInsertWithPredefinedId */ -open class EntityID> protected constructor(val table: IdTable, id: T?) : Comparable> { +open class EntityID protected constructor(val table: IdTable, id: T?) : Comparable> { constructor(id: T, table: IdTable) : this(table, id) @Suppress("VariableNaming") @@ -42,5 +42,9 @@ open class EntityID> protected constructor(val table: IdTable< return other._value == _value && other.table == table } - override fun compareTo(other: EntityID): Int = value.compareTo(other.value) + override fun compareTo(other: EntityID): Int { + require(value is Comparable<*>) { "This stored identity value must implement Comparable" } + require(other.value is Comparable<*>) { "The other stored identity value must implement Comparable" } + return (value as Comparable).compareTo(other.value) + } } diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/IdTable.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/IdTable.kt index e6b359d907..84cb9cbdd9 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/IdTable.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/dao/id/IdTable.kt @@ -7,7 +7,7 @@ import java.util.* /** Base class representing a producer of [EntityID] instances. */ interface EntityIDFactory { /** Returns a new [EntityID] that holds a [value] of type [T], for the specified [table]. */ - fun > createEntityID(value: T, table: IdTable): EntityID + fun createEntityID(value: T, table: IdTable): EntityID } /** Class responsible for locating and providing the appropriate functions to produce [EntityID] instances. */ @@ -16,14 +16,14 @@ object EntityIDFunctionProvider { init { factory = ServiceLoader.load(EntityIDFactory::class.java, EntityIDFactory::class.java.classLoader).firstOrNull() ?: object : EntityIDFactory { - override fun > createEntityID(value: T, table: IdTable): EntityID { + override fun createEntityID(value: T, table: IdTable): EntityID { return EntityID(value, table) } } } /** Returns a new [EntityID] that holds a [value] of type [T], for the specified [table]. */ - fun > createEntityID(value: T, table: IdTable) = factory.createEntityID(value, table) + fun createEntityID(value: T, table: IdTable) = factory.createEntityID(value, table) } /** @@ -31,14 +31,14 @@ object EntityIDFunctionProvider { * * @param name Table name. By default, this will be resolved from any class name with a "Table" suffix removed (if present). */ -abstract class IdTable>(name: String = "") : Table(name) { +abstract class IdTable(name: String = "") : Table(name) { /** The identity column of this [IdTable], for storing values of type [T] wrapped as [EntityID] instances. */ abstract val id: Column> - private val _idColumns = HashSet>>() + private val _idColumns = HashSet>() /** All base columns that make up this [IdTable]'s identifier column. */ - val idColumns: Set>> + val idColumns: Set> get() = _idColumns.ifEmpty { val message = "Table definition must include id columns. Please use Column.entityId() or IdTable.addIdColumn()." exposedLogger.error(message) @@ -46,7 +46,7 @@ abstract class IdTable>(name: String = "") : Table(name) { } /** Adds a column to [idColumns] so that it can be used as a component of the [id] property. */ - protected fun > addIdColumn(newColumn: Column>) { + protected fun addIdColumn(newColumn: Column>) { if (_idColumns.isNotEmpty() && this !is CompositeIdTable) { val message = "CompositeIdTable should be used if multiple EntityID key columns are required" exposedLogger.error(message) @@ -55,7 +55,7 @@ abstract class IdTable>(name: String = "") : Table(name) { _idColumns.add(newColumn) } - internal fun > addIdColumnInternal(newColumn: Column>) { addIdColumn(newColumn) } + internal fun addIdColumnInternal(newColumn: Column>) { addIdColumn(newColumn) } } /** @@ -152,7 +152,7 @@ open class CompositeIdTable(name: String = "") : IdTable(name) { (toCompare as? EntityID) ?: error("toCompare must be an EntityID value") return idColumns.map { column -> val otherValue = if (column in toCompare.value.values) { - toCompare.value[column as Column>>] + toCompare.value[column as Column>] } else { error("Comparison CompositeID is missing a key mapping for ${column.name}") } diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Alias.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Alias.kt index d2bb185ba7..8be19c0305 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Alias.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Alias.kt @@ -80,7 +80,7 @@ class Alias(val delegate: T, val alias: String) : Table() { delegateIdColumns.map { column -> val delegateColumn = originalColumn(column) val otherValue = if (delegateColumn in toCompare.value.values) { - toCompare.value[delegateColumn as Column>>] + toCompare.value[delegateColumn as Column>] } else { error("Comparison CompositeID is missing a key mapping for ${delegateColumn?.name}") } diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ColumnType.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ColumnType.kt index d1ef2b826f..1635f98a9e 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ColumnType.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ColumnType.kt @@ -235,7 +235,7 @@ internal fun Column<*>.isEntityIdentifier(): Boolean { /** * Identity column type for storing unique [EntityID] values. */ -class EntityIDColumnType>( +class EntityIDColumnType( /** The underlying wrapped column storing the identity values. */ val idColumn: Column ) : ColumnType>() { diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Op.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Op.kt index 637344066e..acf0f7dd72 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Op.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Op.kt @@ -717,7 +717,7 @@ class QueryParameter( } /** Returns the specified [value] as a query parameter with the same type as [column]. */ -fun > idParam(value: EntityID, column: Column>): Expression> = +fun idParam(value: EntityID, column: Column>): Expression> = QueryParameter(value, column.columnType) /** Returns the specified [value] as a boolean query parameter. */ diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt index 847522f08a..23b1dbee66 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Queries.kt @@ -213,7 +213,7 @@ fun T.insert(body: T.(InsertStatement) -> Unit): InsertState * @return The generated ID for the new row. * @sample org.jetbrains.exposed.sql.tests.shared.dml.InsertTests.testGeneratedKey04 */ -fun , T : IdTable> T.insertAndGetId(body: T.(InsertStatement>) -> Unit): EntityID = +fun > T.insertAndGetId(body: T.(InsertStatement>) -> Unit): EntityID = InsertStatement>(this, false).run { body(this) execute(TransactionManager.current()) @@ -381,7 +381,7 @@ fun T.insertIgnore(body: T.(UpdateBuilder<*>) -> Unit): InsertStatem * @return The generated ID for the new row, or `null` if none was retrieved after statement execution. * @sample org.jetbrains.exposed.sql.tests.shared.dml.InsertTests.testInsertIgnoreAndGetId01 */ -fun , T : IdTable> T.insertIgnoreAndGetId(body: T.(UpdateBuilder<*>) -> Unit): EntityID? = +fun > T.insertIgnoreAndGetId(body: T.(UpdateBuilder<*>) -> Unit): EntityID? = InsertStatement>(this, isIgnore = true).run { body(this) when (execute(TransactionManager.current())) { diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ResultRow.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ResultRow.kt index 302084de9c..e2c38aca4c 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ResultRow.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/ResultRow.kt @@ -32,7 +32,7 @@ class ResultRow( column?.isEntityIdentifier() == true && column.table is CompositeIdTable -> { val resultID = CompositeID { column.table.idColumns.forEach { column -> - it[column as Column>>] = getInternal(column, checkNullability = true).value + it[column as Column>] = getInternal(column, checkNullability = true).value } } EntityID(resultID, column.table) as T diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SQLExpressionBuilder.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SQLExpressionBuilder.kt index 574f07dfa1..78f5c6c581 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SQLExpressionBuilder.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/SQLExpressionBuilder.kt @@ -332,7 +332,8 @@ interface ISqlExpressionBuilder { } /** Checks if this [EntityID] expression is equal to some [t] value. */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.eq(t: V): Op { + @JvmName("eqEntityIDValue") + infix fun ?, V : T?> ExpressionWithColumnType.eq(t: V): Op { if (t == null) return isNull() @Suppress("UNCHECKED_CAST") @@ -346,7 +347,7 @@ interface ISqlExpressionBuilder { } /** Checks if this [EntityID] expression is equal to some [other] expression. */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.eq( + infix fun ?, V : T?> ExpressionWithColumnType.eq( other: Expression ): Op = when (other as Expression<*>) { is Op.NULL -> isNull() @@ -354,7 +355,7 @@ interface ISqlExpressionBuilder { } /** Checks if this expression is equal to some [other] [EntityID] expression. */ - infix fun , V : T?, E : EntityID?> Expression.eq( + infix fun ?> Expression.eq( other: ExpressionWithColumnType ): Op = other eq this @@ -376,7 +377,8 @@ interface ISqlExpressionBuilder { } /** Checks if this [EntityID] expression is not equal to some [t] value. */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.neq(t: V): Op { + @JvmName("neqEntityIDValue") + infix fun ?, V : T?> ExpressionWithColumnType.neq(t: V): Op { if (t == null) return isNotNull() @Suppress("UNCHECKED_CAST") val table = (columnType as EntityIDColumnType<*>).idColumn.table as IdTable @@ -389,7 +391,7 @@ interface ISqlExpressionBuilder { } /** Checks if this [EntityID] expression is not equal to some [other] expression. */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.neq( + infix fun ?, V : T?> ExpressionWithColumnType.neq( other: Expression ): Op = when (other as Expression<*>) { is Op.NULL -> isNotNull() @@ -397,7 +399,7 @@ interface ISqlExpressionBuilder { } /** Checks if this expression is not equal to some [other] [EntityID] expression. */ - infix fun , V : T?, E : EntityID?> Expression.neq( + infix fun ?> Expression.neq( other: ExpressionWithColumnType ): Op = other neq this @@ -503,7 +505,7 @@ interface ISqlExpressionBuilder { fun ExpressionWithColumnType.between(from: T, to: T): Between = Between(this, wrap(from), wrap(to)) /** Returns `true` if this [EntityID] expression is between the values [from] and [to], `false` otherwise. */ - fun , E : EntityID?> Column.between(from: T, to: T): Between = + fun ?> Column.between(from: T, to: T): Between = Between(this, wrap(EntityID(from, this.idTable())), wrap(EntityID(to, this.idTable()))) /** Returns `true` if this expression is null, `false` otherwise. */ @@ -538,16 +540,16 @@ interface ISqlExpressionBuilder { /** Checks if this expression is equal to some [t] value, with `null` treated as a comparable value */ @JvmName("isNotDistinctFromEntityID") - infix fun > Column>.isNotDistinctFrom(t: T): IsNotDistinctFromOp = + infix fun Column>.isNotDistinctFrom(t: T): IsNotDistinctFromOp = IsNotDistinctFromOp(this, wrap(EntityID(t, this.idTable()))) /** Checks if this [EntityID] expression is equal to some [other] expression */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.isNotDistinctFrom( + infix fun ?, V : T?> ExpressionWithColumnType.isNotDistinctFrom( other: Expression ): IsNotDistinctFromOp = IsNotDistinctFromOp(this, other) /** Checks if this expression is equal to some [other] [EntityID] expression. */ - infix fun , V : T?, E : EntityID?> Expression.isNotDistinctFrom( + infix fun ?> Expression.isNotDistinctFrom( other: ExpressionWithColumnType ): IsNotDistinctFromOp = IsNotDistinctFromOp(this, other) @@ -560,16 +562,16 @@ interface ISqlExpressionBuilder { /** Checks if this expression is not equal to some [t] value, with `null` treated as a comparable value */ @JvmName("isDistinctFromEntityID") - infix fun > Column>.isDistinctFrom(t: T): IsDistinctFromOp = + infix fun Column>.isDistinctFrom(t: T): IsDistinctFromOp = IsDistinctFromOp(this, wrap(EntityID(t, this.idTable()))) /** Checks if this [EntityID] expression is not equal to some [other] expression */ - infix fun , E : EntityID?, V : T?> ExpressionWithColumnType.isDistinctFrom( + infix fun ?, V : T?> ExpressionWithColumnType.isDistinctFrom( other: Expression ): IsDistinctFromOp = IsDistinctFromOp(this, other) /** Checks if this expression is not equal to some [other] [EntityID] expression. */ - infix fun , V : T?, E : EntityID?> Expression.isDistinctFrom( + infix fun ?> Expression.isDistinctFrom( other: ExpressionWithColumnType ): IsDistinctFromOp = IsDistinctFromOp(this, other) @@ -923,7 +925,7 @@ interface ISqlExpressionBuilder { infix fun List>.inList(list: Iterable): InListOrNotInListBaseOp> { val componentList = list.map { id -> List(this.size) { i -> - val component = id[this[i] as Column>] + val component = id[this[i] as Column] component.takeIf { this[i].columnType is EntityIDColumnType<*> } ?: (component as EntityID<*>).value } } @@ -937,7 +939,7 @@ interface ISqlExpressionBuilder { */ @Suppress("UNCHECKED_CAST") @JvmName("inListIds") - infix fun , ID : EntityID?> Column.inList(list: Iterable): InListOrNotInListBaseOp?> { + infix fun ?> Column.inList(list: Iterable): InListOrNotInListBaseOp?> { val idTable = (columnType as EntityIDColumnType).idColumn.table as IdTable return SingleValueInListOp(this, list.map { EntityIDFunctionProvider.createEntityID(it, idTable) }, isInList = true) } @@ -1003,7 +1005,7 @@ interface ISqlExpressionBuilder { infix fun List>.notInList(list: Iterable): InListOrNotInListBaseOp> { val componentList = list.map { id -> List(this.size) { i -> - val component = id[this[i] as Column>] + val component = id[this[i] as Column] component.takeIf { this[i].columnType is EntityIDColumnType<*> } ?: (component as EntityID<*>).value } } @@ -1017,7 +1019,7 @@ interface ISqlExpressionBuilder { */ @Suppress("UNCHECKED_CAST") @JvmName("notInListIds") - infix fun , ID : EntityID?> Column.notInList(list: Iterable): InListOrNotInListBaseOp?> { + infix fun ?> Column.notInList(list: Iterable): InListOrNotInListBaseOp?> { val idTable = (columnType as EntityIDColumnType).idColumn.table as IdTable return SingleValueInListOp(this, list.map { EntityIDFunctionProvider.createEntityID(it, idTable) }, isInList = false) } @@ -1069,7 +1071,7 @@ interface ISqlExpressionBuilder { fun ExpressionWithColumnType.intToDecimal(): NoOpConversion = NoOpConversion(this, DecimalColumnType(precision = 15, scale = 0)) - private fun , E : EntityID> Column.idTable(): IdTable = + private fun > Column.idTable(): IdTable = when (val table = this.foreignKey?.targetTable ?: this.table) { is Alias<*> -> table.delegate else -> table diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt index c070bbfeab..ccbc70bb45 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Table.kt @@ -645,7 +645,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { /** Converts the @receiver column to an [EntityID] column. */ @Suppress("UNCHECKED_CAST") - fun > Column.entityId(): Column> { + fun Column.entityId(): Column> { val newColumn = Column>(table, name, EntityIDColumnType(this)).also { it.defaultValueFun = defaultValueFun?.let { { EntityIDFunctionProvider.createEntityID(it(), table as IdTable) } } it.dbDefaultValue = dbDefaultValue?.let { default -> default as Expression> } @@ -656,7 +656,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { } /** Creates an [EntityID] column, with the specified [name], for storing the same objects as the specified [originalColumn]. */ - fun > entityId(name: String, originalColumn: Column): Column> { + fun entityId(name: String, originalColumn: Column): Column> { val columnTypeCopy = originalColumn.columnType.cloneAsBaseType() val answer = Column>( this, @@ -669,7 +669,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { /** Creates an [EntityID] column, with the specified [name], for storing the identifier of the specified [table]. */ @Suppress("UNCHECKED_CAST") - fun > entityId(name: String, table: IdTable): Column> { + fun entityId(name: String, table: IdTable): Column> { val originalColumn = (table.id.columnType as EntityIDColumnType<*>).idColumn as Column return entityId(name, originalColumn) } @@ -978,7 +978,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { * * @param idSeqName an optional parameter to provide a sequence name */ - fun > Column>.autoinc(idSeqName: String? = null): Column> = + fun Column>.autoinc(idSeqName: String? = null): Column> = cloneWithAutoInc(idSeqName).also { replaceColumn(this, it) } /** Sets the default value for this column in the database side. */ @@ -1082,7 +1082,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { * @sample org.jetbrains.exposed.sql.tests.shared.ddl.CreateMissingTablesAndColumnsTests.ExplicitTable */ @JvmName("referencesById") - fun , S : T, C : Column> C.references( + fun > C.references( ref: Column>, onDelete: ReferenceOption? = null, onUpdate: ReferenceOption? = null, @@ -1143,7 +1143,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { */ @Suppress("UNCHECKED_CAST") @JvmName("referenceByIdColumn") - fun , E : EntityID> reference( + fun > reference( name: String, refColumn: Column, onDelete: ReferenceOption? = null, @@ -1168,7 +1168,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { * @param fkName Optional foreign key constraint name. * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Schools */ - fun > reference( + fun reference( name: String, foreign: IdTable, onDelete: ReferenceOption? = null, @@ -1215,7 +1215,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Posts */ @JvmName("optReferenceByIdColumn") - fun , E : EntityID> optReference( + fun > optReference( name: String, refColumn: Column, onDelete: ReferenceOption? = null, @@ -1236,7 +1236,7 @@ open class Table(name: String = "") : ColumnSet(), DdlAware { * @param fkName Optional foreign key constraint name. * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Schools */ - fun > optReference( + fun optReference( name: String, foreign: IdTable, onDelete: ReferenceOption? = null, diff --git a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/statements/UpdateBuilder.kt b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/statements/UpdateBuilder.kt index 15aefe71aa..e1960fdadc 100644 --- a/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/statements/UpdateBuilder.kt +++ b/exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/statements/UpdateBuilder.kt @@ -40,7 +40,7 @@ abstract class UpdateBuilder(type: StatementType, targets: List) : @Suppress("UNCHECKED_CAST") @JvmName("setWithEntityIdValue") - operator fun > set(column: Column>, value: S) { + operator fun set(column: Column>, value: S) { if (value is CompositeID) { value.setComponentValues() } else { @@ -52,7 +52,7 @@ abstract class UpdateBuilder(type: StatementType, targets: List
) : @Suppress("UNCHECKED_CAST") @JvmName("setWithNullableEntityIdValue") - operator fun > set(column: Column?>, value: S?) { + operator fun set(column: Column?>, value: S?) { require(column.columnType.nullable || value != null) { "Trying to set null to not nullable column $column" } diff --git a/exposed-dao/api/exposed-dao.api b/exposed-dao/api/exposed-dao.api index 65bc0bd4a0..3c1251c356 100644 --- a/exposed-dao/api/exposed-dao.api +++ b/exposed-dao/api/exposed-dao.api @@ -8,12 +8,12 @@ public abstract class org/jetbrains/exposed/dao/CompositeEntityClass : org/jetbr } public final class org/jetbrains/exposed/dao/DaoEntityID : org/jetbrains/exposed/dao/id/EntityID { - public fun (Ljava/lang/Comparable;Lorg/jetbrains/exposed/dao/id/IdTable;)V + public fun (Ljava/lang/Object;Lorg/jetbrains/exposed/dao/id/IdTable;)V } public final class org/jetbrains/exposed/dao/DaoEntityIDFactory : org/jetbrains/exposed/dao/id/EntityIDFactory { public fun ()V - public fun createEntityID (Ljava/lang/Comparable;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; + public fun createEntityID (Ljava/lang/Object;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/id/EntityID; } public class org/jetbrains/exposed/dao/Entity { @@ -123,14 +123,14 @@ public abstract class org/jetbrains/exposed/dao/EntityClass { protected fun createInstance (Lorg/jetbrains/exposed/dao/id/EntityID;Lorg/jetbrains/exposed/sql/ResultRow;)Lorg/jetbrains/exposed/dao/Entity; public final fun find (Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/sql/SizedIterable; public final fun find (Lorg/jetbrains/exposed/sql/Op;)Lorg/jetbrains/exposed/sql/SizedIterable; - public final fun findById (Ljava/lang/Comparable;)Lorg/jetbrains/exposed/dao/Entity; + public final fun findById (Ljava/lang/Object;)Lorg/jetbrains/exposed/dao/Entity; public fun findById (Lorg/jetbrains/exposed/dao/id/EntityID;)Lorg/jetbrains/exposed/dao/Entity; - public final fun findByIdAndUpdate (Ljava/lang/Comparable;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; + public final fun findByIdAndUpdate (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; public final fun findSingleByAndUpdate (Lorg/jetbrains/exposed/sql/Op;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; public final fun findWithCacheCondition (Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lkotlin/sequences/Sequence; public fun forEntityIds (Ljava/util/List;)Lorg/jetbrains/exposed/sql/SizedIterable; public final fun forIds (Ljava/util/List;)Lorg/jetbrains/exposed/sql/SizedIterable; - public final fun get (Ljava/lang/Comparable;)Lorg/jetbrains/exposed/dao/Entity; + public final fun get (Ljava/lang/Object;)Lorg/jetbrains/exposed/dao/Entity; public final fun get (Lorg/jetbrains/exposed/dao/id/EntityID;)Lorg/jetbrains/exposed/dao/Entity; public fun getDependsOnColumns ()Ljava/util/List; public fun getDependsOnTables ()Lorg/jetbrains/exposed/sql/ColumnSet; @@ -139,7 +139,7 @@ public abstract class org/jetbrains/exposed/dao/EntityClass { public final fun memoizedTransform (Lorg/jetbrains/exposed/dao/EntityFieldWithTransform;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/EntityFieldWithTransform; public final fun memoizedTransform (Lorg/jetbrains/exposed/sql/Column;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/EntityFieldWithTransform; public final fun memoizedTransform (Lorg/jetbrains/exposed/sql/Column;Lorg/jetbrains/exposed/sql/ColumnTransformer;)Lorg/jetbrains/exposed/dao/EntityFieldWithTransform; - public fun new (Ljava/lang/Comparable;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; + public fun new (Ljava/lang/Object;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; public fun new (Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/exposed/dao/Entity; public final fun optionalBackReferencedOn (Lorg/jetbrains/exposed/dao/EntityClass;Lorg/jetbrains/exposed/dao/id/IdTable;)Lorg/jetbrains/exposed/dao/OptionalBackReference; public final fun optionalBackReferencedOn (Lorg/jetbrains/exposed/dao/EntityClass;Lorg/jetbrains/exposed/sql/Column;)Lorg/jetbrains/exposed/dao/OptionalBackReference; diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityID.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityID.kt index 78f85dfe4c..6c77daaf66 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityID.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityID.kt @@ -8,7 +8,7 @@ import org.jetbrains.exposed.sql.transactions.TransactionManager * Class representing a wrapper for a stored identity value of type [T], which is managed and cached * by an [EntityClass] using a data access object pattern. */ -class DaoEntityID>(id: T?, table: IdTable) : EntityID(table, id) { +class DaoEntityID(id: T?, table: IdTable) : EntityID(table, id) { override fun invokeOnNoValue() { TransactionManager.current().entityCache.flushInserts(table) } diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityIDFactory.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityIDFactory.kt index 1b3c6ecb67..f468c36167 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityIDFactory.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/DaoEntityIDFactory.kt @@ -9,7 +9,7 @@ import org.jetbrains.exposed.dao.id.IdTable * [EntityClass] instances using a data access object pattern. */ class DaoEntityIDFactory : EntityIDFactory { - override fun > createEntityID(value: T, table: IdTable): EntityID { + override fun createEntityID(value: T, table: IdTable): EntityID { return DaoEntityID(value, table) } } diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/Entity.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/Entity.kt index 023a03a017..fa75c1da10 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/Entity.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/Entity.kt @@ -52,7 +52,7 @@ open class EntityFieldWithTransform( * * @param id The unique stored identity value for the mapped record. */ -open class Entity>(val id: EntityID) { +open class Entity(val id: EntityID) { /** The associated [EntityClass] that manages this [Entity] instance. */ var klass: EntityClass> by Delegates.notNull() internal set @@ -120,7 +120,7 @@ open class Entity>(val id: EntityID) { } @Suppress("UNCHECKED_CAST") - operator fun , RID : Comparable, T : Entity> Reference.getValue( + operator fun > Reference.getValue( o: Entity, desc: KProperty<*> ): T { @@ -154,7 +154,7 @@ open class Entity>(val id: EntityID) { reference.referee!!.getValue(this, desc) == refValue } else { allReferences.all { - it.value.getValue(this, desc) == (refValue as CompositeID)[it.key as Column>>] + it.value.getValue(this, desc) == (refValue as CompositeID)[it.key as Column>] } } }) { @@ -167,7 +167,7 @@ open class Entity>(val id: EntityID) { } } - operator fun , RID : Comparable, T : Entity> Reference.setValue( + operator fun > Reference.setValue( o: Entity, desc: KProperty<*>, value: T @@ -182,7 +182,7 @@ open class Entity>(val id: EntityID) { } @Suppress("UNCHECKED_CAST") - operator fun , RID : Comparable, T : Entity> OptionalReference.getValue( + operator fun > OptionalReference.getValue( o: Entity, desc: KProperty<*> ): T? { @@ -216,7 +216,7 @@ open class Entity>(val id: EntityID) { reference.referee!!.getValue(this, desc) == refValue } else { allReferences.all { - it.value.getValue(this, desc) == (refValue as CompositeID)[it.key as Column>>] + it.value.getValue(this, desc) == (refValue as CompositeID)[it.key as Column>] } } }) { @@ -230,7 +230,7 @@ open class Entity>(val id: EntityID) { } @Suppress("UNCHECKED_CAST") - operator fun , RID : Comparable, T : Entity> OptionalReference.setValue( + operator fun > OptionalReference.setValue( o: Entity, desc: KProperty<*>, value: T? @@ -324,7 +324,7 @@ open class Entity>(val id: EntityID) { * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.City * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.UsersToCities */ - infix fun , Target : Entity> EntityClass.via( + infix fun > EntityClass.via( table: Table ): InnerTableLink, TID, Target> = InnerTableLink(table, this@Entity.id.table, this@via) @@ -341,7 +341,7 @@ open class Entity>(val id: EntityID) { * @sample org.jetbrains.exposed.sql.tests.shared.entities.ViaTests.Node * @sample org.jetbrains.exposed.sql.tests.shared.entities.ViaTests.NodeToNodes */ - fun , Target : Entity> EntityClass.via( + fun > EntityClass.via( sourceColumn: Column>, targetColumn: Column> ) = InnerTableLink(sourceColumn.table, this@Entity.id.table, this@via, sourceColumn, targetColumn) @@ -433,7 +433,7 @@ open class Entity>(val id: EntityID) { internal fun writeIdColumnValue(table: IdTable<*>, value: EntityID<*>) { (value._value as? CompositeID)?.let { id -> table.idColumns.forEach { column -> - id[column as Column>>]?.let { + id[column as Column>]?.let { writeValues[column as Column] = it } } diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityCache.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityCache.kt index 9d8664f28c..087b4ce14f 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityCache.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityCache.kt @@ -87,7 +87,7 @@ class EntityCache(private val transaction: Transaction) { * * @return The entity that has this wrapped id value, or `null` if no entity was found. */ - fun , T : Entity> find(f: EntityClass, id: EntityID): T? = + fun > find(f: EntityClass, id: EntityID): T? = getMap(f)[id.value] as T? ?: inserts[f.table]?.firstOrNull { it.id == id } as? T ?: initializingEntities.firstOrNull { it.klass == f && it.id == id } as? T @@ -97,10 +97,10 @@ class EntityCache(private val transaction: Transaction) { * * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityCacheTests.testPerTransactionEntityCacheLimit */ - fun , T : Entity> findAll(f: EntityClass): Collection = getMap(f).values as Collection + fun > findAll(f: EntityClass): Collection = getMap(f).values as Collection /** Stores the specified [Entity] in this [EntityCache] using its associated [EntityClass] as the key. */ - fun , T : Entity> store(f: EntityClass, o: T) { + fun > store(f: EntityClass, o: T) { getMap(f)[o.id.value] = o } @@ -114,7 +114,7 @@ class EntityCache(private val transaction: Transaction) { } /** Removes the specified [Entity] from this [EntityCache] using its associated [table] as the key. */ - fun , T : Entity> remove(table: IdTable, o: T) { + fun > remove(table: IdTable, o: T) { getMap(table).remove(o.id.value) } @@ -132,12 +132,12 @@ class EntityCache(private val transaction: Transaction) { internal fun isEntityInInitializationState(entity: Entity<*>) = entity in initializingEntities /** Stores the specified [Entity] in this [EntityCache] as scheduled to be inserted into the database. */ - fun , T : Entity> scheduleInsert(f: EntityClass, o: T) { + fun > scheduleInsert(f: EntityClass, o: T) { inserts.getOrPut(f.table) { LinkedIdentityHashSet() }.add(o as Entity<*>) } /** Stores the specified [Entity] in this [EntityCache] as scheduled to be updated in the database. */ - fun , T : Entity> scheduleUpdate(f: EntityClass, o: T) { + fun > scheduleUpdate(f: EntityClass, o: T) { updates.getOrPut(f.table) { LinkedIdentityHashSet() }.add(o as Entity<*>) } diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityClass.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityClass.kt index 09f706707c..7f7a301114 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityClass.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityClass.kt @@ -27,7 +27,7 @@ import kotlin.sequences.Sequence * be used to determine the primary constructor of the associated entity class on first access (which can be slower). */ @Suppress("UNCHECKED_CAST", "UnnecessaryAbstractClass", "TooManyFunctions") -abstract class EntityClass, out T : Entity>( +abstract class EntityClass>( val table: IdTable, entityType: Class? = null, entityCtor: ((EntityID) -> T)? = null, @@ -420,7 +420,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Children * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Child */ - infix fun > referencedOn(column: Column) = registerRefRule(column) { Reference(column, this) } + infix fun referencedOn(column: Column) = registerRefRule(column) { Reference(column, this) } /** * Registers a reference as a field of the child entity class, which returns a parent object of this `EntityClass`. @@ -432,9 +432,9 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Authors * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Author */ - infix fun referencedOn(table: IdTable<*>): Reference, ID, T> { + infix fun referencedOn(table: IdTable<*>): Reference { val tableFK = getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { Reference(delegate, this, tableFK.references) } } @@ -449,7 +449,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Posts * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Post */ - infix fun > optionalReferencedOn(column: Column) = registerRefRule(column) { OptionalReference(column, this) } + infix fun optionalReferencedOn(column: Column) = registerRefRule(column) { OptionalReference(column, this) } /** * Registers an optional reference as a field of the child entity class, which returns a parent object of @@ -462,9 +462,9 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Offices * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Office */ - infix fun optionalReferencedOn(table: IdTable<*>): OptionalReference, ID, T> { + infix fun optionalReferencedOn(table: IdTable<*>): OptionalReference { val tableFK = getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column?> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { OptionalReference(delegate, this, tableFK.references) } } @@ -478,7 +478,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTestsData.XTable * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTestsData.BEntity */ - infix fun , Target : Entity, REF : Comparable> EntityClass.backReferencedOn( + infix fun , REF : Any> EntityClass.backReferencedOn( column: Column ): ReadOnlyProperty, Target> = registerRefRule(column) { BackReference(column, this) } @@ -493,7 +493,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTestsData.BEntity */ @JvmName("backReferencedOnOpt") - infix fun , Target : Entity, REF : Comparable> EntityClass.backReferencedOn( + infix fun , REF : Any> EntityClass.backReferencedOn( column: Column ): ReadOnlyProperty, Target> = registerRefRule(column) { BackReference(column, this) } @@ -508,11 +508,11 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Reviews * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Review */ - infix fun , Target : Entity> EntityClass.backReferencedOn( + infix fun > EntityClass.backReferencedOn( table: IdTable<*> ): ReadOnlyProperty, Target> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column?> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { BackReference(delegate, this, tableFK.references) } } @@ -527,7 +527,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.StudentBios * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.StudentBio */ - infix fun , Target : Entity, REF : Comparable> EntityClass.optionalBackReferencedOn( + infix fun , REF : Any> EntityClass.optionalBackReferencedOn( column: Column ) = registerRefRule(column) { OptionalBackReference, REF>(column as Column, this) } @@ -544,7 +544,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.StudentBio */ @JvmName("optionalBackReferencedOnOpt") - infix fun , Target : Entity, REF : Comparable> EntityClass.optionalBackReferencedOn( + infix fun , REF : Any> EntityClass.optionalBackReferencedOn( column: Column ) = registerRefRule(column) { OptionalBackReference, REF>(column, this) } @@ -560,11 +560,11 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Offices * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Office */ - infix fun , Target : Entity> EntityClass.optionalBackReferencedOn( + infix fun > EntityClass.optionalBackReferencedOn( table: IdTable<*> - ): OptionalBackReference, Comparable> { + ): OptionalBackReference, Any> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column?> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { OptionalBackReference(delegate, this, tableFK.references) } } @@ -580,7 +580,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.Cities * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.City */ - infix fun , Target : Entity, REF : Comparable> EntityClass.referrersOn(column: Column) = + infix fun , REF : Any> EntityClass.referrersOn(column: Column) = registerRefRule(column) { Referrers, TargetID, Target, REF>(column, this, true) } /** @@ -594,11 +594,11 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Authors * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Author */ - infix fun , Target : Entity> EntityClass.referrersOn( + infix fun > EntityClass.referrersOn( table: IdTable<*> - ): Referrers, TargetID, Target, Comparable> { + ): Referrers, TargetID, Target, Any> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { Referrers(delegate, this, true, tableFK.references) } } @@ -614,7 +614,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Students * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Student */ - fun , Target : Entity, REF : Comparable> EntityClass.referrersOn( + fun , REF : Any> EntityClass.referrersOn( column: Column, cache: Boolean ) = @@ -629,12 +629,12 @@ abstract class EntityClass, out T : Entity>( * * Set [cache] to `true` to also store the loaded entities to a cache. */ - fun , Target : Entity> EntityClass.referrersOn( + fun > EntityClass.referrersOn( table: IdTable<*>, cache: Boolean - ): Referrers, TargetID, Target, Comparable> { + ): Referrers, TargetID, Target, Any> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { Referrers(delegate, this, cache, tableFK.references) } } @@ -651,7 +651,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Posts * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Post */ - infix fun , Target : Entity, REF : Comparable> EntityClass.optionalReferrersOn( + infix fun , REF : Any> EntityClass.optionalReferrersOn( column: Column ) = registerRefRule(column) { OptionalReferrers, TargetID, Target, REF>(column, this, true) } @@ -669,11 +669,11 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Authors * @sample org.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Author */ - infix fun , Target : Entity> EntityClass.optionalReferrersOn( + infix fun > EntityClass.optionalReferrersOn( table: IdTable<*> - ): OptionalReferrers, TargetID, Target, Comparable> { + ): OptionalReferrers, TargetID, Target, Any> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column?> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { OptionalReferrers(delegate, this, true, tableFK.references) } } @@ -690,7 +690,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Detentions * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Detention */ - fun , Target : Entity, REF : Comparable> EntityClass.optionalReferrersOn( + fun , REF : Any> EntityClass.optionalReferrersOn( column: Column, cache: Boolean = false ) = @@ -705,12 +705,12 @@ abstract class EntityClass, out T : Entity>( * * Set [cache] to `true` to also store the loaded entities to a cache. */ - fun , Target : Entity> EntityClass.optionalReferrersOn( + fun > EntityClass.optionalReferrersOn( table: IdTable<*>, cache: Boolean = false - ): OptionalReferrers, TargetID, Target, Comparable> { + ): OptionalReferrers, TargetID, Target, Any> { val tableFK = this@EntityClass.getCompositeForeignKey(table) - val delegate = tableFK.from.first() as Column?> + val delegate = tableFK.from.first() as Column return registerRefRule(delegate) { OptionalReferrers(delegate, this, cache, tableFK.references) } } @@ -721,7 +721,7 @@ abstract class EntityClass, out T : Entity>( * @throws IllegalStateException If [table] does not have a defined composite foreign key that matches the * primary key defined on the table associated with this `EntityClass`. */ - private fun , Target : Entity> EntityClass.getCompositeForeignKey( + private fun > EntityClass.getCompositeForeignKey( table: IdTable<*> ): ForeignKeyConstraint = table.foreignKeys.firstOrNull { it.target == this.table.idColumns @@ -922,7 +922,7 @@ abstract class EntityClass, out T : Entity>( if (refColumn.columnType is EntityIDColumnType<*>) { refColumn as Column> distinctRefIds as List> - val toLoad = distinctRefIds.filter { + val toLoad: List> = distinctRefIds.filter { cache.referrers[refColumn]?.containsKey(it)?.not() ?: true } if (toLoad.isNotEmpty()) { @@ -1038,7 +1038,7 @@ abstract class EntityClass, out T : Entity>( } @Suppress("ComplexMethod") - internal fun > warmUpLinkedReferences( + internal fun warmUpLinkedReferences( references: List>, sourceRefColumn: Column>, targetRefColumn: Column>, @@ -1107,7 +1107,7 @@ abstract class EntityClass, out T : Entity>( * loading multiple times (per each reference row) and will require less memory/bandwidth for "heavy" entities * (with a lot of columns and/or columns that store large data sizes). */ - fun > warmUpLinkedReferences( + fun warmUpLinkedReferences( references: List>, linkTable: Table, forUpdate: Boolean? = null, @@ -1126,7 +1126,7 @@ abstract class EntityClass, out T : Entity>( /** * Returns whether the [entityClass] type is equivalent to or a superclass of this [EntityClass] instance's [klass]. */ - fun , T : Entity> isAssignableTo(entityClass: EntityClass) = entityClass.klass.isAssignableFrom(klass) + fun > isAssignableTo(entityClass: EntityClass) = entityClass.klass.isAssignableFrom(klass) } /** @@ -1142,7 +1142,7 @@ abstract class EntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.ImmutableEntityTest.Schema.Organization * @sample org.jetbrains.exposed.sql.tests.shared.entities.ImmutableEntityTest.EOrganization */ -abstract class ImmutableEntityClass, out T : Entity>( +abstract class ImmutableEntityClass>( table: IdTable, entityType: Class? = null, ctor: ((EntityID) -> T)? = null @@ -1183,7 +1183,7 @@ abstract class ImmutableEntityClass, out T : Entity>( * @sample org.jetbrains.exposed.sql.tests.shared.entities.ImmutableEntityTest.Schema.Organization * @sample org.jetbrains.exposed.sql.tests.shared.entities.ImmutableEntityTest.ECachedOrganization */ -abstract class ImmutableCachedEntityClass, out T : Entity>( +abstract class ImmutableCachedEntityClass>( table: IdTable, entityType: Class? = null, ctor: ((EntityID) -> T)? = null diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityHook.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityHook.kt index df0334a0a8..3d6634c56e 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityHook.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/EntityHook.kt @@ -4,7 +4,7 @@ import org.jetbrains.exposed.dao.id.EntityID import org.jetbrains.exposed.sql.Transaction import org.jetbrains.exposed.sql.transactions.TransactionManager import org.jetbrains.exposed.sql.transactions.transactionScope -import java.util.Deque +import java.util.* import java.util.concurrent.ConcurrentLinkedDeque import java.util.concurrent.ConcurrentLinkedQueue @@ -36,7 +36,7 @@ data class EntityChange( * Returns the actual [Entity] instance associated with [this][EntityChange] event, * or `null` if the entity is not found. */ -fun , T : Entity> EntityChange.toEntity(): T? = +fun > EntityChange.toEntity(): T? = (entityClass as EntityClass).findById(entityId as EntityID) /** @@ -44,7 +44,7 @@ fun , T : Entity> EntityChange.toEntity(): T? = * or `null` if either its [EntityClass] type is neither equivalent to nor a subclass of [klass], * or if the entity is not found. */ -fun , T : Entity> EntityChange.toEntity(klass: EntityClass): T? { +fun > EntityChange.toEntity(klass: EntityClass): T? { if (!entityClass.isAssignableTo(klass)) return null return toEntity() } diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/InnerTableLink.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/InnerTableLink.kt index ef8793799f..2581785182 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/InnerTableLink.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/InnerTableLink.kt @@ -22,7 +22,7 @@ import kotlin.reflect.KProperty * this will be inferred from the provided intermediate [table] columns. */ @Suppress("UNCHECKED_CAST") -class InnerTableLink, Source : Entity, ID : Comparable, Target : Entity>( +class InnerTableLink, ID : Any, Target : Entity>( val table: Table, sourceTable: IdTable, val target: EntityClass, diff --git a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/References.kt b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/References.kt index 36805d1549..dbffbb06ab 100644 --- a/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/References.kt +++ b/exposed-dao/src/main/kotlin/org/jetbrains/exposed/dao/References.kt @@ -31,7 +31,7 @@ private fun checkReference(reference: Column<*>, factoryTable: IdTable<*>): Map< * @param reference The reference column defined on the child entity's associated table. * @param factory The [EntityClass] associated with the parent entity referenced by the child entity. */ -class Reference, ID : Comparable, out Target : Entity>( +class Reference>( val reference: Column, val factory: EntityClass, references: Map, Column<*>>? = null @@ -46,7 +46,7 @@ class Reference, ID : Comparable, out Target : Entity< * @param reference The nullable reference column defined on the child entity's associated table. * @param factory The [EntityClass] associated with the parent entity optionally referenced by the child entity. */ -class OptionalReference, ID : Comparable, out Target : Entity>( +class OptionalReference>( val reference: Column, val factory: EntityClass, references: Map, Column<*>>? = null @@ -61,7 +61,7 @@ class OptionalReference, ID : Comparable, out Target : * @param reference The reference column defined on the child entity's associated table. * @param factory The [EntityClass] associated with the child entity that references the parent entity. */ -internal class BackReference, out Parent : Entity, ChildID : Comparable, in Child : Entity, REF>( +internal class BackReference, ChildID : Any, in Child : Entity, REF>( reference: Column, factory: EntityClass, references: Map, Column<*>>? = null @@ -79,7 +79,7 @@ internal class BackReference, out Parent : Entit * @param reference The nullable reference column defined on the child entity's associated table. * @param factory The [EntityClass] associated with the child entity that optionally references the parent entity. */ -class OptionalBackReference, out Parent : Entity, ChildID : Comparable, in Child : Entity, REF>( +class OptionalBackReference, ChildID : Any, in Child : Entity, REF>( reference: Column, factory: EntityClass, references: Map, Column<*>>? = null @@ -98,7 +98,7 @@ class OptionalBackReference, out Parent : Entity * @param factory The [EntityClass] associated with the child entity that references the parent entity. * @param cache Whether loaded reference entities should be stored in the [EntityCache]. */ -open class Referrers, in Parent : Entity, ChildID : Comparable, out Child : Entity, REF>( +open class Referrers, ChildID : Any, out Child : Entity, REF>( val reference: Column, val factory: EntityClass, val cache: Boolean, @@ -142,7 +142,7 @@ open class Referrers, in Parent : Entity - val parentValue = value[parent as Column>>].value + val parentValue = value[parent as Column>].value EqOp(child, child.wrap((parentValue as? DaoEntityID<*>)?.value ?: parentValue)) }.compoundAnd() } @@ -192,7 +192,7 @@ open class Referrers, in Parent : Entity, in Parent : Entity, ChildID : Comparable, out Child : Entity, REF>( +class OptionalReferrers, ChildID : Any, out Child : Entity, REF>( reference: Column, factory: EntityClass, cache: Boolean, @@ -213,7 +213,7 @@ private fun > filterRelationsForEntity( } @Suppress("UNCHECKED_CAST", "NestedBlockDepth", "ComplexMethod", "LongMethod") -private fun > List>.preloadRelations( +private fun List>.preloadRelations( vararg relations: KProperty1, Any?>, nodesVisited: MutableSet> = mutableSetOf() ) { @@ -268,14 +268,14 @@ private fun > List>.preloadRelations( directRelations.forEach { prop -> when (val refObject = getReferenceObjectFromDelegatedProperty(entity, prop)) { is Reference<*, *, *> -> { - (refObject as Reference>, *, Entity<*>>).allReferences.let { refColumns -> + (refObject as Reference<*, *, Entity<*>>).allReferences.let { refColumns -> val isSingleIdReference = hasSingleReferenceWithReferee(refColumns) val delegateRefColumn = refObject.reference this.map { entity -> entity.getReferenceId(delegateRefColumn, refColumns, isSingleIdReference) as ID }.takeIf { it.isNotEmpty() }?.let { refIds -> val condition = if (isSingleIdReference) { - val castReferee = (delegateRefColumn as Column).referee()!! + val castReferee = (delegateRefColumn as Column).referee()!! val baseReferee = castReferee.takeUnless { it.columnType is EntityIDColumnType<*> && refIds.first() !is EntityID<*> } ?: (castReferee.columnType as EntityIDColumnType).idColumn @@ -289,14 +289,14 @@ private fun > List>.preloadRelations( } } is OptionalReference<*, *, *> -> { - (refObject as OptionalReference>, *, Entity<*>>).allReferences.let { refColumns -> + (refObject as OptionalReference<*, *, Entity<*>>).allReferences.let { refColumns -> val isSingleIdReference = hasSingleReferenceWithReferee(refColumns) val delegateRefColumn = refObject.reference this.mapNotNull { entity -> entity.getReferenceId(delegateRefColumn, refColumns, isSingleIdReference) as? ID }.takeIf { it.isNotEmpty() }?.let { refIds -> val condition = if (isSingleIdReference) { - (delegateRefColumn as Column).referee()!! inList refIds.distinct() + (delegateRefColumn as Column).referee()!! inList refIds.distinct() } else { refColumns.values.toList() inList (refIds.distinct() as List) } @@ -320,7 +320,7 @@ private fun > List>.preloadRelations( } } is InnerTableLink<*, *, *, *> -> { - (refObject as InnerTableLink, Comparable>, Entity>>>).let { innerTableLink -> + (refObject as InnerTableLink, Any, Entity>).let { innerTableLink -> innerTableLink.target.warmUpLinkedReferences( references = this.map { it.id }, sourceRefColumn = innerTableLink.sourceColumn, @@ -391,7 +391,7 @@ private fun > List>.preloadRelations( * @param relations The reference fields of the entities, as [KProperty]s, which should be loaded. * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.preloadRelationAtDepth */ -fun , SRC : Entity, REF : Entity<*>, L : Iterable> L.with(vararg relations: KProperty1): L { +fun , REF : Entity<*>, L : Iterable> L.with(vararg relations: KProperty1): L { toList().apply { (this@with as? LazySizedIterable)?.loadedResult = this if (any { it.isNewEntity() }) { @@ -410,7 +410,7 @@ fun , SRC : Entity, REF : Entity<*>, L : Iterab * @param relations The reference fields of this entity, as [KProperty]s, which should be loaded. * @sample org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.preloadOptionalReferencesOnAnEntity */ -fun , SRC : Entity> SRC.load(vararg relations: KProperty1, Any?>): SRC = apply { +fun > SRC.load(vararg relations: KProperty1, Any?>): SRC = apply { listOf(this).with(*relations) } @@ -426,6 +426,6 @@ internal fun allReferencesMatch(allReferences: Map, Column<*>>, parent @Suppress("UNCHECKED_CAST") internal fun getCompositeID(entries: () -> List, *>>): CompositeID = CompositeID { entries().forEach { (key, value) -> - it[key as Column>>] = value as Comparable + it[key as Column>] = value as Any } } diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/ColumnWithTransformTest.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/ColumnWithTransformTest.kt index de5f24aa2d..0dc47a5242 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/ColumnWithTransformTest.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/dml/ColumnWithTransformTest.kt @@ -224,9 +224,7 @@ class ColumnWithTransformTest : DatabaseTestsBase() { } } - data class CustomId(val id: UUID) : Comparable { - override fun compareTo(other: CustomId): Int = id.compareTo(other.id) - } + private data class CustomId(val id: UUID) @Test fun testTransformIdColumn() { diff --git a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/entities/CompositeIdTableEntityTest.kt b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/entities/CompositeIdTableEntityTest.kt index c479dfc52b..285f88f390 100644 --- a/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/entities/CompositeIdTableEntityTest.kt +++ b/exposed-tests/src/test/kotlin/org/jetbrains/exposed/sql/tests/shared/entities/CompositeIdTableEntityTest.kt @@ -733,7 +733,7 @@ class CompositeIdTableEntityTest : DatabaseTestsBase() { return EntityID( CompositeID { referenceColumns.forEach { (child, parent) -> - it[parent as Column>>] = this.readValues[child] as Comparable + it[parent as Column>] = this.readValues[child] as Any } }, table