File tree Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Expand file tree Collapse file tree 3 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ public sealed interface DateTimeFormatBuilder {
129
129
*
130
130
* [am] is used for the AM marker (0-11 hours), [pm] is used for the PM marker (12-23 hours).
131
131
*
132
+ * Empty strings can not be used as markers.
133
+ *
132
134
* @see [amPmHour]
133
135
*/
134
136
public fun amPmMarker (am : String , pm : String )
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import kotlinx.datetime.internal.format.parser.Copyable
12
12
13
13
/* *
14
14
* A description of how month names are formatted.
15
+ *
16
+ * An empty string can not be a month name.
15
17
*/
16
18
public class MonthNames (
17
19
/* *
@@ -21,6 +23,7 @@ public class MonthNames(
21
23
) {
22
24
init {
23
25
require(names.size == 12 ) { " Month names must contain exactly 12 elements" }
26
+ names.forEach { require(it.isNotEmpty()) { " A month name can not be empty" } }
24
27
}
25
28
26
29
/* *
@@ -63,6 +66,8 @@ internal fun MonthNames.toKotlinCode(): String = when (this.names) {
63
66
64
67
/* *
65
68
* A description of how day of week names are formatted.
69
+ *
70
+ * An empty string can not be a day-of-week name.
66
71
*/
67
72
public class DayOfWeekNames (
68
73
/* *
@@ -72,6 +77,7 @@ public class DayOfWeekNames(
72
77
) {
73
78
init {
74
79
require(names.size == 7 ) { " Day of week names must contain exactly 7 elements" }
80
+ names.forEach { require(it.isNotEmpty()) { " A month name can not be empty" } }
75
81
}
76
82
77
83
/* *
Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ internal class StringSetParserOperation<Output>(
152
152
153
153
init {
154
154
for (string in strings) {
155
+ require(string.isNotEmpty()) { " Found an empty string in $whatThisExpects " }
155
156
var node = trie
156
157
for (char in string) {
157
158
val searchResult = node.children.binarySearchBy(char.toString()) { it.first }
You can’t perform that action at this time.
0 commit comments