Skip to content

Commit 9907540

Browse files
authored
Rename experimental API annotation (#1114)
1 parent a8e32c0 commit 9907540

16 files changed

Lines changed: 70 additions & 36 deletions

File tree

kable-core/api/android/kable-core.api

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public abstract interface class com/juul/kable/DiscoveredService : com/juul/kabl
126126
public abstract interface annotation class com/juul/kable/ExperimentalApi : java/lang/annotation/Annotation {
127127
}
128128

129+
public abstract interface annotation class com/juul/kable/ExperimentalKableApi : java/lang/annotation/Annotation {
130+
}
131+
129132
public abstract class com/juul/kable/Filter {
130133
}
131134

kable-core/api/jvm/kable-core.api

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public abstract interface class com/juul/kable/DiscoveredService : com/juul/kabl
8585
public abstract interface annotation class com/juul/kable/ExperimentalApi : java/lang/annotation/Annotation {
8686
}
8787

88+
public abstract interface annotation class com/juul/kable/ExperimentalKableApi : java/lang/annotation/Annotation {
89+
}
90+
8891
public abstract class com/juul/kable/Filter {
8992
}
9093

kable-core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ kotlin {
5757
sourceSets {
5858
all {
5959
languageSettings {
60-
optIn("com.juul.kable.ExperimentalApi")
60+
optIn("com.juul.kable.ExperimentalKableApi")
6161
optIn("com.juul.kable.KableInternalApi")
6262
optIn("kotlin.concurrent.atomics.ExperimentalAtomicApi")
6363
optIn("kotlin.js.ExperimentalWasmJsInterop")

kable-core/src/androidMain/kotlin/BluetoothDeviceAndroidPeripheral.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ internal class BluetoothDeviceAndroidPeripheral(
100100

101101
override val address: String = requireNonZeroAddress(bluetoothDevice.address)
102102

103-
@ExperimentalApi
103+
@ExperimentalKableApi
104104
override val name: String?
105105
get() = bluetoothDevice.name
106106

@@ -171,7 +171,7 @@ internal class BluetoothDeviceAndroidPeripheral(
171171
override suspend fun maximumWriteValueLengthForType(writeType: WriteType): Int =
172172
(mtu.value ?: DEFAULT_ATT_MTU) - ATT_MTU_HEADER_SIZE
173173

174-
@ExperimentalApi // Experimental until Web Bluetooth advertisements APIs are stable.
174+
@ExperimentalKableApi // Experimental until Web Bluetooth advertisements APIs are stable.
175175
override suspend fun rssi(): Int =
176176
connectionOrThrow().execute<OnReadRemoteRssi> {
177177
readRemoteRssiOrThrow()

kable-core/src/androidMain/kotlin/Peripheral.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public actual fun Peripheral(
1111
return Peripheral(advertisement.bluetoothDevice, builderAction)
1212
}
1313

14-
@ExperimentalApi // Experimental while evaluating if this API introduces any footguns.
14+
@ExperimentalKableApi // Experimental while evaluating if this API introduces any footguns.
1515
public fun Peripheral(
1616
scanResult: ScanResult,
1717
builderAction: PeripheralBuilderAction,

kable-core/src/appleMain/kotlin/CBPeripheralCoreBluetoothPeripheral.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ internal class CBPeripheralCoreBluetoothPeripheral(
113113
connection.value
114114
?: throw NotConnectedException("Connection not established, current state: ${state.value}")
115115

116-
@ExperimentalApi
116+
@ExperimentalKableApi
117117
override val name: String?
118118
get() = cbPeripheral.name
119119

@@ -176,7 +176,7 @@ internal class CBPeripheralCoreBluetoothPeripheral(
176176
return cbPeripheral.maximumWriteValueLengthForType(type).toInt()
177177
}
178178

179-
@ExperimentalApi // Experimental until Web Bluetooth advertisements APIs are stable.
179+
@ExperimentalKableApi // Experimental until Web Bluetooth advertisements APIs are stable.
180180
@Throws(CancellationException::class, IOException::class)
181181
override suspend fun rssi(): Int = connectionOrThrow().execute<DidReadRssi> {
182182
cbPeripheral.readRSSI()

kable-core/src/commonMain/kotlin/Bluetooth.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public object Bluetooth {
7373
*
7474
* This function is idempotent.
7575
*/
76-
@ExperimentalApi // Due to the inability to query Bluetooth support w/o showing a dialog on Apple, this function may be removed.
76+
@ExperimentalKableApi // Due to the inability to query Bluetooth support w/o showing a dialog on Apple, this function may be removed.
7777
public suspend fun isSupported(): Boolean = isBluetoothSupported()
7878
}
7979

kable-core/src/commonMain/kotlin/ExperimentalApi.kt

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.juul.kable
2+
3+
import kotlin.RequiresOptIn.Level.ERROR
4+
import kotlin.annotation.AnnotationRetention.BINARY
5+
import kotlin.annotation.AnnotationTarget.ANNOTATION_CLASS
6+
import kotlin.annotation.AnnotationTarget.CLASS
7+
import kotlin.annotation.AnnotationTarget.CONSTRUCTOR
8+
import kotlin.annotation.AnnotationTarget.FIELD
9+
import kotlin.annotation.AnnotationTarget.FUNCTION
10+
import kotlin.annotation.AnnotationTarget.LOCAL_VARIABLE
11+
import kotlin.annotation.AnnotationTarget.PROPERTY
12+
import kotlin.annotation.AnnotationTarget.PROPERTY_GETTER
13+
import kotlin.annotation.AnnotationTarget.PROPERTY_SETTER
14+
import kotlin.annotation.AnnotationTarget.TYPEALIAS
15+
import kotlin.annotation.AnnotationTarget.VALUE_PARAMETER
16+
17+
@Deprecated(
18+
message = "Renamed to ExperimentalKableApi",
19+
replaceWith = ReplaceWith("ExperimentalKableApi"),
20+
level = DeprecationLevel.ERROR,
21+
)
22+
@Target(TYPEALIAS, FUNCTION, PROPERTY, CLASS)
23+
@Retention(BINARY)
24+
@RequiresOptIn(level = ERROR)
25+
public annotation class ExperimentalApi
26+
27+
/** Marks API that is experimental and/or likely to change. */
28+
@RequiresOptIn(level = ERROR)
29+
@Retention(BINARY)
30+
@Target(
31+
CLASS,
32+
ANNOTATION_CLASS,
33+
PROPERTY,
34+
FIELD,
35+
LOCAL_VARIABLE,
36+
VALUE_PARAMETER,
37+
CONSTRUCTOR,
38+
FUNCTION,
39+
PROPERTY_GETTER,
40+
PROPERTY_SETTER,
41+
TYPEALIAS,
42+
)
43+
@MustBeDocumented
44+
public annotation class ExperimentalKableApi

kable-core/src/commonMain/kotlin/Peripheral.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public interface Peripheral : AutoCloseable {
115115
* This API is experimental as it may be changed to a [StateFlow] in the future (to notify of
116116
* name changes on Apple platform).
117117
*/
118-
@ExperimentalApi
118+
@ExperimentalKableApi
119119
public val name: String?
120120

121121
/**
@@ -185,7 +185,7 @@ public interface Peripheral : AutoCloseable {
185185
* @throws NotConnectedException if invoked without an established [connection][connect].
186186
* @throws UnsupportedOperationException on JavaScript.
187187
*/
188-
@ExperimentalApi
188+
@ExperimentalKableApi
189189
@Throws(CancellationException::class, IOException::class)
190190
public suspend fun rssi(): Int
191191

0 commit comments

Comments
 (0)