Skip to content

Commit 264c81f

Browse files
committed
feat: migration to context parameters
- deleted annotation DeprecatedWithContextParameters - modified typealias MutableBsonArrayLike - added typealias BsonArrayBuilder - modified typealias BsonArrayBlock to use context parameters - deprecated function toMutableBsonArray - deprecated function asMutableBsonArray - deprecated functions mutableBsonArrayOf - deleted interface IMutableBsonArrayLike and moved its members to toplevel - modified typealias MutableBsonDocumentLike - added typealias BsonDocumentBuilder - modified typealias BsonDocumentBlock to use context parameters - deprecated function toMutableBsonDocument - deprecated function asMutableBsonDocument - deprecated functions mutableBsonDocumentOf - deleted interface MutableBsonMapField - deleted interface IMutableBsonDocumentLike and move its members to toplevel
1 parent 4efee95 commit 264c81f

13 files changed

Lines changed: 785 additions & 1207 deletions

File tree

module-bsonkt/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77

88
kotlin {
99
compilerOptions {
10+
freeCompilerArgs.add("-Xcontext-parameters")
1011
optIn.add("kotlin.time.ExperimentalTime")
1112
}
1213
jvm()

module-bsonkt/src/commonMain/kotlin/Annotations.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@
1515
*/
1616
package org.cufy.bson
1717

18-
/**
19-
* Marks the annotated component as deprecated
20-
* only after context parameters are stable.
21-
*/
22-
annotation class DeprecatedWithContextParameters
23-
2418
/**
2519
* INTERNAL: A marker for bson build functions.
2620
*
2721
* @author LSafer
2822
* @since 2.0.0
2923
*/
3024
@DslMarker
25+
@Target(
26+
AnnotationTarget.CLASS,
27+
AnnotationTarget.PROPERTY,
28+
AnnotationTarget.FIELD,
29+
AnnotationTarget.LOCAL_VARIABLE,
30+
AnnotationTarget.VALUE_PARAMETER,
31+
AnnotationTarget.CONSTRUCTOR,
32+
AnnotationTarget.FUNCTION,
33+
AnnotationTarget.PROPERTY_GETTER,
34+
AnnotationTarget.PROPERTY_SETTER,
35+
AnnotationTarget.TYPEALIAS,
36+
)
3137
annotation class BsonMarker2
3238

3339
/**

module-bsonkt/src/commonMain/kotlin/BsonArray.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ inline fun BsonArray(): BsonArray {
7272
* function will result to an undefined behaviour.**
7373
*/
7474
inline fun BsonArray(block: BsonArrayBlock): BsonArray {
75-
val content = mutableBsonArrayOf()
75+
val content = mutableListOf<BsonElement>()
7676
content.apply(block)
7777
return BsonArray(content)
7878
}

0 commit comments

Comments
 (0)