@@ -48,7 +48,7 @@ class MigrationInfoServiceImpl(
48
48
/* *
49
49
* The migrations infos calculated at the last refresh.
50
50
*/
51
- private var migrationInfos: List <MigrationInfoImpl >? = null
51
+ private var migrationInfos: List <MigrationInfoImpl > = emptyList()
52
52
53
53
/* *
54
54
* Refreshes the info about all known migrations from both the classpath and the DB.
@@ -60,7 +60,7 @@ class MigrationInfoServiceImpl(
60
60
migrationInfos = mergeAvailableAndAppliedMigrations(availableMigrations, appliedMigrations)
61
61
62
62
if (MigrationVersion .CURRENT == = target) {
63
- target = current()!! .version
63
+ target = current()? .version
64
64
}
65
65
}
66
66
@@ -70,7 +70,7 @@ class MigrationInfoServiceImpl(
70
70
* @return The error message, or `null` if everything is fine.
71
71
*/
72
72
override fun validate (): String? {
73
- migrationInfos? .forEach { it.validate()?.let { return it } }
73
+ migrationInfos.forEach { it.validate()?.let { return it } }
74
74
return null
75
75
}
76
76
@@ -80,14 +80,14 @@ class MigrationInfoServiceImpl(
80
80
* @return The migrations.
81
81
*/
82
82
override fun all (): Array <MigrationInfo > {
83
- return migrationInfos? .toTypedArray< MigrationInfo >() ? : emptyArray ()
83
+ return migrationInfos.toTypedArray()
84
84
}
85
85
86
86
/* *
87
87
* @return Current migration to be run.
88
88
*/
89
89
override fun current (): MigrationInfo ? {
90
- return migrationInfos? .lastOrNull { it.state.isApplied }
90
+ return migrationInfos.lastOrNull { it.state.isApplied }
91
91
}
92
92
93
93
/* *
@@ -96,7 +96,7 @@ class MigrationInfoServiceImpl(
96
96
* @return The pending migrations. An empty array if none.
97
97
*/
98
98
override fun pending (): Array <MigrationInfo > {
99
- return migrationInfos? .filter { it.state == = MigrationState .PENDING }.orEmpty< MigrationInfo > ().toTypedArray()
99
+ return migrationInfos.filter { it.state == = MigrationState .PENDING }.orEmpty().toTypedArray()
100
100
}
101
101
102
102
/* *
@@ -105,7 +105,7 @@ class MigrationInfoServiceImpl(
105
105
* @return The applied migrations. An empty array if none.
106
106
*/
107
107
override fun applied (): Array <MigrationInfo > {
108
- return migrationInfos? .filter { it.state.isApplied }.orEmpty< MigrationInfo > ().toTypedArray()
108
+ return migrationInfos.filter { it.state.isApplied }.orEmpty().toTypedArray()
109
109
}
110
110
111
111
/* *
@@ -114,7 +114,7 @@ class MigrationInfoServiceImpl(
114
114
* @return The resolved migrations. An empty array if none.
115
115
*/
116
116
override fun resolved (): Array <MigrationInfo > {
117
- return migrationInfos? .filter { it.state.isResolved }.orEmpty< MigrationInfo > ().toTypedArray()
117
+ return migrationInfos.filter { it.state.isResolved }.orEmpty().toTypedArray()
118
118
}
119
119
120
120
/* *
@@ -123,7 +123,7 @@ class MigrationInfoServiceImpl(
123
123
* @return The failed migrations. An empty array if none.
124
124
*/
125
125
override fun failed (): Array <MigrationInfo > {
126
- return migrationInfos? .filter { it.state.isFailed }.orEmpty< MigrationInfo > ().toTypedArray()
126
+ return migrationInfos.filter { it.state.isFailed }.orEmpty().toTypedArray()
127
127
}
128
128
129
129
/* *
@@ -132,7 +132,7 @@ class MigrationInfoServiceImpl(
132
132
* @return The future migrations. An empty array if none.
133
133
*/
134
134
override fun future (): Array <MigrationInfo > {
135
- return migrationInfos? .filter { it.state == = MigrationState .FUTURE_SUCCESS }.orEmpty< MigrationInfo > ().toTypedArray()
135
+ return migrationInfos.filter { it.state == = MigrationState .FUTURE_SUCCESS }.orEmpty().toTypedArray()
136
136
}
137
137
138
138
/* *
@@ -141,7 +141,7 @@ class MigrationInfoServiceImpl(
141
141
* @return The out of order migrations. An empty array if none.
142
142
*/
143
143
override fun outOfOrder (): Array <MigrationInfo > {
144
- return migrationInfos? .filter { it.state == = MigrationState .OUT_OF_ORDER }.orEmpty< MigrationInfo > ().toTypedArray()
144
+ return migrationInfos.filter { it.state == = MigrationState .OUT_OF_ORDER }.orEmpty().toTypedArray()
145
145
}
146
146
147
147
/* *
0 commit comments