From 8788747da43d8a4864953f2e4090f6479542e449 Mon Sep 17 00:00:00 2001 From: Jeff Butler Date: Tue, 4 Nov 2025 13:04:49 -0500 Subject: [PATCH 1/4] Remove Kotlin Array-Based Functions The newer Kotlin compiler versions have difficulty distinguishing these methods from the similarly named vararg methods. I don't think they are in wide use - there were only a few tests that used them, and those tests were easily modified. --- .../util/kotlin/GroupingCriteriaCollector.kt | 30 +------------------ .../sql/util/kotlin/elements/SqlElements.kt | 28 ----------------- .../spring/canonical/InfixElementsTest.kt | 20 ++++++------- 3 files changed, 11 insertions(+), 67 deletions(-) diff --git a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt index be4ba72af..9a2070ea3 100644 --- a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt +++ b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt @@ -317,10 +317,6 @@ open class GroupingCriteriaCollector : SubCriteriaCollector() { fun BindableColumn.isIn(vararg values: T) = isIn(values.asList()) - @JvmName("isInArray") - infix fun BindableColumn.isIn(values: Array) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isIn(values)) - infix fun BindableColumn.isIn(values: Collection) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isIn(values)) @@ -329,19 +325,11 @@ open class GroupingCriteriaCollector : SubCriteriaCollector() { fun BindableColumn.isInWhenPresent(vararg values: T?) = isInWhenPresent(values.asList()) - @JvmName("isInArrayWhenPresent") - infix fun BindableColumn.isInWhenPresent(values: Array?) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInWhenPresent(values)) - infix fun BindableColumn.isInWhenPresent(values: Collection?) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInWhenPresent(values)) fun BindableColumn.isNotIn(vararg values: T) = isNotIn(values.asList()) - @JvmName("isNotInArray") - infix fun BindableColumn.isNotIn(values: Array) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotIn(values)) - infix fun BindableColumn.isNotIn(values: Collection) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotIn(values)) @@ -352,7 +340,7 @@ open class GroupingCriteriaCollector : SubCriteriaCollector() { @JvmName("isNotInArrayWhenPresent") infix fun BindableColumn.isNotInWhenPresent(values: Array?) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInWhenPresent(values)) + invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInWhenPresent(values?.asList())) infix fun BindableColumn.isNotInWhenPresent(values: Collection?) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInWhenPresent(values)) @@ -410,40 +398,24 @@ open class GroupingCriteriaCollector : SubCriteriaCollector() { fun BindableColumn.isInCaseInsensitive(vararg values: String) = isInCaseInsensitive(values.asList()) - @JvmName("isInArrayCaseInsensitive") - infix fun BindableColumn.isInCaseInsensitive(values: Array) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInCaseInsensitive(values)) - infix fun BindableColumn.isInCaseInsensitive(values: Collection) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInCaseInsensitive(values)) fun BindableColumn.isInCaseInsensitiveWhenPresent(vararg values: String?) = isInCaseInsensitiveWhenPresent(values.asList()) - @JvmName("isInArrayCaseInsensitiveWhenPresent") - infix fun BindableColumn.isInCaseInsensitiveWhenPresent(values: Array?) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInCaseInsensitiveWhenPresent(values)) - infix fun BindableColumn.isInCaseInsensitiveWhenPresent(values: Collection?) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isInCaseInsensitiveWhenPresent(values)) fun BindableColumn.isNotInCaseInsensitive(vararg values: String) = isNotInCaseInsensitive(values.asList()) - @JvmName("isNotInArrayCaseInsensitive") - infix fun BindableColumn.isNotInCaseInsensitive(values: Array) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInCaseInsensitive(values)) - infix fun BindableColumn.isNotInCaseInsensitive(values: Collection) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInCaseInsensitive(values)) fun BindableColumn.isNotInCaseInsensitiveWhenPresent(vararg values: String?) = isNotInCaseInsensitiveWhenPresent(values.asList()) - @JvmName("isNotInArrayCaseInsensitiveWhenPresent") - infix fun BindableColumn.isNotInCaseInsensitiveWhenPresent(values: Array?) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInCaseInsensitiveWhenPresent(values)) - infix fun BindableColumn.isNotInCaseInsensitiveWhenPresent(values: Collection?) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInCaseInsensitiveWhenPresent(values)) diff --git a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt index 2002fc75a..1fe9cfb38 100644 --- a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt +++ b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/elements/SqlElements.kt @@ -286,9 +286,6 @@ fun isLessThanOrEqualToWhenPresent(value: T?): IsLessThanOrEqualToWhen fun isIn(vararg values: T): IsIn = isIn(values.asList()) -@JvmName("isInArray") -fun isIn(values: Array): IsIn = SqlBuilder.isIn(values.asList()) - fun isIn(values: Collection): IsIn = SqlBuilder.isIn(values) fun isIn(subQuery: KotlinSubQueryBuilder.() -> Unit): IsInWithSubselect = @@ -296,16 +293,10 @@ fun isIn(subQuery: KotlinSubQueryBuilder.() -> Unit): IsInWithSubselec fun isInWhenPresent(vararg values: T?): IsInWhenPresent = isInWhenPresent(values.asList()) -@JvmName("isInArrayWhenPresent") -fun isInWhenPresent(values: Array?): IsInWhenPresent = SqlBuilder.isInWhenPresent(values?.asList()) - fun isInWhenPresent(values: Collection?): IsInWhenPresent = SqlBuilder.isInWhenPresent(values) fun isNotIn(vararg values: T): IsNotIn = isNotIn(values.asList()) -@JvmName("isNotInArray") -fun isNotIn(values: Array): IsNotIn = SqlBuilder.isNotIn(values.asList()) - fun isNotIn(values: Collection): IsNotIn = SqlBuilder.isNotIn(values) fun isNotIn(subQuery: KotlinSubQueryBuilder.() -> Unit): IsNotInWithSubselect = @@ -313,9 +304,6 @@ fun isNotIn(subQuery: KotlinSubQueryBuilder.() -> Unit): IsNotInWithSu fun isNotInWhenPresent(vararg values: T?): IsNotInWhenPresent = isNotInWhenPresent(values.asList()) -@JvmName("isNotInArrayWhenPresent") -fun isNotInWhenPresent(values: Array?): IsNotInWhenPresent = SqlBuilder.isNotInWhenPresent(values?.asList()) - fun isNotInWhenPresent(values: Collection?): IsNotInWhenPresent = SqlBuilder.isNotInWhenPresent(values) fun isBetween(value1: T): BetweenBuilder = BetweenBuilder(value1) @@ -354,40 +342,24 @@ fun isNotLikeCaseInsensitiveWhenPresent(value: String?): IsNotLikeCaseInsensitiv fun isInCaseInsensitive(vararg values: String): IsInCaseInsensitive = isInCaseInsensitive(values.asList()) -@JvmName("isInArrayCaseInsensitive") -fun isInCaseInsensitive(values: Array): IsInCaseInsensitive = - SqlBuilder.isInCaseInsensitive(values.asList()) - fun isInCaseInsensitive(values: Collection): IsInCaseInsensitive = SqlBuilder.isInCaseInsensitive(values) fun isInCaseInsensitiveWhenPresent(vararg values: String?): IsInCaseInsensitiveWhenPresent = isInCaseInsensitiveWhenPresent(values.asList()) -@JvmName("isInArrayCaseInsensitiveWhenPresent") -fun isInCaseInsensitiveWhenPresent(values: Array?): IsInCaseInsensitiveWhenPresent = - SqlBuilder.isInCaseInsensitiveWhenPresent(values?.asList()) - fun isInCaseInsensitiveWhenPresent(values: Collection?): IsInCaseInsensitiveWhenPresent = SqlBuilder.isInCaseInsensitiveWhenPresent(values) fun isNotInCaseInsensitive(vararg values: String): IsNotInCaseInsensitive = isNotInCaseInsensitive(values.asList()) -@JvmName("isNotInArrayCaseInsensitive") -fun isNotInCaseInsensitive(values: Array): IsNotInCaseInsensitive = - SqlBuilder.isNotInCaseInsensitive(values.asList()) - fun isNotInCaseInsensitive(values: Collection): IsNotInCaseInsensitive = SqlBuilder.isNotInCaseInsensitive(values) fun isNotInCaseInsensitiveWhenPresent(vararg values: String?): IsNotInCaseInsensitiveWhenPresent = isNotInCaseInsensitiveWhenPresent(values.asList()) -@JvmName("isNotInArrayCaseInsensitiveWhenPresent") -fun isNotInCaseInsensitiveWhenPresent(values: Array?): IsNotInCaseInsensitiveWhenPresent = - SqlBuilder.isNotInCaseInsensitiveWhenPresent(values?.asList()) - fun isNotInCaseInsensitiveWhenPresent(values: Collection?): IsNotInCaseInsensitiveWhenPresent = SqlBuilder.isNotInCaseInsensitiveWhenPresent(values) diff --git a/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt b/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt index b1b9791f2..b6968648b 100644 --- a/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt +++ b/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt @@ -1270,7 +1270,7 @@ open class InfixElementsTest { fun search(vararg names: String) { val selectStatement = select(firstName) { from(person) - where { firstName isIn names } + where { firstName isIn names.asList() } orderBy(id) } @@ -1291,7 +1291,7 @@ open class InfixElementsTest { fun search(vararg names: String?) { val selectStatement = select(firstName) { from(person) - where { firstName isInWhenPresent names } + where { firstName isInWhenPresent names.asList() } orderBy(id) } @@ -1313,7 +1313,7 @@ open class InfixElementsTest { from(person) where { id isLessThan 10 - and { firstName isInWhenPresent null as Array? } + and { firstName isInWhenPresent null as List? } } orderBy(id) } @@ -1332,7 +1332,7 @@ open class InfixElementsTest { fun search(vararg names: String) { val selectStatement = select(firstName) { from(person) - where { firstName isNotIn names } + where { firstName isNotIn names.asList() } orderBy(id) } @@ -1394,7 +1394,7 @@ open class InfixElementsTest { fun search(vararg names: String) { val selectStatement = select(firstName) { from(person) - where { firstName isInCaseInsensitive names } + where { firstName isInCaseInsensitive names.asList() } orderBy(id) } @@ -1415,7 +1415,7 @@ open class InfixElementsTest { fun search(vararg names: String?) { val selectStatement = select(firstName) { from(person) - where { firstName isInCaseInsensitiveWhenPresent names } + where { firstName isInCaseInsensitiveWhenPresent names.asList() } orderBy(id) } @@ -1437,7 +1437,7 @@ open class InfixElementsTest { from(person) where { id isLessThan 10 - and { firstName isInCaseInsensitiveWhenPresent null as Array? } + and { firstName isInCaseInsensitiveWhenPresent null as List? } } orderBy(id) } @@ -1456,7 +1456,7 @@ open class InfixElementsTest { fun search(vararg names: String) { val selectStatement = select(firstName) { from(person) - where { firstName isNotInCaseInsensitive names } + where { firstName isNotInCaseInsensitive names.asList() } orderBy(id) } @@ -1477,7 +1477,7 @@ open class InfixElementsTest { fun search(vararg names: String?) { val selectStatement = select(firstName) { from(person) - where { firstName isNotInCaseInsensitiveWhenPresent names } + where { firstName isNotInCaseInsensitiveWhenPresent names.asList() } orderBy(id) } @@ -1499,7 +1499,7 @@ open class InfixElementsTest { from(person) where { id isLessThan 10 - and { firstName isNotInCaseInsensitiveWhenPresent null as Array? } + and { firstName isNotInCaseInsensitiveWhenPresent null as List? } } orderBy(id) } From 9612b18313922c10ba2508ec41088ef5d704c405 Mon Sep 17 00:00:00 2001 From: Jeff Butler Date: Tue, 4 Nov 2025 13:15:27 -0500 Subject: [PATCH 2/4] Disable OpenTelemetry in the MySQL Container The newer Kotlin compiler versions contain a stripped-down implementation of OpenTelemetry that conflicts with the MySQL connector's expectations of what's available. Since this is just for testing, we don't need any OpenTelemetry support, so just turn it off. --- src/test/java/examples/mysql/MySQLTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/test/java/examples/mysql/MySQLTest.java b/src/test/java/examples/mysql/MySQLTest.java index f1eb82682..e9fec57db 100644 --- a/src/test/java/examples/mysql/MySQLTest.java +++ b/src/test/java/examples/mysql/MySQLTest.java @@ -48,6 +48,7 @@ class MySQLTest { @Container private static final MySQLContainer mysql = new MySQLContainer(TestContainersConfiguration.MYSQL_LATEST) + .withUrlParam("openTelemetry", "DISABLED") .withInitScript("examples/mariadb/CreateDB.sql"); private SqlSessionFactory sqlSessionFactory; From b22ef5abafbe23f0e057d15a305c9589230d605c Mon Sep 17 00:00:00 2001 From: Jeff Butler Date: Tue, 4 Nov 2025 13:15:53 -0500 Subject: [PATCH 3/4] Update Kotlin Complier version --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c182f9ed2..646e33fb4 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ org.mybatis.dynamic.sql - 2.1.21 + 2.2.21 17 2.0 2.0 @@ -95,7 +95,7 @@ org.jetbrains.kotlin - kotlin-stdlib-jdk8 + kotlin-stdlib ${kotlin.version} provided true From 176ebf212e63e40bdcc2470642f473b012ad1423 Mon Sep 17 00:00:00 2001 From: Jeff Butler Date: Tue, 4 Nov 2025 13:25:36 -0500 Subject: [PATCH 4/4] Remove another array-based function --- .../dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt | 4 ---- .../examples/kotlin/spring/canonical/InfixElementsTest.kt | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt index 9a2070ea3..a83530154 100644 --- a/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt +++ b/src/main/kotlin/org/mybatis/dynamic/sql/util/kotlin/GroupingCriteriaCollector.kt @@ -338,10 +338,6 @@ open class GroupingCriteriaCollector : SubCriteriaCollector() { fun BindableColumn.isNotInWhenPresent(vararg values: T?) = isNotInWhenPresent(values.asList()) - @JvmName("isNotInArrayWhenPresent") - infix fun BindableColumn.isNotInWhenPresent(values: Array?) = - invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInWhenPresent(values?.asList())) - infix fun BindableColumn.isNotInWhenPresent(values: Collection?) = invoke(org.mybatis.dynamic.sql.util.kotlin.elements.isNotInWhenPresent(values)) diff --git a/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt b/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt index b6968648b..cd3df1943 100644 --- a/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt +++ b/src/test/kotlin/examples/kotlin/spring/canonical/InfixElementsTest.kt @@ -1353,7 +1353,7 @@ open class InfixElementsTest { fun search(vararg names: String?) { val selectStatement = select(firstName) { from(person) - where { firstName isNotInWhenPresent names } + where { firstName isNotInWhenPresent names.asList() } orderBy(id) } @@ -1375,7 +1375,7 @@ open class InfixElementsTest { from(person) where { id isLessThan 10 - and { firstName isNotInWhenPresent null as Array? } + and { firstName isNotInWhenPresent null as List? } } orderBy(id) }