Skip to content

Commit d44c974

Browse files
Merge branch 'master' into rename_kdocs
2 parents bc26eaf + 7951e04 commit d44c974

File tree

58 files changed

+1766
-329
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+1766
-329
lines changed

build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,13 @@ allprojects {
189189
options.release.set(8)
190190
}
191191
}
192+
tasks.withType<KotlinCompile> {
193+
compilerOptions {
194+
// enables support for kotlin.time.Instant as kotlinx.datetime.Instant was deprecated; Issue #1350
195+
// Can be removed once kotlin.time.Instant is marked "stable".
196+
optIn.add("kotlin.time.ExperimentalTime")
197+
}
198+
}
192199

193200
// Attempts to configure ktlint for each sub-project that uses the plugin
194201
afterEvaluate {

core/api/core.api

Lines changed: 37 additions & 12 deletions
Large diffs are not rendered by default.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import org.jetbrains.kotlinx.dataframe.impl.columnName
1010
import org.jetbrains.kotlinx.dataframe.impl.owner
1111
import org.jetbrains.kotlinx.dataframe.impl.toIterable
1212
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
13+
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_DATA_ROW_COLUMN_REFERENCE_GET
1314
import kotlin.reflect.KProperty
1415

1516
/**
@@ -29,7 +30,7 @@ public interface DataRow<out T> {
2930

3031
public operator fun <R> get(expression: RowExpression<T, R>): R = expression(this, this)
3132

32-
@Deprecated(DEPRECATED_ACCESS_API)
33+
@Deprecated(DEPRECATED_DATA_ROW_COLUMN_REFERENCE_GET)
3334
@AccessApiOverload
3435
public operator fun <R> get(column: ColumnReference<R>): R
3536

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt

Lines changed: 329 additions & 39 deletions
Large diffs are not rendered by default.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/parse.kt

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ public interface GlobalParserOptions {
8585
* In notebooks, add `-opt-in=kotlin.uuid.ExperimentalUuidApi` to the compiler arguments.
8686
*/
8787
public var parseExperimentalUuid: Boolean
88+
89+
/**
90+
* Whether to allow parsing to the experimental [kotlin.time.Instant] type.
91+
* By default, this is false and instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
92+
*
93+
* NOTE: Interacting with an [Instant][kotlin.time.Instant] in your code might require
94+
* `@`[OptIn][OptIn]`(`[ExperimentalTime][kotlin.time.ExperimentalTime]`::class)`.
95+
* In notebooks, add `-opt-in=kotlin.time.ExperimentalTime` to the compiler arguments.
96+
*/
97+
public var parseExperimentalInstant: Boolean
8898
}
8999

90100
/**
@@ -118,6 +128,11 @@ public interface GlobalParserOptions {
118128
* NOTE: Interacting with a [Uuid][Uuid] in your code might require
119129
* `@`[OptIn][OptIn]`(`[ExperimentalUuidApi][ExperimentalUuidApi]`::class)`.
120130
* In notebooks, add `-opt-in=kotlin.uuid.ExperimentalUuidApi` to the compiler arguments.
131+
* @param parseExperimentalInstant whether to allow parsing to the experimental [kotlin.time.Instant] type.
132+
* By default, this is false and instants are recognized as the deprecated [kotlinx.datetime.Instant] type (#1350).
133+
* NOTE: Interacting with an [Instant][kotlin.time.Instant] in your code might require
134+
* `@`[OptIn][OptIn]`(`[ExperimentalTime][kotlin.time.ExperimentalTime]`::class)`.
135+
* In notebooks, add `-opt-in=kotlin.time.ExperimentalTime` to the compiler arguments.
121136
*/
122137
public class ParserOptions(
123138
public val locale: Locale? = null,
@@ -128,6 +143,7 @@ public class ParserOptions(
128143
public val skipTypes: Set<KType>? = null,
129144
public val useFastDoubleParser: Boolean? = null,
130145
public val parseExperimentalUuid: Boolean? = null,
146+
public val parseExperimentalInstant: Boolean? = null,
131147
) {
132148

133149
/** For binary compatibility. */
@@ -150,6 +166,7 @@ public class ParserOptions(
150166
skipTypes = skipTypes,
151167
useFastDoubleParser = useFastDoubleParser,
152168
parseExperimentalUuid = null,
169+
parseExperimentalInstant = null,
153170
)
154171

155172
/** For binary compatibility. */
@@ -170,6 +187,7 @@ public class ParserOptions(
170187
skipTypes = null,
171188
useFastDoubleParser = null,
172189
parseExperimentalUuid = null,
190+
parseExperimentalInstant = null,
173191
)
174192

175193
/** For binary compatibility. */
@@ -193,6 +211,7 @@ public class ParserOptions(
193211
skipTypes = skipTypes,
194212
useFastDoubleParser = useFastDoubleParser,
195213
parseExperimentalUuid = null,
214+
parseExperimentalInstant = null,
196215
)
197216

198217
/** For binary compatibility. */
@@ -214,6 +233,7 @@ public class ParserOptions(
214233
skipTypes = skipTypes,
215234
useFastDoubleParser = useFastDoubleParser,
216235
parseExperimentalUuid = null,
236+
parseExperimentalInstant = null,
217237
)
218238

219239
internal fun getDateTimeFormatter(): DateTimeFormatter? =
@@ -232,6 +252,7 @@ public class ParserOptions(
232252
skipTypes: Set<KType>? = this.skipTypes,
233253
useFastDoubleParser: Boolean? = this.useFastDoubleParser,
234254
parseExperimentalUuid: Boolean? = this.parseExperimentalUuid,
255+
parseExperimentalInstant: Boolean? = this.parseExperimentalInstant,
235256
): ParserOptions =
236257
ParserOptions(
237258
locale = locale,
@@ -241,6 +262,7 @@ public class ParserOptions(
241262
skipTypes = skipTypes,
242263
useFastDoubleParser = useFastDoubleParser,
243264
parseExperimentalUuid = parseExperimentalUuid,
265+
parseExperimentalInstant = parseExperimentalInstant,
244266
)
245267

246268
override fun equals(other: Any?): Boolean {
@@ -256,6 +278,7 @@ public class ParserOptions(
256278
if (nullStrings != other.nullStrings) return false
257279
if (skipTypes != other.skipTypes) return false
258280
if (parseExperimentalUuid != other.parseExperimentalUuid) return false
281+
if (parseExperimentalInstant != other.parseExperimentalInstant) return false
259282

260283
return true
261284
}
@@ -268,11 +291,12 @@ public class ParserOptions(
268291
result = 31 * result + (nullStrings?.hashCode() ?: 0)
269292
result = 31 * result + (skipTypes?.hashCode() ?: 0)
270293
result = 31 * result + (parseExperimentalUuid?.hashCode() ?: 0)
294+
result = 31 * result + (parseExperimentalInstant?.hashCode() ?: 0)
271295
return result
272296
}
273297

274298
override fun toString(): String =
275-
"ParserOptions(locale=$locale, dateTimeFormatter=$dateTimeFormatter, dateTimePattern=$dateTimePattern, nullStrings=$nullStrings, skipTypes=$skipTypes, useFastDoubleParser=$useFastDoubleParser, parseExperimentalUuid=$parseExperimentalUuid)"
299+
"ParserOptions(locale=$locale, dateTimeFormatter=$dateTimeFormatter, dateTimePattern=$dateTimePattern, nullStrings=$nullStrings, skipTypes=$skipTypes, useFastDoubleParser=$useFastDoubleParser, parseExperimentalUuid=$parseExperimentalUuid, parseExperimentalInstant=$parseExperimentalInstant)"
276300
}
277301

278302
/** Tries to parse a column of strings into a column of a different type.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/Rendering.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.jetbrains.kotlinx.dataframe.impl
22

3+
import kotlinx.datetime.LocalDateTime
4+
import kotlinx.datetime.LocalTime
35
import org.jetbrains.kotlinx.dataframe.AnyCol
46
import org.jetbrains.kotlinx.dataframe.AnyFrame
57
import org.jetbrains.kotlinx.dataframe.api.asColumnGroup
@@ -13,8 +15,6 @@ import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema
1315
import org.jetbrains.kotlinx.dataframe.size
1416
import org.jetbrains.kotlinx.dataframe.type
1517
import java.net.URL
16-
import java.time.LocalDateTime
17-
import java.time.LocalTime
1818
import kotlin.reflect.KType
1919
import kotlin.reflect.KVariance
2020
import kotlin.reflect.full.isSubtypeOf
@@ -72,11 +72,14 @@ internal fun renderType(type: KType?): String {
7272
fullName.removePrefix("java.net.")
7373

7474
type.classifier in listOf(LocalDateTime::class, LocalTime::class) ->
75-
fullName.removePrefix("java.time.")
75+
fullName.removePrefix("kotlinx.datetime.")
7676

7777
fullName.startsWith("kotlin.collections.") ->
7878
fullName.removePrefix("kotlin.collections.")
7979

80+
fullName.startsWith("kotlin.time.") ->
81+
fullName.removePrefix("kotlin.time.")
82+
8083
fullName.startsWith("kotlin.") ->
8184
fullName.removePrefix("kotlin.")
8285

0 commit comments

Comments
 (0)