Skip to content

Commit

Permalink
simplify and strictify CompoundBooleanOp type: (JetBrains#1451)
Browse files Browse the repository at this point in the history
- get rid of self-bounded generics (and generics at all)
- make it sealed
  • Loading branch information
naftalmm authored Feb 19, 2022
1 parent c284396 commit 5dad809
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/Op.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ interface ComplexExpression
* @see AndOp
* @see OrOp
*/
abstract class CompoundBooleanOp<T : CompoundBooleanOp<T>>(
sealed class CompoundBooleanOp(
private val operator: String,
internal val expressions: List<Expression<Boolean>>
) : Op<Boolean>(), ComplexExpression, Op.OpBoolean {
Expand All @@ -80,12 +80,12 @@ abstract class CompoundBooleanOp<T : CompoundBooleanOp<T>>(
/**
* Represents a logical operator that performs an `and` operation between all the specified [expressions].
*/
class AndOp(expressions: List<Expression<Boolean>>) : CompoundBooleanOp<AndOp>(" AND ", expressions)
class AndOp(expressions: List<Expression<Boolean>>) : CompoundBooleanOp(" AND ", expressions)

/**
* Represents a logical operator that performs an `or` operation between all the specified [expressions].
*/
class OrOp(expressions: List<Expression<Boolean>>) : CompoundBooleanOp<AndOp>(" OR ", expressions)
class OrOp(expressions: List<Expression<Boolean>>) : CompoundBooleanOp(" OR ", expressions)

/** Returns the inverse of this boolean expression. */
fun not(op: Expression<Boolean>): Op<Boolean> = NotOp(op)
Expand Down

0 comments on commit 5dad809

Please sign in to comment.