Skip to content

Commit 4e3de8f

Browse files
authored
Keep the single-argument parse functions for binary compatibility (#345)
1 parent 0e15b5c commit 4e3de8f

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

core/jvm/src/Instant.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public actual class Instant internal constructor(internal val value: jtInstant)
8282
}
8383
}
8484

85+
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
86+
public fun parse(isoString: String): Instant = parse(input = isoString)
87+
8588
/** A workaround for a quirk of the JDKs older than 11 where the string representations of Instant that have an
8689
* offset of the form "+XX" are not recognized by [jtOffsetDateTime.parse], while "+XX:XX" work fine. */
8790
private fun fixOffsetRepresentation(isoString: CharSequence): CharSequence {

core/jvm/src/LocalDate.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public actual class LocalDate internal constructor(internal val value: jtLocalDa
3030
format.parse(input)
3131
}
3232

33+
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
34+
public fun parse(isoString: String): LocalDate = parse(input = isoString)
35+
3336
internal actual val MIN: LocalDate = LocalDate(jtLocalDate.MIN)
3437
internal actual val MAX: LocalDate = LocalDate(jtLocalDate.MAX)
3538

core/jvm/src/LocalDateTime.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public actual class LocalDateTime internal constructor(internal val value: jtLoc
6868
format.parse(input)
6969
}
7070

71+
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
72+
public fun parse(isoString: String): LocalDateTime = parse(input = isoString)
73+
7174
internal actual val MIN: LocalDateTime = LocalDateTime(jtLocalDateTime.MIN)
7275
internal actual val MAX: LocalDateTime = LocalDateTime(jtLocalDateTime.MAX)
7376

core/jvm/src/LocalTime.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public actual class LocalTime internal constructor(internal val value: jtLocalTi
5656
format.parse(input)
5757
}
5858

59+
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
60+
public fun parse(isoString: String): LocalTime = parse(input = isoString)
61+
5962
public actual fun fromSecondOfDay(secondOfDay: Int): LocalTime = try {
6063
jtLocalTime.ofSecondOfDay(secondOfDay.toLong()).let(::LocalTime)
6164
} catch (e: DateTimeException) {

core/jvm/src/UtcOffsetJvm.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ public actual class UtcOffset(internal val zoneOffset: ZoneOffset) {
3131
else -> format.parse(input)
3232
}
3333

34+
@Deprecated("This overload is only kept for binary compatibility", level = DeprecationLevel.HIDDEN)
35+
public fun parse(offsetString: String): UtcOffset = parse(input = offsetString)
36+
3437
@Suppress("FunctionName")
3538
public actual fun Format(block: DateTimeFormatBuilder.WithUtcOffset.() -> Unit): DateTimeFormat<UtcOffset> =
3639
UtcOffsetFormat.build(block)

0 commit comments

Comments
 (0)