Skip to content

Commit a9e70da

Browse files
authored
Merge pull request #1032 from Kotlin/candidate-for-removal
Add @CandidateForRemoval annotation
2 parents 7229d8f + 633bc9e commit a9e70da

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package org.jetbrains.kotlinx.dataframe.annotations
2+
3+
/**
4+
* Functions that can be replaced with other API, such as shortcuts without clean value,
5+
* or something not properly designed, and so will be considered to be removed from API.
6+
* If you see a function marked with it and think it should be kept, please let us know in the GitHub issue:
7+
* https://github.com/Kotlin/dataframe/issues/1028
8+
*/
9+
internal annotation class CandidateForRemoval

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import org.jetbrains.kotlinx.dataframe.DataFrame
88
import org.jetbrains.kotlinx.dataframe.DataRow
99
import org.jetbrains.kotlinx.dataframe.RowExpression
1010
import org.jetbrains.kotlinx.dataframe.annotations.AccessApiOverload
11+
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
1112
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
1213
import org.jetbrains.kotlinx.dataframe.columns.ColumnReference
1314
import org.jetbrains.kotlinx.dataframe.impl.columnName
@@ -20,8 +21,10 @@ import kotlin.experimental.ExperimentalTypeInference
2021
import kotlin.reflect.KProperty
2122
import kotlin.reflect.KType
2223

24+
@CandidateForRemoval
2325
public fun AnyRow.isEmpty(): Boolean = owner.columns().all { it[index] == null }
2426

27+
@CandidateForRemoval
2528
public fun AnyRow.isNotEmpty(): Boolean = !isEmpty()
2629

2730
public inline fun <reified R> AnyRow.valuesOf(): List<R> = values().filterIsInstance<R>()
@@ -168,12 +171,16 @@ public fun AnyRow.columnNames(): List<String> = df().columnNames()
168171

169172
public fun AnyRow.columnTypes(): List<KType> = df().columnTypes()
170173

174+
@CandidateForRemoval
171175
public fun <T> DataRow<T>.getRow(index: Int): DataRow<T> = getRowOrNull(index)!!
172176

177+
@CandidateForRemoval
173178
public fun <T> DataRow<T>.getRows(indices: Iterable<Int>): DataFrame<T> = df().getRows(indices)
174179

180+
@CandidateForRemoval
175181
public fun <T> DataRow<T>.getRows(indices: IntRange): DataFrame<T> = df().getRows(indices)
176182

183+
@CandidateForRemoval
177184
public fun <T> DataRow<T>.getRowOrNull(index: Int): DataRow<T>? {
178185
val df = df()
179186
return if (index >= 0 && index < df.nrow) df[index] else null
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package org.jetbrains.kotlinx.dataframe.api
22

33
import org.jetbrains.kotlinx.dataframe.DataFrame
4-
4+
import org.jetbrains.kotlinx.dataframe.annotations.CandidateForRemoval
55
// region DataFrame
66

7+
@CandidateForRemoval
78
public fun <T> DataFrame<T>.copy(): DataFrame<T> = columns().toDataFrame().cast()
89

910
// endregion

0 commit comments

Comments
 (0)