Skip to content

Commit

Permalink
Adding an annotation to flag experimental features. (#107)
Browse files Browse the repository at this point in the history
Fixes #106
  • Loading branch information
Kantis authored Feb 17, 2024
1 parent 7d40223 commit 73f9ee3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ks3-core/api/ks3-core.api
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
public abstract interface annotation class io/ks3/core/ExperimentalKs3 : java/lang/annotation/Annotation {
}

public abstract interface annotation class io/ks3/core/Ks3Internal : java/lang/annotation/Annotation {
}

6 changes: 6 additions & 0 deletions ks3-core/src/commonMain/kotlin/io/ks3/core/ExperimentalKs3.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.ks3.core

@RequiresOptIn(level = RequiresOptIn.Level.WARNING, message = "This API is experimental and is prone to change in the future.")
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
annotation class ExperimentalKs3
1 change: 1 addition & 0 deletions ks3-standard/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ kotlin {
sourceSets {
commonMain {
dependencies {
implementation(projects.ks3Core)
implementation(libs.kotlinxSerialization.core)
implementation(libs.kotlinxSerialization.json)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.ks3.standard

import io.ks3.core.ExperimentalKs3
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerializationException
import kotlinx.serialization.SerializationStrategy
Expand All @@ -22,6 +23,7 @@ import kotlinx.serialization.serializer
* println(numbers) // > [1, 2, 3, 5]
* ```
*/
@ExperimentalKs3
inline fun <reified T> lenientJsonArraySerializer(explicitElementSerializer: KSerializer<T>? = null) =
object : KSerializer<List<T>> {
private val elementSerializer = explicitElementSerializer ?: serializer<T>()
Expand Down

0 comments on commit 73f9ee3

Please sign in to comment.