From 08446e390ae5482b6ddf1af7c396b9e4411f684f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Jul 2026 10:49:33 +0000 Subject: [PATCH 1/5] Initial plan From 9a4dc1222d2978127caf3a27a5f95ef904a5af7d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 28 Jul 2026 11:03:51 +0000 Subject: [PATCH 2/5] Remove TraversePropertiesDsl from top-level toDataFrame {} operation - Remove TraversePropertiesDsl as supertype of CreateDataFrameDsl - Remove TraversePropertiesDsl delegation from CreateDataFrameDslImpl - Add deprecated exclude/preserve methods to CreateDataFrameDsl with deprecation warning pointing to properties {} block - Add deprecated preserve() extension for CreateDataFrameDsl - Update preserve T test to use properties {} block instead of top-level preserve() - Update generated sources and binary API file - Add TRAVERSE_PROPERTIES_DSL deprecation message constant --- core/api/core.api | 6 +++++- .../kotlinx/dataframe/api/toDataFrame.kt | 18 +++++++++++++++++- .../kotlinx/dataframe/impl/api/toDataFrame.kt | 3 +-- .../dataframe/util/deprecationMessages.kt | 4 ++++ .../kotlinx/dataframe/api/toDataFrame.kt | 5 +++-- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/core/api/core.api b/core/api/core.api index bb76090655..59644d8a84 100644 --- a/core/api/core.api +++ b/core/api/core.api @@ -1672,14 +1672,18 @@ public final class org/jetbrains/kotlinx/dataframe/api/CountKt { public static synthetic fun count$default (Lorg/jetbrains/kotlinx/dataframe/api/Grouped;Ljava/lang/String;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/DataFrame; } -public abstract class org/jetbrains/kotlinx/dataframe/api/CreateDataFrameDsl : org/jetbrains/kotlinx/dataframe/api/TraversePropertiesDsl { +public abstract class org/jetbrains/kotlinx/dataframe/api/CreateDataFrameDsl { public fun ()V public abstract fun add (Lorg/jetbrains/kotlinx/dataframe/columns/BaseColumn;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)V public static synthetic fun add$default (Lorg/jetbrains/kotlinx/dataframe/api/CreateDataFrameDsl;Lorg/jetbrains/kotlinx/dataframe/columns/BaseColumn;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;ILjava/lang/Object;)V + public final fun exclude ([Lkotlin/reflect/KCallable;)V + public final fun exclude ([Lkotlin/reflect/KClass;)V public abstract fun getSource ()Ljava/lang/Iterable; public final fun into (Lorg/jetbrains/kotlinx/dataframe/columns/BaseColumn;Ljava/lang/String;)V public final fun into (Lorg/jetbrains/kotlinx/dataframe/columns/BaseColumn;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)V public abstract fun invoke (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)V + public final fun preserve ([Lkotlin/reflect/KCallable;)V + public final fun preserve ([Lkotlin/reflect/KClass;)V public abstract fun properties ([Lkotlin/reflect/KCallable;ILkotlin/jvm/functions/Function1;)V public static synthetic fun properties$default (Lorg/jetbrains/kotlinx/dataframe/api/CreateDataFrameDsl;[Lkotlin/reflect/KCallable;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)V } diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt index f1d35d3b8f..879c0bb34f 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt @@ -17,6 +17,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columnName import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnGuessingType import org.jetbrains.kotlinx.dataframe.index import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API +import org.jetbrains.kotlinx.dataframe.util.TRAVERSE_PROPERTIES_DSL import kotlin.reflect.KCallable import kotlin.reflect.KClass import kotlin.reflect.KProperty @@ -188,7 +189,10 @@ public interface TraversePropertiesDsl { @Interpretable("PreserveT") public inline fun TraversePropertiesDsl.preserve(): Unit = preserve(T::class) -public abstract class CreateDataFrameDsl : TraversePropertiesDsl { +@Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) +public inline fun CreateDataFrameDsl<*>.preserve(): Unit = preserve(T::class) + +public abstract class CreateDataFrameDsl { public abstract val source: Iterable @@ -207,6 +211,18 @@ public abstract class CreateDataFrameDsl : TraversePropertiesDsl { body: (TraversePropertiesDsl.() -> Unit)? = null, ) + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) + public fun exclude(vararg classes: KClass<*>): Unit = properties { exclude(*classes) } + + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) + public fun exclude(vararg properties: KCallable<*>): Unit = this.properties { exclude(*properties) } + + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) + public fun preserve(vararg classes: KClass<*>): Unit = properties { preserve(*classes) } + + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) + public fun preserve(vararg properties: KCallable<*>): Unit = this.properties { preserve(*properties) } + public inline fun expr(infer: Infer = Infer.Nulls, noinline expression: (T) -> R): DataColumn = source.map { expression(it) }.toColumn(infer = infer) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt index ce77bfa619..1312af86a9 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/toDataFrame.kt @@ -111,8 +111,7 @@ internal class CreateDataFrameDslImpl( private val type: KType, private val prefix: ColumnPath = emptyPath(), private val configuration: TraverseConfiguration = TraverseConfiguration(), -) : CreateDataFrameDsl(), - TraversePropertiesDsl by configuration { +) : CreateDataFrameDsl() { internal val columns = mutableListOf>() diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt index fed730edcb..fd104a60ef 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt @@ -182,6 +182,10 @@ internal const val SUPPORTED_DATAFRAME_FORMAT: String = private const val MESSAGE_1_1 = "Will be ERROR in 1.1." +internal const val TRAVERSE_PROPERTIES_DSL = + "Top-level `exclude`/`preserve` calls in `toDataFrame {}` are removed. " + + "Use `properties { }` block to configure traversal instead. $MESSAGE_1_1" + internal const val APACHE_CSV = "The Apache-based CSV/TSV reader is deprecated in favor of the new Deephaven CSV reader in dataframe-csv. $MESSAGE_1_1" internal const val READ_CSV = diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt index 78e11eef64..31db34ef15 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt @@ -190,8 +190,9 @@ class CreateDataFrameTests { ) val res = data.toDataFrame { - preserve() - properties(maxDepth = 2) + properties(maxDepth = 2) { + preserve() + } } res.schema() shouldBe data.toDataFrame(maxDepth = 0).schema() From 367226c1302fe9e4af21f67e8da078302f79e1e8 Mon Sep 17 00:00:00 2001 From: Jolan Rensen Date: Wed, 29 Jul 2026 13:22:18 +0200 Subject: [PATCH 3/5] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../jetbrains/kotlinx/dataframe/util/deprecationMessages.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt index fd104a60ef..9b47c347f7 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt @@ -183,8 +183,8 @@ internal const val SUPPORTED_DATAFRAME_FORMAT: String = private const val MESSAGE_1_1 = "Will be ERROR in 1.1." internal const val TRAVERSE_PROPERTIES_DSL = - "Top-level `exclude`/`preserve` calls in `toDataFrame {}` are removed. " + - "Use `properties { }` block to configure traversal instead. $MESSAGE_1_1" + "Top-level `exclude`/`preserve` calls in `toDataFrame {}` are deprecated. " + + "Move them into each `properties { }` block to configure traversal instead. $MESSAGE_1_1" internal const val APACHE_CSV = "The Apache-based CSV/TSV reader is deprecated in favor of the new Deephaven CSV reader in dataframe-csv. $MESSAGE_1_1" From 8d70923cc9486536fdd5bb5d457166e9bce35092 Mon Sep 17 00:00:00 2001 From: Jolan Rensen Date: Fri, 31 Jul 2026 12:10:57 +0200 Subject: [PATCH 4/5] Added DslMarker for CreateDataFrameDsl and TraversePropertiesDsl to prevent incorrect DSL usage --- .../kotlinx/dataframe/api/toDataFrame.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt index 879c0bb34f..1242683157 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt @@ -154,6 +154,24 @@ public fun Iterable>>.toDataFrameFromPairs(): DataFr ColumnPath(it.first) to createColumnGuessingType(it.first, it.second.asList()) }.toDataFrameFromPairs() +/** + * [DslMarker] to prevent fucntions from [CreateDataFrameDsl] being used inside [TraversePropertiesDsl]. + * This prevents notations like: + * ```kt + * list.toDataFrame { + * "colA" from { ... } + * properties { + * preserve() + * "colB" from { ... } // ERROR, cannot be called in this context an implicit receiver. + * } + * } + * ``` + */ +@DslMarker +@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION) +public annotation class CreateDataFrameDslMarker + +@CreateDataFrameDslMarker public interface TraversePropertiesDsl { /** @@ -192,6 +210,7 @@ public inline fun TraversePropertiesDsl.preserve(): Unit = preserve( @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) public inline fun CreateDataFrameDsl<*>.preserve(): Unit = preserve(T::class) +@CreateDataFrameDslMarker public abstract class CreateDataFrameDsl { public abstract val source: Iterable From c8581a1206305af01db8975a423adeeb1f3d07d2 Mon Sep 17 00:00:00 2001 From: Jolan Rensen Date: Fri, 31 Jul 2026 12:19:30 +0200 Subject: [PATCH 5/5] migrated deprecated TraversePropertiesDsl functions in top-level toDataFrame {} directly to ERROR because their behavior is no longer possible --- .../kotlinx/dataframe/api/toDataFrame.kt | 20 +++++++++---------- .../dataframe/util/deprecationMessages.kt | 8 ++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt index 1242683157..8d49808c40 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt @@ -207,8 +207,8 @@ public interface TraversePropertiesDsl { @Interpretable("PreserveT") public inline fun TraversePropertiesDsl.preserve(): Unit = preserve(T::class) -@Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) -public inline fun CreateDataFrameDsl<*>.preserve(): Unit = preserve(T::class) +@Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.ERROR) +public inline fun CreateDataFrameDsl<*>.preserve(): Unit = Unit @CreateDataFrameDslMarker public abstract class CreateDataFrameDsl { @@ -230,17 +230,17 @@ public abstract class CreateDataFrameDsl { body: (TraversePropertiesDsl.() -> Unit)? = null, ) - @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) - public fun exclude(vararg classes: KClass<*>): Unit = properties { exclude(*classes) } + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.ERROR) + public fun exclude(vararg classes: KClass<*>): Unit = Unit - @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) - public fun exclude(vararg properties: KCallable<*>): Unit = this.properties { exclude(*properties) } + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.ERROR) + public fun exclude(vararg properties: KCallable<*>): Unit = Unit - @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) - public fun preserve(vararg classes: KClass<*>): Unit = properties { preserve(*classes) } + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.ERROR) + public fun preserve(vararg classes: KClass<*>): Unit = Unit - @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.WARNING) - public fun preserve(vararg properties: KCallable<*>): Unit = this.properties { preserve(*properties) } + @Deprecated(TRAVERSE_PROPERTIES_DSL, level = DeprecationLevel.ERROR) + public fun preserve(vararg properties: KCallable<*>): Unit = Unit public inline fun expr(infer: Infer = Infer.Nulls, noinline expression: (T) -> R): DataColumn = source.map { expression(it) }.toColumn(infer = infer) diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt index 9b47c347f7..a45e22034f 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt @@ -176,16 +176,16 @@ internal const val DATAROW_READ = internal const val SUPPORTED_DATAFRAME_FORMAT: String = "SupportedDataFrameFormat is deprecated. $MESSAGE_1_0" +internal const val TRAVERSE_PROPERTIES_DSL = + "Top-level `exclude`/`preserve` calls in `toDataFrame {}` are deprecated. " + + "Move them into each `properties { }` block to configure traversal instead. $MESSAGE_1_0" + // endregion // region WARNING in 1.0, ERROR in 1.1 private const val MESSAGE_1_1 = "Will be ERROR in 1.1." -internal const val TRAVERSE_PROPERTIES_DSL = - "Top-level `exclude`/`preserve` calls in `toDataFrame {}` are deprecated. " + - "Move them into each `properties { }` block to configure traversal instead. $MESSAGE_1_1" - internal const val APACHE_CSV = "The Apache-based CSV/TSV reader is deprecated in favor of the new Deephaven CSV reader in dataframe-csv. $MESSAGE_1_1" internal const val READ_CSV =